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] [day] [month] [year] [list]
Date:   Tue, 31 May 2022 10:41:00 +0000
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     Christoph Hellwig <hch@...radead.org>,
        Michael Ellerman <mpe@...erman.id.au>
CC:     Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
        Erhard Furtner <erhard_f@...lbox.org>
Subject: Re: [PATCH] powerpc/Kconfig: Force THREAD_SHIFT to at least 14 with
 KASAN



Le 31/05/2022 à 09:41, Christoph Hellwig a écrit :
> On Tue, May 31, 2022 at 04:16:19PM +1000, Michael Ellerman wrote:
>> I was thinking of doing it in C, similar to the way arm64 handles it.
>>
>> Something like below. It means we always double the stack size when
>> KASAN is enabled. I think it's preferable, as it will always work
>> regardless of whether the user has an old .config (or is bisectting)?
> 
> Is there any reason to even offer the Kconfig?  It is super cryptic and
> just picking the right value directly in the header would seem much
> more sensible:

Looks like it  was added by commit 476134070c03 ("powerpc: Move 
THREAD_SHIFT config to Kconfig") in 2017.
https://github.com/torvalds/linux/commit/476134070c037820bd909ff6e43e0d3eae33f376

Seems like powerpc is the only architecture with it configurable via 
Kconfig.

I'd be inclined to reverting that commit, and then I'd do something 
similar to arm64:

#ifdef CONFIG_KSAN
#define KASAN_THREAD_SHIFT	1
#else
#define KASAN_THREAD_SHIFT	0
#endif

#if defined(CONFIG_PPC_256K_PAGES)
#define MIN_THREAD_SHIFT		(15 + KASAN_THREAD_SHIFT)
#elif defined(CONFIG_PPC64)
#define MIN_THREAD_SHIFT		(14 + KASAN_THREAD_SHIFT)
#else
#define MIN_THREAD_SHIFT		(13 + KASAN_THREAD_SHIFT)
#endif

#if defined(CONFIG_VMAP_STACK) && (MIN_THREAD_SHIFT < PAGE_SHIFT)
#define THREAD_SHIFT		PAGE_SHIFT
#else
#define THREAD_SHIFT		MIN_THREAD_SHIFT
#endif


And maybe the CONFIG_PPC_256K_PAGES case is already big enough and 
doesn't require the + 1 for KASAN.

> 
> #if defined(CONFIG_PPC_256K_PAGES)
> #define MIN_THREAD_SHIFT		15
> #elif defined(CONFIG_PPC64)
> #define MIN_THREAD_SHIFT		14
> #else
> #define MIN_THREAD_SHIFT		13
> #endif
> 
> #ifdef CONFIG_KASAN
> #define THREAD_SHIFT		(MIN_THREAD_SHIFT + 1)
> #else
> #define THREAD_SHIFT		MIN_THREAD_SHIFT
> #endif
> 
> #if defined(CONFIG_VMAP_STACK) && THREAD_SHIFT < PAGE_SHIFT
> #undef THREAD_SHIFT
> #define THREAD_SHIFT		PAGE_SHIFT
> #endif

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ