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]
Message-ID: <202402091625.4DF63CDD0B@keescook>
Date: Fri, 9 Feb 2024 16:41:36 -0800
From: Kees Cook <keescook@...omium.org>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	Florian Weimer <fweimer@...hat.com>, linux-kernel@...r.kernel.org,
	linux-arch@...r.kernel.org, linux-api@...r.kernel.org,
	x86@...nel.org, Eric Biederman <ebiederm@...ssion.com>,
	linux-mm@...ck.org
Subject: Re: [PATCH v4] ELF: AT_PAGE_SHIFT_MASK -- supply userspace with
 available page shifts

On Fri, Feb 09, 2024 at 03:30:37PM +0300, Alexey Dobriyan wrote:
> On Mon, Feb 05, 2024 at 04:48:08AM -0800, Kees Cook wrote:
> > On Mon, Feb 05, 2024 at 12:51:43PM +0300, Alexey Dobriyan wrote:
> > > +#define ARCH_AT_PAGE_SHIFT_MASK					\
> > > +	do {							\
> > > +		u32 val = 1 << 12;				\
> > > +		if (boot_cpu_has(X86_FEATURE_PSE)) {		\
> > > +			val |= 1 << 21;				\
> > > +		}						\
> > > +		if (boot_cpu_has(X86_FEATURE_GBPAGES)) {	\
> > > +			val |= 1 << 30;				\
> > > +		}						\
> > 
> > Can we use something besides literal "12", "21", and "30" values here?
> 
> Ehh, no, why? Inside x86_64 the page shifts are very specific numbers,
> they won't change.

Well, it's nicer to have meaningful words to describe these things. In
fact, PAGE_SHIFT already exists for 12, and HPAGE_SHIFT already exists
for 21. Please use those, and add another, perhaps GBPAGE_SHIFT, for 30.

-Kees

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ