Re: [PATCH 6.4 000/292] 6.4.5-rc1 review

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 22, 2023 at 6:37 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> [ Removed the stable reviewers, bringing in the kfence people ]
>
> See
>
>   https://lore.kernel.org/lkml/CA+G9fYvgy22wiY=c3wLOrCM6o33636abhtEynXhJkqxJh4ca0A@xxxxxxxxxxxxxx/
>
> for the original report. The warning was introduced in 8f0b36497303
> ("mm: kfence: fix objcgs vector allocation"), and Google doesn't find
> any other cases of this.
>
> Anybody?
>
>                     Linus
>


> > NOTE:
> > The following kernel warning was noticed while booting qemu-arm64
> > with these configs enabled on stable rc 6.4.5-rc1.
> >
> >  CONFIG_ARM64_64K_PAGES=y
> >  CONFIG_KFENCE=y

Is there a full config somewhere?

> > This crash is not easily reproducible.

CONFIG_KFENCE_SAMPLE_INTERVAL=10
CONFIG_KFENCE_NUM_OBJECTS=2048

might improve reproducibility.

> >
> > boot logs:
> > --------
> > [    0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
> > [    0.000000] Linux version 6.4.5-rc1 (tuxmake@tuxmake)
> > (aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils
> > for Debian) 2.40) #1 SMP PREEMPT @1689957802
> > [    0.000000] random: crng init done
> > [    0.000000] Machine model: linux,dummy-virt
> > ...
> > [    0.006821] kfence: initialized - using 33554432 bytes for 255
> > objects at 0x(____ptrval____)-0x(____ptrval____)
> > ...
> > [    7.726994] ------------[ cut here ]------------
> > [    7.727704] WARNING: CPU: 1 PID: 1 at mm/kfence/core.c:1097
> > __kfence_free+0x84/0xc8
> ...
> > [    7.746478] Call trace:
> > [    7.746776]  __kfence_free+0x84/0xc8
> > [    7.747134]  __slab_free+0x490/0x508
> > [    7.748063]  __kmem_cache_free+0x2b4/0x2d0
> > [    7.748377]  kfree+0x78/0x140
> > [    7.748638]  single_release+0x40/0x60
> > [    7.750664]  __fput+0x78/0x260
> > [    7.751065]  ____fput+0x18/0x30
> > [    7.752086]  task_work_run+0x80/0xe0
> > [    7.753122]  do_notify_resume+0x200/0x1398
> > [    7.754292]  el0_svc+0xec/0x100
> > [    7.754573]  el0t_64_sync_handler+0xf4/0x120
> > [    7.755559]  el0t_64_sync+0x190/0x198

It would be interesting to see the contents of
/sys/kernel/debug/kfence/objects together with the object address.
Would it be possible to boot the kernel with no_hash_pointers and add
a line printing the object address:

diff --git a/mm/kfence/core.c b/mm/kfence/core.c
index dad3c0eb70a01..23f27f6cb18cf 100644
--- a/mm/kfence/core.c
+++ b/mm/kfence/core.c
@@ -1094,7 +1094,10 @@ void __kfence_free(void *addr)
        struct kfence_metadata *meta = addr_to_metadata((unsigned long)addr);

 #ifdef CONFIG_MEMCG
-       KFENCE_WARN_ON(meta->objcg);
+       if (meta->objcg) {
+               pr_err("ADDR: %px\n", addr);
+               KFENCE_WARN_ON(1);
+       }
 #endif
        /*
         * If the objects of the cache are SLAB_TYPESAFE_BY_RCU, defer freeing

, and then dump /sys/kernel/debug/kfence/objects?

Knowing the kfence pool location (the line starting with "kfence:
initialized") and the object address, we can probably understand from
the allocation stack in sysfs, whether the object is supposed to be
deleted.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux