[PATCH 2/3] [RFC] elf: hack up tunables to avoid RELATIVE relocs
Szabolcs Nagy
szabolcs.nagy@arm.com
Thu Jan 7 11:01:30 GMT 2021
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
More information about the Libc-alpha
mailing list