lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 12 Mar 2022 11:04:30 +0000
From:   Hyeonggon Yoo <42.hyeyoo@...il.com>
To:     Vlastimil Babka <vbabka@...e.cz>
Cc:     kernel test robot <oliver.sang@...el.com>,
        Oliver Glitta <glittao@...il.com>, lkp@...ts.01.org,
        lkp@...el.com, LKML <linux-kernel@...r.kernel.org>,
        linux-mm@...ck.org, Mike Rapoport <rppt@...nel.org>
Subject: Re: [mm/slub] ae107fa919: BUG:unable_to_handle_page_fault_for_address

On Sat, Mar 12, 2022 at 10:21:25AM +0100, Vlastimil Babka wrote:
> On 3/12/22 02:10, Hyeonggon Yoo wrote:
> > On Fri, Mar 11, 2022 at 04:46:00PM +0000, Hyeonggon Yoo wrote:
> >> On Fri, Mar 11, 2022 at 04:36:47PM +0100, Vlastimil Babka wrote:
> >>> On 3/11/22 15:54, Hyeonggon Yoo wrote:
> >>>> On Wed, Mar 09, 2022 at 10:15:31AM +0800, kernel test robot wrote:
> >>>>>
> >>>>>
> >>>>> Greeting,
> >>>>>
> >>>>> FYI, we noticed the following commit (built with gcc-9):
> >>>>>
> >>>>> commit: ae107fa91914f098cd54ab77e68f83dd6259e901 ("mm/slub: use stackdepot to save stack trace in objects")
> >>>>> https://git.kernel.org/cgit/linux/kernel/git/vbabka/linux.git slub-stackdepot-v3r0
> >>>>>
> >>>>> in testcase: boot
> >>>>>
> >>>>> on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G
> >>>>>
> >>>>> caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):
> >>>>>
> >>>>
> >>>> [+Cc Vlastimil and linux-mm]
> >>>
> >>> Thanks.
> >>> lkp folks: it would be nice if I was CC'd automatically on this, it's a
> >>> commit from my git tree and with by s-o-b :)
> >>>
> >>>> I _strongly_ suspect that this is because we don't initialize
> >>>> stack_table[i] = NULL when we allocate it from memblock_alloc().
> >>>
> >>> No, Mike (CC'd) suggested to drop the array init cycle, because
> >>> memblock_alloc would zero the area anyway.
> >>
> >> Ah, you are right. My mistake.
> >>
> >>> There has to be a different
> >>> reason. Wondering if dmesg contains the stack depot initialization message
> >>> at all...
> >>
> >> I think I found the reason.
> >> This is because of CONFIG_SLUB_DEBUG_ON.
> >> It can enable debugging without passing boot parameter.
> >>
> >> if CONFIG_SLUB_DEBUG_ON=y && slub_debug is not passed, we do not call
> >> stack_depot_want_early_init(), but the debugging flags are set.
> >>
> >> And we only call stack_depot_init() later in kmem_cache_create_usercopy().
> >>
> >> so it crashed while creating boot cache.
> > 
> > I tested this, and this was the reason.
> > It crashed on CONFIG_SLUB_DEBUG_ON=y because stackdepot always assume
> > that it was initialized in boot step, or failed
> > (stack_depot_disable=true).
> > 
> > But as it didn't even tried to initialize it, stack_table == NULL &&
> > stack_depot_disable == false. So accessing *(NULL + <hash value>)
> 
> Thanks for finding the cause!
> 

;)

> > Ideas? implementing something like kmem_cache_init_early() again?
> 
> I think we could simply make CONFIG_SLUB_DEBUG_ON select/depend on
> STACKDEPOT_ALWAYS_INIT?

Oh, sounds better.

If we make CONFIG_SLUB_DEBUG_ON select STACK_DEPOT_ALWAYS_INIT,
that is simple solution. but stackdepot will be initialized on
slub_debug=- too.

But I think no one will set CONFIG_SLUB_DEBUG_ON=y if not debugging...

I don't think making CONFIG_SLUB_DEBUG_ON depend on
CONFIG_STACKDEPOT_ALWAYS_INIT is good solution. only KASAN selects it.

-- 
Thank you, You are awesome!
Hyeonggon :-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ