linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] workqueue: fix duplicate wq_update_pod_attrs_buf allocation
@ 2023-09-13 10:16 John Ogness
  2023-09-15 11:24 ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: John Ogness @ 2023-09-13 10:16 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Lai Jiangshan, linux-kernel

One of the hunks for the patch resulting in
commit 84193c07105c ("workqueue: Generalize unbound CPU pods") was
applied incorrectly. This resulted in @wq_update_pod_attrs_buf
being allocated twice.

From the kmemleak detector:

unreferenced object 0xc0000000040074c0 (size 64):
  comm "swapper/0", pid 0, jiffies 4294937296 (age 1936.580s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<0000000076b83a6e>] .kmalloc_trace+0x54/0x190
    [<00000000898f2356>] .alloc_workqueue_attrs+0x2c/0x60
    [<0000000063365e1f>] .workqueue_init_early+0xe4/0x4b8
    [<00000000ca97ff39>] .start_kernel+0x8d0/0xba4
    [<000000002ee12080>] start_here_common+0x1c/0x20

Remove the redundant allocation.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
 kernel/workqueue.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index c85825e17df8..43ab8399b72b 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -6524,9 +6524,6 @@ void __init workqueue_init_early(void)
 
 	pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC);
 
-	wq_update_pod_attrs_buf = alloc_workqueue_attrs();
-	BUG_ON(!wq_update_pod_attrs_buf);
-
 	/* initialize WQ_AFFN_SYSTEM pods */
 	pt->pod_cpus = kcalloc(1, sizeof(pt->pod_cpus[0]), GFP_KERNEL);
 	pt->pod_node = kcalloc(1, sizeof(pt->pod_node[0]), GFP_KERNEL);

base-commit: 3669558bdf354cd352be955ef2764cde6a9bf5ec
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] workqueue: fix duplicate wq_update_pod_attrs_buf allocation
  2023-09-13 10:16 [PATCH] workqueue: fix duplicate wq_update_pod_attrs_buf allocation John Ogness
@ 2023-09-15 11:24 ` Geert Uytterhoeven
  2023-09-16  3:14   ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2023-09-15 11:24 UTC (permalink / raw)
  To: John Ogness; +Cc: Tejun Heo, Lai Jiangshan, linux-kernel

On Wed, Sep 13, 2023 at 8:05 PM John Ogness <john.ogness@linutronix.de> wrote:
> One of the hunks for the patch resulting in
> commit 84193c07105c ("workqueue: Generalize unbound CPU pods") was
> applied incorrectly. This resulted in @wq_update_pod_attrs_buf
> being allocated twice.
>
> From the kmemleak detector:
>
> unreferenced object 0xc0000000040074c0 (size 64):
>   comm "swapper/0", pid 0, jiffies 4294937296 (age 1936.580s)
>   hex dump (first 32 bytes):
>     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03  ................
>     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>   backtrace:
>     [<0000000076b83a6e>] .kmalloc_trace+0x54/0x190
>     [<00000000898f2356>] .alloc_workqueue_attrs+0x2c/0x60
>     [<0000000063365e1f>] .workqueue_init_early+0xe4/0x4b8
>     [<00000000ca97ff39>] .start_kernel+0x8d0/0xba4
>     [<000000002ee12080>] start_here_common+0x1c/0x20
>
> Remove the redundant allocation.
>
> Signed-off-by: John Ogness <john.ogness@linutronix.de>

Stephen posted a similar patch before:
https://lore.kernel.org/all/20230905174935.2d75feab@gandalf.local.home

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] workqueue: fix duplicate wq_update_pod_attrs_buf allocation
  2023-09-15 11:24 ` Geert Uytterhoeven
@ 2023-09-16  3:14   ` Kees Cook
  2023-09-18 18:36     ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2023-09-16  3:14 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: John Ogness, Tejun Heo, Lai Jiangshan, Steven Rostedt, linux-kernel

On Fri, Sep 15, 2023 at 01:24:25PM +0200, Geert Uytterhoeven wrote:
> On Wed, Sep 13, 2023 at 8:05 PM John Ogness <john.ogness@linutronix.de> wrote:
> > One of the hunks for the patch resulting in
> > commit 84193c07105c ("workqueue: Generalize unbound CPU pods") was
> > applied incorrectly. This resulted in @wq_update_pod_attrs_buf
> > being allocated twice.
> >
> > From the kmemleak detector:
> >
> > unreferenced object 0xc0000000040074c0 (size 64):
> >   comm "swapper/0", pid 0, jiffies 4294937296 (age 1936.580s)
> >   hex dump (first 32 bytes):
> >     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03  ................
> >     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
> >   backtrace:
> >     [<0000000076b83a6e>] .kmalloc_trace+0x54/0x190
> >     [<00000000898f2356>] .alloc_workqueue_attrs+0x2c/0x60
> >     [<0000000063365e1f>] .workqueue_init_early+0xe4/0x4b8
> >     [<00000000ca97ff39>] .start_kernel+0x8d0/0xba4
> >     [<000000002ee12080>] start_here_common+0x1c/0x20
> >
> > Remove the redundant allocation.
> >
> > Signed-off-by: John Ogness <john.ogness@linutronix.de>
> 
> Stephen posted a similar patch before:
> https://lore.kernel.org/all/20230905174935.2d75feab@gandalf.local.home

I tripped over this kmemleak report too. It'd be nice to get this into
-rc2. Tejun, are able to get this or the Sep 5th patch to Linus soon?

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] workqueue: fix duplicate wq_update_pod_attrs_buf allocation
  2023-09-16  3:14   ` Kees Cook
@ 2023-09-18 18:36     ` Tejun Heo
  0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2023-09-18 18:36 UTC (permalink / raw)
  To: Kees Cook
  Cc: Geert Uytterhoeven, John Ogness, Lai Jiangshan, Steven Rostedt,
	linux-kernel

On Fri, Sep 15, 2023 at 08:14:12PM -0700, Kees Cook wrote:
> > Stephen posted a similar patch before:
> > https://lore.kernel.org/all/20230905174935.2d75feab@gandalf.local.home
> 
> I tripped over this kmemleak report too. It'd be nice to get this into
> -rc2. Tejun, are able to get this or the Sep 5th patch to Linus soon?

Applied Stephen's one. Sorry about the delay. Have been seek for a few
weeks.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-18 18:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13 10:16 [PATCH] workqueue: fix duplicate wq_update_pod_attrs_buf allocation John Ogness
2023-09-15 11:24 ` Geert Uytterhoeven
2023-09-16  3:14   ` Kees Cook
2023-09-18 18:36     ` 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).