[PATCH v3 00/29] Teach glibc about possible page sizes and handle gaps in ld.so

H.J. Lu hjl.tools@gmail.com
Sun Sep 29 20:16:46 GMT 2024


On Sun, Sep 29, 2024 at 11:47 PM Florian Weimer <fweimer@redhat.com> wrote:
>
> This series is another attempt to fix bug 31943.  If the binutils RELRO
> bug is fixed, we still run into a conceptual issue with LOAD segment
> gaps if the system supports multiple page sizes (or at least, if ld uses
> a larger page size than required on Linux, as it happens on some
> targets).  To avoid the overhead and loss of test coverage by accepting
> gaps everywhere, this series teaches glibc the possible range of page
> sizes for each supported architecture.
>
> Information regarding possible page sizes is useful to application
> programmers, so this is exposed in a new <sys/pagesize.h> installed
> header.  It is just too tempting to use this to optimize getpagesize
> etc., so the series contains some commits for that as well.  No ABI
> changes necessary.
>
> There is a new build failure on loongarch, apparently unrelated, and
> reported as GCC PR116887.
>
> Thanks,
> Florian
>
> Florian Weimer (29):
>   elf: Add tests to verify that l_contiguous reflects reality
>   Prepare for the addition of the <sys/pagesize.h> header
>   aarch64: Add <bits/pagesize.h>
>   alpha: Add <bits/pagesize.h>
>   arc: Add <bits/pagesize.h>
>   arm: Add <bits/pagesize.h>
>   csky: Add <bits/pagesize.h>
>   hppa: Add <bits/pagesize.h>
>   loongarch: Add <bits/pagesize.h>
>   m68k: Add <bits/pagesize.h>
>   microblaze: Add <bits/pagesize.h>
>   mips: Add <bits/pagesize.h>
>   nios2: Add <bits/pagesize.h>
>   or1k: Add <bits/pagesize.h>
>   powerpc: Add <bits/pagesize.h>
>   riscv: Add <bits/pagesize.h>
>   s390: Add <bits/pagesize.h>
>   sh: Add <bits/pagesize.h>
>   sparc: Add <bits/pagesize.h>
>   x86: Add <bits/pagesize.h>
>   misc: Add tst-getpagesize
>   elf: Extract rtld_setup_phdr function from dl_main
>   configure: Add --with-ld-relro-load-gaps configure option and test
>   elf: Handle ld.so with LOAD segment gaps in _dl_find_object (bug
>     31943)
>   Install the <sys/pagesize.h> header file
>   Linux: Optimize getpagesize using <sys/pagesize.h>
>   malloc: Use volatile as compiler barrier in tst-memalign, tst-valloc
>   posix: Use <support/next_to_fault.h> in tst-fnmatch3
>   Optimize various ways to obtain the page size using <bits/pagesize.h>

Should pagesize.h files have a copyright notice? How many pagesize.h files
are identical?  Should the most common ones be shared?


>  INSTALL                               |  12 +++
>  NEWS                                  |   5 +
>  bits/pagesize.h                       |  10 ++
>  bits/shm.h                            |   9 ++
>  config.h.in                           |   3 +
>  configure                             |  39 ++++++++
>  configure.ac                          |  20 ++++
>  elf/Makefile                          |  31 ++++++
>  elf/dl-find_object.c                  |  78 +++++++++------
>  elf/rtld.c                            |  84 +++++++++++-----
>  elf/tst-link-map-contiguous-ldso.c    |  43 ++++++++
>  elf/tst-link-map-contiguous-libc.c    |  57 +++++++++++
>  elf/tst-link-map-contiguous-main.c    |  45 +++++++++
>  elf/tst-program-headers.py            | 137 ++++++++++++++++++++++++++
>  include/sys/pagesize.h                |   1 +
>  malloc/tst-memalign.c                 |  17 ++--
>  malloc/tst-valloc.c                   |  17 ++--
>  manual/install.texi                   |  12 +++
>  manual/resource.texi                  |  31 ++++++
>  misc/Makefile                         |   3 +
>  misc/sys/pagesize.h                   |  32 ++++++
>  misc/tst-getpagesize.c                |  65 ++++++++++++
>  posix/tst-fnmatch3.c                  |  23 ++---
>  posix/unistd.h                        |  21 ++++
>  sysdeps/aarch64/bits/pagesize.h       |   2 +
>  sysdeps/alpha/bits/pagesize.h         |   2 +
>  sysdeps/arc/bits/pagesize.h           |   2 +
>  sysdeps/arm/bits/pagesize.h           |   2 +
>  sysdeps/csky/bits/pagesize.h          |   2 +
>  sysdeps/hppa/bits/pagesize.h          |   2 +
>  sysdeps/loongarch/bits/pagesize.h     |   2 +
>  sysdeps/m68k/bits/pagesize.h          |   2 +
>  sysdeps/m68k/coldfire/bits/pagesize.h |   2 +
>  sysdeps/microblaze/bits/pagesize.h    |   2 +
>  sysdeps/mips/bits/pagesize.h          |   2 +
>  sysdeps/nios2/bits/pagesize.h         |   2 +
>  sysdeps/or1k/bits/pagesize.h          |   2 +
>  sysdeps/powerpc/bits/pagesize.h       |   2 +
>  sysdeps/riscv/bits/pagesize.h         |   2 +
>  sysdeps/s390/bits/pagesize.h          |   2 +
>  sysdeps/sh/bits/pagesize.h            |   2 +
>  sysdeps/sparc/sparc32/bits/pagesize.h |   2 +
>  sysdeps/sparc/sparc64/bits/pagesize.h |   2 +
>  sysdeps/unix/sysv/linux/arc/Makefile  |   5 +
>  sysdeps/unix/sysv/linux/arm/Makefile  |   3 +
>  sysdeps/unix/sysv/linux/getpagesize.c |   5 +
>  sysdeps/x86/bits/pagesize.h           |   2 +
>  47 files changed, 758 insertions(+), 90 deletions(-)
>  create mode 100644 bits/pagesize.h
>  create mode 100644 elf/tst-link-map-contiguous-ldso.c
>  create mode 100644 elf/tst-link-map-contiguous-libc.c
>  create mode 100644 elf/tst-link-map-contiguous-main.c
>  create mode 100644 elf/tst-program-headers.py
>  create mode 100644 include/sys/pagesize.h
>  create mode 100644 misc/sys/pagesize.h
>  create mode 100644 misc/tst-getpagesize.c
>  create mode 100644 sysdeps/aarch64/bits/pagesize.h
>  create mode 100644 sysdeps/alpha/bits/pagesize.h
>  create mode 100644 sysdeps/arc/bits/pagesize.h
>  create mode 100644 sysdeps/arm/bits/pagesize.h
>  create mode 100644 sysdeps/csky/bits/pagesize.h
>  create mode 100644 sysdeps/hppa/bits/pagesize.h
>  create mode 100644 sysdeps/loongarch/bits/pagesize.h
>  create mode 100644 sysdeps/m68k/bits/pagesize.h
>  create mode 100644 sysdeps/m68k/coldfire/bits/pagesize.h
>  create mode 100644 sysdeps/microblaze/bits/pagesize.h
>  create mode 100644 sysdeps/mips/bits/pagesize.h
>  create mode 100644 sysdeps/nios2/bits/pagesize.h
>  create mode 100644 sysdeps/or1k/bits/pagesize.h
>  create mode 100644 sysdeps/powerpc/bits/pagesize.h
>  create mode 100644 sysdeps/riscv/bits/pagesize.h
>  create mode 100644 sysdeps/s390/bits/pagesize.h
>  create mode 100644 sysdeps/sh/bits/pagesize.h
>  create mode 100644 sysdeps/sparc/sparc32/bits/pagesize.h
>  create mode 100644 sysdeps/sparc/sparc64/bits/pagesize.h
>  create mode 100644 sysdeps/x86/bits/pagesize.h
>
>
> base-commit: 6948ee4edf0c57c556f8d5f394d9191216d05780
> --
> 2.46.2
>


H.J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20240930/c28ece65/attachment-0001.htm>


More information about the Libc-alpha mailing list