* "Fix spurious sanity check failures in destroy_workqueue()" introduced memory leaks
@ 2019-09-20 20:26 Qian Cai
2019-09-20 20:43 ` [PATCH wq/for-5.4-fixes] workqueue: Fix missing kfree(rescuer) in destroy_workqueue() Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Qian Cai @ 2019-09-20 20:26 UTC (permalink / raw)
To: Tejun Heo
Cc: Marcin Pawlowski, Williams, Gerald S, linux-kernel, Lai Jiangshan
The linux-next commit [1] introduced a lot of memory leaks while running LTP fs
tests (/opt/ltp/runltp -f fs). Reverted the commit fixed the problem. It seems
the new code wq->rescuer to NULL without free it first, so later rcu_free_wq()
is unable to free it.
unreferenced object 0xffff8f822e7c8428 (size 192):
comm "fs_fill", pid 8310, jiffies 4294965449 (age 494.720s)
hex dump (first 32 bytes):
28 84 7c 2e 82 8f ff ff 28 84 7c 2e 82 8f ff ff (.|.....(.|.....
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<0000000030795d2f>] kmem_cache_alloc_node_trace+0x153/0x470
[<000000000398512e>] alloc_worker+0x21/0x50
[<000000001934cb3a>] init_rescuer.part.4+0x1d/0xb0
[<00000000f36417e5>] alloc_workqueue+0x336/0x5f3
[<0000000011066bf3>] ext4_fill_super+0x1eec/0x2f70 [ext4]
[<000000001fdee6fd>] mount_bdev+0x191/0x1c0
[<00000000e2d3e265>] ext4_mount+0x15/0x20 [ext4]
[<00000000631fe1d9>] legacy_get_tree+0x34/0x60
[<00000000ee947c38>] vfs_get_tree+0x27/0xb0
[<00000000f4bcb594>] do_mount+0x8a0/0xae0
[<0000000005dd5056>] ksys_mount+0xb6/0xd0
[<00000000fb14e10a>] __x64_sys_mount+0x25/0x30
[<000000009fb1dd3e>] do_syscall_64+0x6d/0x488
[<00000000a822a6c4>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
unreferenced object 0xffff8f824c314218 (size 192):
comm "fs_fill", pid 8310, jiffies 4294966011 (age 489.100s)
hex dump (first 32 bytes):
18 42 31 4c 82 8f ff ff 18 42 31 4c 82 8f ff ff .B1L.....B1L....
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<0000000030795d2f>] kmem_cache_alloc_node_trace+0x153/0x470
[<000000000398512e>] alloc_worker+0x21/0x50
[<000000001934cb3a>] init_rescuer.part.4+0x1d/0xb0
[<00000000f36417e5>] alloc_workqueue+0x336/0x5f3
[<000000000b6d2e88>] xfs_init_mount_workqueues+0x2a/0x150 [xfs]
[<0000000014c756cd>] xfs_fs_fill_super+0x311/0x760 [xfs]
[<000000001fdee6fd>] mount_bdev+0x191/0x1c0
[<00000000d0aa6706>] xfs_fs_mount+0x15/0x20 [xfs]
[<00000000631fe1d9>] legacy_get_tree+0x34/0x60
[<00000000ee947c38>] vfs_get_tree+0x27/0xb0
[<00000000f4bcb594>] do_mount+0x8a0/0xae0
[<0000000005dd5056>] ksys_mount+0xb6/0xd0
[<00000000fb14e10a>] __x64_sys_mount+0x25/0x30
[<000000009fb1dd3e>] do_syscall_64+0x6d/0x488
[<00000000a822a6c4>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[1] https://lore.kernel.org/lkml/20190919014340.GM3084169@devbig004.ftw2.faceboo
k.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH wq/for-5.4-fixes] workqueue: Fix missing kfree(rescuer) in destroy_workqueue()
2019-09-20 20:26 "Fix spurious sanity check failures in destroy_workqueue()" introduced memory leaks Qian Cai
@ 2019-09-20 20:43 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2019-09-20 20:43 UTC (permalink / raw)
To: Qian Cai
Cc: Marcin Pawlowski, Williams, Gerald S, linux-kernel, Lai Jiangshan
From 8efe1223d73c218ce7e8b2e0e9aadb974b582d7f Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Fri, 20 Sep 2019 13:39:57 -0700
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Qian Cai <cai@lca.pw>
Fixes: def98c84b6cd ("workqueue: Fix spurious sanity check failures in destroy_workqueue()")
---
Applied to wq/for-5.4-fixes.
Thanks.
kernel/workqueue.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 93e20f5330fc..3f067f1d72e3 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4345,6 +4345,7 @@ void destroy_workqueue(struct workqueue_struct *wq)
/* rescuer will empty maydays list before exiting */
kthread_stop(rescuer->task);
+ kfree(rescuer);
}
/* sanity checks */
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-20 20:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-20 20:26 "Fix spurious sanity check failures in destroy_workqueue()" introduced memory leaks Qian Cai
2019-09-20 20:43 ` [PATCH wq/for-5.4-fixes] workqueue: Fix missing kfree(rescuer) in destroy_workqueue() Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).