[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQJLD7+7aySxv+NtS9LMFgj-O=RhSjkF3b-X3ngwzU2K4Q@mail.gmail.com>
Date: Mon, 13 Oct 2025 14:33:24 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: kernel test robot <oliver.sang@...el.com>, Alexei Starovoitov <ast@...nel.org>, oe-lkp@...ts.linux.dev,
kbuild test robot <lkp@...el.com>, LKML <linux-kernel@...r.kernel.org>,
Harry Yoo <harry.yoo@...cle.com>, kasan-dev <kasan-dev@...glegroups.com>,
"open list:CONTROL GROUP (CGROUP)" <cgroups@...r.kernel.org>, linux-mm <linux-mm@...ck.org>
Subject: Re: [linus:master] [slab] af92793e52: BUG_kmalloc-#(Not_tainted):Freepointer_corrupt
On Mon, Oct 13, 2025 at 7:58 AM Vlastimil Babka <vbabka@...e.cz> wrote:
>
> On 10/10/25 10:39, kernel test robot wrote:
> >
> >
> > Hello,
> >
> > kernel test robot noticed "BUG_kmalloc-#(Not_tainted):Freepointer_corrupt" on:
> >
> > commit: af92793e52c3a99b828ed4bdd277fd3e11c18d08 ("slab: Introduce kmalloc_nolock() and kfree_nolock().")
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
> >
> > [test failed on linus/master ec714e371f22f716a04e6ecb2a24988c92b26911]
> > [test failed on linux-next/master 0b2f041c47acb45db82b4e847af6e17eb66cd32d]
> > [test failed on fix commit 83d59d81b20c09c256099d1c15d7da21969581bd]
> >
> > in testcase: trinity
> > version: trinity-i386-abe9de86-1_20230429
> > with following parameters:
> >
> > runtime: 300s
> > group: group-01
> > nr_groups: 5
> >
> >
> >
> > config: i386-randconfig-012-20251004
> > compiler: gcc-14
> > test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G
> >
> > (please refer to attached dmesg/kmsg for entire log/backtrace)
> >
> >
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <oliver.sang@...el.com>
> > | Closes: https://lore.kernel.org/oe-lkp/202510101652.7921fdc6-lkp@intel.com
>
> Does this fix it?
> ----8<----
> From 5f467c4e630a7a8e5ba024d31065413bddf22cec Mon Sep 17 00:00:00 2001
> From: Vlastimil Babka <vbabka@...e.cz>
> Date: Mon, 13 Oct 2025 16:56:28 +0200
> Subject: [PATCH] slab: fix clearing freelist in free_deferred_objects()
>
> Signed-off-by: Vlastimil Babka <vbabka@...e.cz>
> ---
> mm/slub.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index f9f7f3942074..080d27fe253f 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -6377,15 +6377,16 @@ static void free_deferred_objects(struct irq_work *work)
> slab = virt_to_slab(x);
> s = slab->slab_cache;
>
> +
> + /* Point 'x' back to the beginning of allocated object */
> + x -= s->offset;
> /*
> * We used freepointer in 'x' to link 'x' into df->objects.
> * Clear it to NULL to avoid false positive detection
> * of "Freepointer corruption".
> */
> - *(void **)x = NULL;
> + set_freepointer(s, x, NULL);
>
> - /* Point 'x' back to the beginning of allocated object */
> - x -= s->offset;
> __slab_free(s, slab, x, x, 1, _THIS_IP_);
Thanks for the fix!
Acked-by: Alexei Starovoitov <ast@...nel.org>
The bot spotted it with CONFIG_SLAB_FREELIST_HARDENED=y.
It wasn't part of my tests. Sorry.
Powered by blists - more mailing lists