Bug 206203 - kmemleak reports various leaks in drivers/of/unittest.c
Summary: kmemleak reports various leaks in drivers/of/unittest.c
Status: RESOLVED OBSOLETE
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: PPC-64 (show other bugs)
Hardware: PPC-64 Linux
: P1 normal
Assignee: platform_ppc-64
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-14 15:51 UTC by Erhard F.
Modified: 2023-10-31 16:44 UTC (History)
2 users (show)

See Also:
Kernel Version: 5.4.11
Subsystem:
Regression: No
Bisected commit-id:


Attachments
kmemleak output (28.70 KB, text/plain)
2020-01-14 15:51 UTC, Erhard F.
Details
dmesg (kernel 5.4.11, Talos II) (66.33 KB, text/plain)
2020-01-14 15:54 UTC, Erhard F.
Details
kernel .config (kernel 5.4.11, Talos II) (98.13 KB, text/plain)
2020-01-14 15:55 UTC, Erhard F.
Details
kmemleak output (kernel 5.6-rc3, PowerMac G5 11,2) (91.35 KB, text/plain)
2020-02-27 21:19 UTC, Erhard F.
Details
dmesg (kernel 5.6-rc3, PowerMac G5 11,2) (70.47 KB, text/plain)
2020-02-27 21:20 UTC, Erhard F.
Details
kernel .config (kernel 5.6-rc3, PowerMac G5 11,2) (100.80 KB, text/plain)
2020-02-27 21:31 UTC, Erhard F.
Details
dmesg (kernel 5.6.2, Talos II) (94.02 KB, text/plain)
2020-04-03 19:22 UTC, Erhard F.
Details
kernel .config (kernel 5.6.2, Talos II) (100.58 KB, text/plain)
2020-04-03 19:23 UTC, Erhard F.
Details
kmemleak output (kernel 5.6.2, Talos II) (118.97 KB, text/plain)
2020-04-03 19:23 UTC, Erhard F.
Details
kmemleak output (kernel 5.7-rc1, PowerMac G5 11,2) (56.41 KB, text/plain)
2020-04-17 15:46 UTC, Erhard F.
Details
dmesg (kernel 5.7-rc1, PowerMac G5 11,2) (81.23 KB, text/plain)
2020-04-17 15:47 UTC, Erhard F.
Details
kmemleak output (kernel 5.8-rc1, PowerMac G5 11,2) (55.08 KB, text/plain)
2020-06-15 20:43 UTC, Erhard F.
Details
dmesg (kernel 5.8-rc1, PowerMac G5 11,2) (80.60 KB, text/plain)
2020-06-15 20:45 UTC, Erhard F.
Details
kernel .config (kernel 5.8-rc1, PowerMac G5 11,2) (102.46 KB, text/plain)
2020-06-15 20:53 UTC, Erhard F.
Details
dmesg (kernel 5.8-rc7, PowerMac G4 3,6) (85.70 KB, text/plain)
2020-07-28 07:18 UTC, Erhard F.
Details
kmemleak output (kernel 5.8-rc7, PowerMac G4 3,6) (898.81 KB, text/plain)
2020-07-28 07:19 UTC, Erhard F.
Details
dmesg (kernel 5.9-rc3, Talos II) (120.98 KB, text/plain)
2020-09-02 14:38 UTC, Erhard F.
Details
kmemleak output (kernel 5.9-rc3, Talos II) (52.63 KB, text/plain)
2020-09-02 14:39 UTC, Erhard F.
Details
kernel .config (kernel 5.9-rc3, Talos II) (101.32 KB, text/plain)
2020-09-02 14:45 UTC, Erhard F.
Details
kernel dmesg (kernel 6.1-rc5, PowerMac G4 3,6) (67.52 KB, text/plain)
2022-11-20 17:24 UTC, Erhard F.
Details
kmemleak output (kernel 6.1-rc5, PowerMac G4 3,6) (774.41 KB, text/plain)
2022-11-20 17:24 UTC, Erhard F.
Details
kernel .config (kernel 6.1-rc5, PowerMac G4 3,6) (111.83 KB, text/plain)
2022-11-20 17:25 UTC, Erhard F.
Details

Description Erhard F. 2020-01-14 15:51:29 UTC
Created attachment 286801 [details]
kmemleak output

kmemleak reported various leaks in "swapper/0" while I was building a kernel on my Talos II:

[...]
unreferenced object 0xc0002007f833c780 (size 8):
  comm "swapper/0", pid 1, jiffies 4294878487 (age 1637.240s)
  hex dump (first 8 bytes):
    6e 61 6d 65 00 00 03 18                          name....
  backtrace:
    [<00000000d64d7001>] .kstrdup+0x44/0xb0
    [<00000000d7cb5018>] .__of_prop_dup+0x60/0x130
    [<000000003a4c11d9>] .of_unittest_changeset+0x3c0/0xa20
    [<00000000f6cf112e>] .of_unittest+0x1e9c/0x3808
    [<0000000018a2e72e>] .do_one_initcall+0x7c/0x420
    [<00000000de53cd05>] .kernel_init_freeable+0x2d8/0x3d4
    [<00000000e79ea455>] .kernel_init+0x14/0x158
    [<0000000099bc20e8>] .ret_from_kernel_thread+0x58/0x68
unreferenced object 0xc0002007f833c498 (size 8):
  comm "swapper/0", pid 1, jiffies 4294878487 (age 1637.240s)
  hex dump (first 8 bytes):
    6e 32 31 00 00 00 0e f8                          n21.....
  backtrace:
    [<00000000a8bde092>] .kmemdup+0x30/0x70
    [<00000000a5916f40>] .__of_prop_dup+0x7c/0x130
    [<000000003a4c11d9>] .of_unittest_changeset+0x3c0/0xa20
    [<00000000f6cf112e>] .of_unittest+0x1e9c/0x3808
    [<0000000018a2e72e>] .do_one_initcall+0x7c/0x420
    [<00000000de53cd05>] .kernel_init_freeable+0x2d8/0x3d4
    [<00000000e79ea455>] .kernel_init+0x14/0x158
    [<0000000099bc20e8>] .ret_from_kernel_thread+0x58/0x68
unreferenced object 0xc0002007f833c818 (size 8):
  comm "swapper/0", pid 1, jiffies 4294878487 (age 1637.240s)
  hex dump (first 8 bytes):
    6e 31 00 00 00 00 06 b8                          n1......
  backtrace:
    [<00000000d64d7001>] .kstrdup+0x44/0xb0
    [<0000000059dd59eb>] .kvasprintf_const+0x74/0xf0
    [<00000000d729a1b8>] .kobject_set_name_vargs+0x34/0xf0
    [<00000000e8b8c22b>] .kobject_add+0x50/0xe0
    [<00000000223588e9>] .__of_attach_node_sysfs+0xa8/0x160
    [<0000000085cbb668>] .__of_changeset_entry_apply+0x32c/0x390
    [<00000000f1d284ee>] .__of_changeset_apply_entries+0x48/0x110
    [<00000000b7434f45>] .of_changeset_apply+0x54/0xc0
    [<0000000022b41feb>] .of_unittest_changeset+0x8a4/0xa20
    [<00000000f6cf112e>] .of_unittest+0x1e9c/0x3808
    [<0000000018a2e72e>] .do_one_initcall+0x7c/0x420
    [<00000000de53cd05>] .kernel_init_freeable+0x2d8/0x3d4
    [<00000000e79ea455>] .kernel_init+0x14/0x158
    [<0000000099bc20e8>] .ret_from_kernel_thread+0x58/0x68
[...]
Comment 1 Erhard F. 2020-01-14 15:54:56 UTC
Created attachment 286803 [details]
dmesg (kernel 5.4.11, Talos II)
Comment 2 Erhard F. 2020-01-14 15:55:45 UTC
Created attachment 286805 [details]
kernel .config (kernel 5.4.11, Talos II)
Comment 3 Erhard F. 2020-02-27 21:19:36 UTC
Created attachment 287671 [details]
kmemleak output (kernel 5.6-rc3, PowerMac G5 11,2)

Same on a PowerMac G5 11,2 (kernel 5.6-rc3).
Comment 4 Erhard F. 2020-02-27 21:20:15 UTC
Created attachment 287673 [details]
dmesg (kernel 5.6-rc3, PowerMac G5 11,2)
Comment 5 Erhard F. 2020-02-27 21:31:23 UTC
Created attachment 287675 [details]
kernel .config (kernel 5.6-rc3, PowerMac G5 11,2)
Comment 6 mpe 2020-02-27 22:07:05 UTC
bugzilla-daemon@bugzilla.kernel.org writes:
> https://bugzilla.kernel.org/show_bug.cgi?id=206203
>
> --- Comment #3 from Erhard F. (erhard_f@mailbox.org) ---
> Created attachment 287671 [details]
>   --> https://bugzilla.kernel.org/attachment.cgi?id=287671&action=edit
> kmemleak output (kernel 5.6-rc3, PowerMac G5 11,2)
>
> Same on a PowerMac G5 11,2 (kernel 5.6-rc3).

Can you attach the /sys/kernel/debug/kmemleak output please.

cheers
Comment 7 Erhard F. 2020-02-27 22:39:55 UTC
(In reply to mpe from comment #6)
> Can you attach the /sys/kernel/debug/kmemleak output please.
> 
> cheers
I already did:
"kmemleak output (kernel 5.6-rc3, PowerMac G5 11,2) (91.35 KB, text/plain)"
Comment 8 Erhard F. 2020-04-03 19:22:22 UTC
Created attachment 288185 [details]
dmesg (kernel 5.6.2, Talos II)
Comment 9 Erhard F. 2020-04-03 19:23:09 UTC
Created attachment 288187 [details]
kernel .config (kernel 5.6.2, Talos II)
Comment 10 Erhard F. 2020-04-03 19:23:59 UTC
Created attachment 288189 [details]
kmemleak output (kernel 5.6.2, Talos II)
Comment 11 Erhard F. 2020-04-17 15:46:38 UTC
Created attachment 288565 [details]
kmemleak output (kernel 5.7-rc1, PowerMac G5 11,2)

Applied Frank's patch set on top of 5.7-rc1. Though there are certainly less memory leaks now, there are still some OF ones reported.

Frank Rowand (5):
  of: unittest: kmemleak on changeset destroy
  of: unittest: kmemleak in of_unittest_platform_populate()
  of: unittest: kmemleak in of_unittest_overlay_high_level()
  of: overlay: kmemleak in dup_and_fixup_symbol_prop()
  of: unittest: kmemleak in duplicate property update
Comment 12 Erhard F. 2020-04-17 15:47:35 UTC
Created attachment 288567 [details]
dmesg (kernel 5.7-rc1, PowerMac G5 11,2)
Comment 13 Erhard F. 2020-06-15 20:43:54 UTC
Created attachment 289675 [details]
kmemleak output (kernel 5.8-rc1, PowerMac G5 11,2)
Comment 14 Erhard F. 2020-06-15 20:45:18 UTC
Created attachment 289677 [details]
dmesg (kernel 5.8-rc1, PowerMac G5 11,2)
Comment 15 Erhard F. 2020-06-15 20:53:52 UTC
Created attachment 289679 [details]
kernel .config (kernel 5.8-rc1, PowerMac G5 11,2)
Comment 16 Erhard F. 2020-07-28 07:18:24 UTC
Created attachment 290639 [details]
dmesg (kernel 5.8-rc7, PowerMac G4 3,6)
Comment 17 Erhard F. 2020-07-28 07:19:14 UTC
Created attachment 290641 [details]
kmemleak output (kernel 5.8-rc7, PowerMac G4 3,6)

Also happens on my G4 DP.
Comment 18 Erhard F. 2020-09-02 14:38:48 UTC
Created attachment 292285 [details]
dmesg (kernel 5.9-rc3, Talos II)
Comment 19 Erhard F. 2020-09-02 14:39:52 UTC
Created attachment 292287 [details]
kmemleak output (kernel 5.9-rc3, Talos II)
Comment 20 Erhard F. 2020-09-02 14:45:40 UTC
Created attachment 292289 [details]
kernel .config (kernel 5.9-rc3, Talos II)
Comment 21 Erhard F. 2021-03-03 20:57:35 UTC
Kmemleak remains silent since at least 5.11.x on these machines. Which is a good sign I guess. ;)

Closing for now. In case I hit these of: based memleaks again I will re-open.
Comment 22 Erhard F. 2022-11-20 17:18:52 UTC
As the kmemleak output pretty much the same and as it's the same PowerMac G4 DP I reopened this bug. Seems some OF changes meanwhile lead to memory leaks again.

This is 6.1-rc5:

[...]
    [<46e6ec0a>] __of_add_property_sysfs+0xb8/0x128
    [<d8832181>] __of_attach_node_sysfs+0xc0/0x170
    [<2592df33>] of_core_init+0xf8/0x23c
    [<e5e36822>] driver_init+0x4c/0x80
    [<9cac2ddd>] kernel_init_freeable+0x138/0x354
    [<fcc01e1e>] kernel_init+0x28/0x154
    [<0cec001f>] ret_from_kernel_thread+0x5c/0x64
unreferenced object 0xc140b820 (size 16):
  comm "swapper/0", pid 1, jiffies 4294877302 (age 1153.234s)
  hex dump (first 16 bytes):
    63 6f 6d 70 61 74 69 62 6c 65 00 6b 6b 6b 6b a5  compatible.kkkk.
  backtrace:
    [<92345f14>] kstrdup+0x44/0x9c
    [<46e6ec0a>] __of_add_property_sysfs+0xb8/0x128
    [<d8832181>] __of_attach_node_sysfs+0xc0/0x170
    [<2592df33>] of_core_init+0xf8/0x23c
    [<e5e36822>] driver_init+0x4c/0x80
    [<9cac2ddd>] kernel_init_freeable+0x138/0x354
    [<fcc01e1e>] kernel_init+0x28/0x154
    [<0cec001f>] ret_from_kernel_thread+0x5c/0x64
unreferenced object 0xc140b2b0 (size 16):
  comm "swapper/0", pid 1, jiffies 4294877302 (age 1153.234s)
  hex dump (first 16 bytes):
    73 65 72 69 61 6c 2d 6e 75 6d 62 65 72 00 6b a5  serial-number.k.
  backtrace:
    [<92345f14>] kstrdup+0x44/0x9c
    [<46e6ec0a>] __of_add_property_sysfs+0xb8/0x128
    [<d8832181>] __of_attach_node_sysfs+0xc0/0x170
    [<2592df33>] of_core_init+0xf8/0x23c
    [<e5e36822>] driver_init+0x4c/0x80
    [<9cac2ddd>] kernel_init_freeable+0x138/0x354
    [<fcc01e1e>] kernel_init+0x28/0x154
    [<0cec001f>] ret_from_kernel_thread+0x5c/0x64
unreferenced object 0xc1470f20 (size 32):
  comm "swapper/0", pid 1, jiffies 4294877302 (age 1153.234s)
  hex dump (first 32 bytes):
    63 75 73 74 6f 6d 65 72 2d 73 77 2d 63 6f 6e 66  customer-sw-conf
    69 67 00 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  ig.kkkkkkkkkkkk.
  backtrace:
    [<92345f14>] kstrdup+0x44/0x9c
    [<46e6ec0a>] __of_add_property_sysfs+0xb8/0x128
    [<d8832181>] __of_attach_node_sysfs+0xc0/0x170
...skipping...
  backtrace:
    [<92345f14>] kstrdup+0x44/0x9c
    [<8e6fdf66>] kobject_set_name_vargs+0x34/0xcc
    [<0ebf4a99>] kobject_add+0x88/0x110
    [<21cfd1b6>] __of_attach_node_sysfs+0x94/0x170
    [<2592df33>] of_core_init+0xf8/0x23c
    [<e5e36822>] driver_init+0x4c/0x80
    [<9cac2ddd>] kernel_init_freeable+0x138/0x354
    [<fcc01e1e>] kernel_init+0x28/0x154
    [<0cec001f>] ret_from_kernel_thread+0x5c/0x64
unreferenced object 0xc17341c0 (size 16):
  comm "swapper/0", pid 1, jiffies 4294877309 (age 1153.314s)
  hex dump (first 16 bytes):
    64 65 76 69 63 65 5f 74 79 70 65 00 6b 6b 6b a5  device_type.kkk.
  backtrace:
    [<92345f14>] kstrdup+0x44/0x9c
    [<46e6ec0a>] __of_add_property_sysfs+0xb8/0x128
    [<d8832181>] __of_attach_node_sysfs+0xc0/0x170
    [<2592df33>] of_core_init+0xf8/0x23c
    [<e5e36822>] driver_init+0x4c/0x80
    [<9cac2ddd>] kernel_init_freeable+0x138/0x354
    [<fcc01e1e>] kernel_init+0x28/0x154
    [<0cec001f>] ret_from_kernel_thread+0x5c/0x64
unreferenced object 0xc1739168 (size 8):
  comm "swapper/0", pid 1, jiffies 4294877309 (age 1153.314s)
  hex dump (first 8 bytes):
    72 65 67 00 6b 6b 6b a5                          reg.kkk.
  backtrace:
    [<92345f14>] kstrdup+0x44/0x9c
    [<46e6ec0a>] __of_add_property_sysfs+0xb8/0x128
    [<d8832181>] __of_attach_node_sysfs+0xc0/0x170
    [<2592df33>] of_core_init+0xf8/0x23c
    [<e5e36822>] driver_init+0x4c/0x80
    [<9cac2ddd>] kernel_init_freeable+0x138/0x354
    [<fcc01e1e>] kernel_init+0x28/0x154
    [<0cec001f>] ret_from_kernel_thread+0x5c/0x64
unreferenced object 0xc17396c8 (size 8):
  comm "swapper/0", pid 1, jiffies 4294877309 (age 1153.314s)
  hex dump (first 8 bytes):
    70 68 61 6e 64 6c 65 00                          phandle.
  backtrace:
    [<92345f14>] kstrdup+0x44/0x9c
    [<46e6ec0a>] __of_add_property_sysfs+0xb8/0x128
    [<d8832181>] __of_attach_node_sysfs+0xc0/0x170
    [<2592df33>] of_core_init+0xf8/0x23c
    [<e5e36822>] driver_init+0x4c/0x80
    [<9cac2ddd>] kernel_init_freeable+0x138/0x354
    [<fcc01e1e>] kernel_init+0x28/0x154
    [<0cec001f>] ret_from_kernel_thread+0x5c/0x64
unreferenced object 0xc1739708 (size 8):
  comm "swapper/0", pid 1, jiffies 4294877309 (age 1153.314s)
  hex dump (first 8 bytes):
    6e 61 6d 65 00 6b 6b a5                          name.kk.
  backtrace:
    [<92345f14>] kstrdup+0x44/0x9c
    [<46e6ec0a>] __of_add_property_sysfs+0xb8/0x128
    [<d8832181>] __of_attach_node_sysfs+0xc0/0x170
    [<2592df33>] of_core_init+0xf8/0x23c
    [<e5e36822>] driver_init+0x4c/0x80
    [<9cac2ddd>] kernel_init_freeable+0x138/0x354
    [<fcc01e1e>] kernel_init+0x28/0x154
    [<0cec001f>] ret_from_kernel_thread+0x5c/0x64
...skipping...
unreferenced object 0xc1405588 (size 8):
  comm "swapper/0", pid 1, jiffies 4294877302 (age 1153.234s)
  hex dump (first 8 bytes):
    62 61 73 65 00 6b 6b a5                          base.kk.
  backtrace:
    [<92345f14>] kstrdup+0x44/0x9c
    [<8e6fdf66>] kobject_set_name_vargs+0x34/0xcc
    [<0ebf4a99>] kobject_add+0x88/0x110
    [<21cfd1b6>] __of_attach_node_sysfs+0x94/0x170
    [<2592df33>] of_core_init+0xf8/0x23c
    [<e5e36822>] driver_init+0x4c/0x80
    [<9cac2ddd>] kernel_init_freeable+0x138/0x354
    [<fcc01e1e>] kernel_init+0x28/0x154
    [<0cec001f>] ret_from_kernel_thread+0x5c/0x64
unreferenced object 0xc1405568 (size 8):
  comm "swapper/0", pid 1, jiffies 4294877302 (age 1153.234s)
  hex dump (first 8 bytes):
    6d 6f 64 65 6c 00 6b a5                          model.k.
  backtrace:
    [<92345f14>] kstrdup+0x44/0x9c
    [<46e6ec0a>] __of_add_property_sysfs+0xb8/0x128
    [<d8832181>] __of_attach_node_sysfs+0xc0/0x170
    [<2592df33>] of_core_init+0xf8/0x23c
    [<e5e36822>] driver_init+0x4c/0x80
    [<9cac2ddd>] kernel_init_freeable+0x138/0x354
    [<fcc01e1e>] kernel_init+0x28/0x154
    [<0cec001f>] ret_from_kernel_thread+0x5c/0x64
unreferenced object 0xc140b820 (size 16):
  comm "swapper/0", pid 1, jiffies 4294877302 (age 1153.234s)
  hex dump (first 16 bytes):
    63 6f 6d 70 61 74 69 62 6c 65 00 6b 6b 6b 6b a5  compatible.kkkk.
  backtrace:
    [<92345f14>] kstrdup+0x44/0x9c
    [<46e6ec0a>] __of_add_property_sysfs+0xb8/0x128
    [<d8832181>] __of_attach_node_sysfs+0xc0/0x170
    [<2592df33>] of_core_init+0xf8/0x23c
    [<e5e36822>] driver_init+0x4c/0x80
    [<9cac2ddd>] kernel_init_freeable+0x138/0x354
    [<fcc01e1e>] kernel_init+0x28/0x154
    [<0cec001f>] ret_from_kernel_thread+0x5c/0x64
Comment 23 Erhard F. 2022-11-20 17:24:05 UTC
Created attachment 303239 [details]
kernel dmesg (kernel 6.1-rc5, PowerMac G4 3,6)
Comment 24 Erhard F. 2022-11-20 17:24:52 UTC
Created attachment 303240 [details]
kmemleak output (kernel 6.1-rc5, PowerMac G4 3,6)
Comment 25 Erhard F. 2022-11-20 17:25:31 UTC
Created attachment 303241 [details]
kernel .config (kernel 6.1-rc5, PowerMac G4 3,6)
Comment 26 Erhard F. 2023-10-31 16:44:36 UTC
Closed in favour of:
https://lore.kernel.org/all/20231018233815.34a0417f@yea/#r

Note You need to log in before you can comment on or make changes to this bug.