lkml.org 
[lkml]   [2023]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] ELF: supply userspace with available page shifts (AT_PAGE_SHIFT_MASK)
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.

\
 
 \ /
  Last update: 2023-12-07 16:06    [W:0.229 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site