public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: libc-alpha@sourceware.org
Subject: [PATCH 2/3] [RFC] elf: hack up tunables to avoid RELATIVE relocs
Date: Thu,  7 Jan 2021 11:01:30 +0000	[thread overview]
Message-ID: <a44d4bd92dfb2ee9a6fac64a6d6b726421c5e07d.1610016590.git.szabolcs.nagy@arm.com> (raw)
In-Reply-To: <cover.1610016590.git.szabolcs.nagy@arm.com>

With static pie linking pointers in the tunables list need
RELATIVE relocs since the absolute address is not known at
link time.

This is a hack to avoid relocs in tunables so the static pie
self relocation can be done later.

The longest tunable name is currently
  glibc.elision.skip_trylock_internal_abort
and the longest env var alias is
  MALLOC_MMAP_THRESHOLD_
There are likely ways to have a compact pointer-free tunable
list data structure with more gen-tunables.awk changes, but
before that i would like to get feedback if this approach
for bug 27072 is acceptable.
---
 elf/dl-tunables.h        | 4 ++--
 scripts/gen-tunables.awk | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/elf/dl-tunables.h b/elf/dl-tunables.h
index 518342a300..0196867676 100644
--- a/elf/dl-tunables.h
+++ b/elf/dl-tunables.h
@@ -38,7 +38,7 @@ __tunables_init (char **unused __attribute__ ((unused)))
 /* A tunable.  */
 struct _tunable
 {
-  const char *name;			/* Internal name of the tunable.  */
+  const char name[48];			/* Internal name of the tunable.  */
   tunable_type_t type;			/* Data type of the tunable.  */
   tunable_val_t val;			/* The value.  */
   bool initialized;			/* Flag to indicate that the tunable is
@@ -54,7 +54,7 @@ struct _tunable
 					   target module if the value is
 					   considered unsafe.  */
   /* Compatibility elements.  */
-  const char *env_alias;		/* The compatibility environment
+  const char env_alias[32];		/* The compatibility environment
 					   variable name.  */
 };
 
diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk
index 622199061a..9e7bd24e13 100644
--- a/scripts/gen-tunables.awk
+++ b/scripts/gen-tunables.awk
@@ -57,7 +57,7 @@ $1 == "}" {
       maxvals[top_ns,ns,tunable] = max_of[types[top_ns,ns,tunable]]
     }
     if (!env_alias[top_ns,ns,tunable]) {
-      env_alias[top_ns,ns,tunable] = "NULL"
+      env_alias[top_ns,ns,tunable] = "{0}"
     }
     if (!security_level[top_ns,ns,tunable]) {
       security_level[top_ns,ns,tunable] = "SXID_ERASE"
-- 
2.17.1


  parent reply	other threads:[~2021-01-07 11:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 11:00 [PATCH 0/3] fix ifunc with static pie [BZ #27072] Szabolcs Nagy
2021-01-07 11:01 ` [PATCH 1/3] Make libc symbols hidden in static PIE Szabolcs Nagy
2021-01-07 11:01 ` Szabolcs Nagy [this message]
2021-01-07 13:50   ` [PATCH 2/3] [RFC] elf: hack up tunables to avoid RELATIVE relocs Siddhesh Poyarekar
2021-01-07 11:01 ` [PATCH 3/3] csu: Move static pie self relocation later [BZ #27072] Szabolcs Nagy
2021-01-07 12:36   ` H.J. Lu
2021-01-07 12:46     ` Carlos O'Donell
2021-01-07 12:51       ` H.J. Lu
2021-01-07 13:02         ` Szabolcs Nagy
2021-01-07 14:25           ` Szabolcs Nagy
2021-01-07 14:48             ` Siddhesh Poyarekar
2021-01-07 15:25               ` Szabolcs Nagy
2021-01-07 17:48                 ` H.J. Lu
2021-01-07 21:03   ` H.J. Lu
2021-01-08 10:08     ` Szabolcs Nagy
2021-01-07 12:48 ` [PATCH 0/3] fix ifunc with static pie " H.J. Lu
2021-01-07 12:50   ` Carlos O'Donell
2021-01-07 12:55     ` H.J. Lu
2021-01-07 13:03       ` Szabolcs Nagy
2021-01-07 13:15         ` H.J. Lu
2021-01-07 13:28           ` Szabolcs Nagy

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=a44d4bd92dfb2ee9a6fac64a6d6b726421c5e07d.1610016590.git.szabolcs.nagy@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=libc-alpha@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).