public inbox for linux-api@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Kees Cook <keescook@chromium.org>
Cc: Florian Weimer <fweimer@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-api@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH v2] ELF: supply userspace with available page shifts (AT_PAGE_SHIFT_MASK)
Date: Thu, 7 Dec 2023 18:04:09 +0300	[thread overview]
Message-ID: <bb7fdb53-6917-44aa-8118-a8b357583c50@p183> (raw)
In-Reply-To: <202312061308.630C56CCA@keescook>

On Wed, Dec 06, 2023 at 01:09:01PM -0800, Kees Cook wrote:
> On Wed, Dec 06, 2023 at 10:05:36PM +0100, Florian Weimer wrote:
> > * Kees Cook:
> > 
> > > On Tue, Dec 05, 2023 at 07:01:34PM +0300, Alexey Dobriyan wrote:
> > >> Report available page shifts in arch independent manner, so that
> > >> userspace developers won't have to parse /proc/cpuinfo hunting
> > >> for arch specific strings:
> > >> 
> > >> Note!
> > >> 
> > >> This is strictly for userspace, if some page size is shutdown due
> > >> to kernel command line option or CPU bug workaround, than is must not
> > >> be reported in aux vector!
> > >
> > > Given Florian in CC, I assume this is something glibc would like to be
> > > using? Please mention this in the commit log.
> > 
> > Nope, I just wrote a random drive-by comment on the first version.
> 
> Ah, okay. Then Alexey, who do you expect to be the consumer of this new
> AT value?

libhugetlbfs and everyone who is using 2 MiB pages.

New code should look like this:

	#ifndef AT_PAGE_SHIFT_MASK
	#define AT_PAGE_SHIFT_MASK 29
	#endif
	unsigned long val = getauxval(AT_PAGE_SHIFT_MASK);
	if (val) {
		g_page_size_2mib = val & (1UL << 21);
		return;
	}
	// old 2 MiB page detection code

It is few lines of fast code before code they're already using.

  reply	other threads:[~2023-12-07 15:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 17:18 [PATCH] ELF: supply userspace with available page shifts (AT_PAGE_SHIFT_LIST) Alexey Dobriyan
2023-12-05  9:51 ` Florian Weimer
2023-12-05 14:26   ` Alexey Dobriyan
2023-12-05 16:01   ` [PATCH v2] ELF: supply userspace with available page shifts (AT_PAGE_SHIFT_MASK) Alexey Dobriyan
2023-12-06 20:47     ` Kees Cook
2023-12-06 21:05       ` Florian Weimer
2023-12-06 21:09         ` Kees Cook
2023-12-07 15:04           ` Alexey Dobriyan [this message]
2023-12-07 14:57       ` Alexey Dobriyan
2023-12-07 15:32         ` Florian Weimer
2023-12-08 18:29         ` Kees Cook
2023-12-08 18:35           ` Florian Weimer
2023-12-08 18:38             ` Kees Cook
2023-12-09  9:44           ` Alexey Dobriyan
2023-12-07 18:44     ` [PATCH v3] ELF: AT_PAGE_SHIFT_MASK -- supply userspace with available page shifts Alexey Dobriyan
2023-12-12 21:09       ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bb7fdb53-6917-44aa-8118-a8b357583c50@p183 \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=fweimer@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox