unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy via Libc-alpha <libc-alpha@sourceware.org>
To: libc-alpha@sourceware.org
Subject: [PATCH v5 0/7] fix ifunc with static pie [BZ #27072]
Date: Wed, 20 Jan 2021 15:29:57 +0000	[thread overview]
Message-ID: <cover.1611155254.git.szabolcs.nagy@arm.com> (raw)

v5:
- reordered patches.
- config check SUPPORT_STATIC_PIE (instead of PI_STATIC_AND_HIDDEN)
- fix __ehdr_start differently: just drop weak.
- update commit messages for hidden visibility changes.

v4:
- added patches from H.J.Lu:
	- x86: fix libmvec tests
	- x86: fix syscalls in libc_enable_secure
	- x86: avoid relative reloc for _dl_sysinfo
	- x86: add ifunc test
- i386 cannot mark all symbols hidden, so use fine grain
  marking in files that participate in early code before
  static pie self relocation.
- the patch that makes all libc symbols hidden is still
  included: it is now only an optimization for non-i386
  targets.

v3:
- refactor tunables: move internals out of dl-tunables.h
- use generated max string length in the tunables list
  instead of magic values.

v2:
- check PI_STATIC_AND_HIDDEN for --enable-static-pie
- change string buffer sizes in the tunables
- fix env_alias == NULL logic in __tunables_init
- move __ehdr_start processing after self relocation


force pushed into nsz/bug27072 branch.

Tested on aarch64, i686 and x86_64 with and without the last
patch (some of the make check is still running though).

Issues that are not addressed:
- tunables try to allocate memory even with non-suid exe.
  allocation is only needed for rewriting the GLIBC_TUNABLES
  env var. (i think a case can be made that if anything there
  is TUNABLE_SECLEVEL_SXID_ERASE then this env var would be
  simply dropped, that would simplify this significantly).
- __sbrk only needs the hidden visibility magic because of
  tunables, ideally we would not do allocations before self
  relocation.
- tunable list data structure is not optimized for compactness.

Szabolcs Nagy (7):
  elf: Make the tunable struct definition internal only
  elf: Avoid RELATIVE relocs in __tunables_init
  configure: Check for static PIE support
  csu: Avoid weak ref for __ehdr_start in static PIE
  Use hidden visibility for early static PIE code
  csu: Move static pie self relocation later [BZ #27072]
  Make libc symbols hidden in static PIE

 config.h.in                                  |  3 ++
 configure                                    | 13 ++++++
 configure.ac                                 |  4 ++
 csu/libc-start.c                             | 15 ++++++-
 elf/dl-reloc-static-pie.c                    |  2 +
 elf/dl-support.c                             |  6 +++
 elf/dl-tunable-types.h                       | 42 +++++++++++++++-----
 elf/dl-tunables.c                            |  6 ++-
 elf/dl-tunables.h                            | 35 ++++------------
 elf/enbl-secure.c                            |  4 ++
 include/libc-symbols.h                       |  9 ++++-
 misc/sbrk.c                                  |  4 ++
 scripts/gen-tunables.awk                     | 16 +++++++-
 sysdeps/aarch64/configure                    |  4 ++
 sysdeps/aarch64/configure.ac                 |  3 ++
 sysdeps/i386/configure                       |  3 ++
 sysdeps/i386/configure.ac                    |  3 ++
 sysdeps/unix/sysv/linux/aarch64/libc-start.c |  5 +++
 sysdeps/x86/libc-start.c                     |  5 +++
 sysdeps/x86_64/configure                     |  3 ++
 sysdeps/x86_64/configure.ac                  |  3 ++
 21 files changed, 144 insertions(+), 44 deletions(-)

-- 
2.17.1


             reply	other threads:[~2021-01-20 15:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 15:29 Szabolcs Nagy via Libc-alpha [this message]
2021-01-20 15:30 ` [PATCH v5 1/7] elf: Make the tunable struct definition internal only Szabolcs Nagy via Libc-alpha
2021-01-20 15:30 ` [PATCH v5 2/7] elf: Avoid RELATIVE relocs in __tunables_init Szabolcs Nagy via Libc-alpha
2021-01-20 15:30 ` [PATCH v5 3/7] configure: Check for static PIE support Szabolcs Nagy via Libc-alpha
2021-01-21 13:59   ` Adhemerval Zanella via Libc-alpha
2021-01-20 15:31 ` [PATCH v5 4/7] csu: Avoid weak ref for __ehdr_start in static PIE Szabolcs Nagy via Libc-alpha
2021-01-20 15:36   ` H.J. Lu via Libc-alpha
2021-01-21 14:01   ` Adhemerval Zanella via Libc-alpha
2021-01-20 15:31 ` [PATCH v5 5/7] Use hidden visibility for early static PIE code Szabolcs Nagy via Libc-alpha
2021-01-21 14:04   ` Adhemerval Zanella via Libc-alpha
2021-01-20 15:31 ` [PATCH v5 6/7] csu: Move static pie self relocation later [BZ #27072] Szabolcs Nagy via Libc-alpha
2021-01-21 14:07   ` Adhemerval Zanella via Libc-alpha
2021-01-21 15:38     ` Szabolcs Nagy via Libc-alpha
2021-01-20 15:31 ` [PATCH v5 7/7] Make libc symbols hidden in static PIE Szabolcs Nagy via Libc-alpha
2021-01-21 14:10   ` Adhemerval Zanella via Libc-alpha
2021-01-21 15:44     ` Szabolcs Nagy via Libc-alpha
2021-01-22  1:25   ` Tulio Magno Quites Machado Filho via Libc-alpha
2021-01-22  9:41     ` Szabolcs Nagy via Libc-alpha
2021-01-27  9:44   ` Andreas Schwab

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=cover.1611155254.git.szabolcs.nagy@arm.com \
    --to=libc-alpha@sourceware.org \
    --cc=szabolcs.nagy@arm.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).