glibc/glibc-RHEL-101754-2.patch

370 lines
12 KiB
Diff

Maintain an explicit order of tunables, so that the tunable_list
array and the tunable_id_t constant can remain consistent over time.
Related to this upstream bug:
Internal tunables ABI depends on awk array iteration order
<https://sourceware.org/bugzilla/show_bug.cgi?id=30027>
The new dl-tunables.list files are already on the sysdeps search
path, which is why the existing Makeconfig rule picks them up.
Baseline for the tunables order is glibc-2.39-37.el10, with
glibc.cpu.x86_memset_non_temporal_threshold added at the end.
The i386 list is needed for the glibc32 build.
Going forward, new tunables will have to be added manually to the end
of those files. Existing tunables should not be deleted. For
deletion, the script would have to be extended to be able to create
gaps in the tunable_list array.
diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk
index 9f5336381e9b3476..3cc77b9af70ef85d 100644
--- a/scripts/gen-tunables.awk
+++ b/scripts/gen-tunables.awk
@@ -14,6 +14,7 @@ BEGIN {
top_ns=""
max_name_len=0
max_alias_len=0
+ tunable_order_count = 0
}
# Skip over blank lines and comments.
@@ -80,6 +81,37 @@ $1 == "}" {
next
}
+$1 == "@order" {
+ if (top_ns != "") {
+ printf("%s:%d: error: invalid @order directive inside namespace %s\n",
+ FILENAME, FNR, top_ns) > "/dev/stderr"
+ exit 1
+ }
+ if (NF != 2) {
+ printf("%s:%d: error: invalid argument count in @order directive\n",
+ FILENAME, FNR) > "/dev/stderr"
+ exit 1
+ }
+ order_arg = $2
+ if (split(order_arg, indices, /\./) != 3) {
+ printf("%s:%d: error: invalid tunable syntax in @order directive\n",
+ FILENAME, FNR) > "/dev/stderr"
+ exit 1
+ }
+ t = indices[1]
+ n = indices[2]
+ m = indices[3]
+ if ((t, n, m) in tunable_order) {
+ printf("%s:%d: error: duplicate\"@order %s\"\n" \
+ FILENAME, FNR, order_arg) > "/dev/stderr"
+ exit 1
+ }
+ ++tunable_order_count
+ tunable_order[t,n,m] = tunable_order_count
+ tunable_order_list[tunable_order_count] = t SUBSEP n SUBSEP m
+ next
+}
+
# Everything else, which could either be a tunable without any attributes or a
# tunable attribute.
{
@@ -131,6 +163,31 @@ END {
exit 1
}
+ missing_order = 0
+ for (tnm in types) {
+ if (!(tnm in tunable_order)) {
+ if (!missing_order) {
+ print "error: Missing @order directives:" > "/dev/stderr"
+ missing_order = 1
+ }
+ split(tnm, indices, SUBSEP)
+ printf("@order %s.%s.%s\n", indices[1], indices[2], indices[3]) \
+ > "/dev/stderr"
+ }
+ }
+ for (i = 1; i <= tunable_order_count; ++i) {
+ tnm = tunable_order_list[i]
+ if (!(tnm in types)) {
+ split(tnm, indices, SUBSEP)
+ printf("error: tunable in \"@order %s.%s.%s\" not known\n", \
+ indices[1], indices[2], indices[3]) > "/dev/stderr"
+ missing_order = 1
+ }
+ }
+ if (missing_order) {
+ exit 1
+ }
+
print "/* AUTOGENERATED by gen-tunables.awk. */"
print "#ifndef _TUNABLES_H_"
print "# error \"Do not include this file directly.\""
@@ -141,7 +198,8 @@ END {
# Now, the enum names
print "\ntypedef enum"
print "{"
- for (tnm in types) {
+ for (i = 1; i <= tunable_order_count; ++i) {
+ tnm = tunable_order_list[i]
split (tnm, indices, SUBSEP);
t = indices[1];
n = indices[2];
@@ -157,7 +215,8 @@ END {
print "# include \"dl-tunable-types.h\""
# Finally, the tunable list.
print "static tunable_t tunable_list[] attribute_relro = {"
- for (tnm in types) {
+ for (i = 1; i <= tunable_order_count; ++i) {
+ tnm = tunable_order_list[i]
split (tnm, indices, SUBSEP);
t = indices[1];
n = indices[2];
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-tunables.list b/sysdeps/unix/sysv/linux/aarch64/dl-tunables.list
new file mode 100644
index 0000000000000000..6c0d66685ef76a26
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-tunables.list
@@ -0,0 +1,32 @@
+@order glibc.rtld.nns
+@order glibc.elision.skip_lock_after_retries
+@order glibc.malloc.trim_threshold
+@order glibc.malloc.perturb
+@order glibc.pthread.rseq
+@order glibc.cpu.name
+@order glibc.mem.tagging
+@order glibc.elision.tries
+@order glibc.elision.enable
+@order glibc.malloc.hugetlb
+@order glibc.malloc.mxfast
+@order glibc.rtld.dynamic_sort
+@order glibc.elision.skip_lock_busy
+@order glibc.malloc.top_pad
+@order glibc.pthread.stack_cache_size
+@order glibc.gmon.minarcs
+@order glibc.cpu.hwcap_mask
+@order glibc.malloc.mmap_max
+@order glibc.elision.skip_trylock_internal_abort
+@order glibc.malloc.tcache_unsorted_limit
+@order glibc.pthread.stack_hugetlb
+@order glibc.elision.skip_lock_internal_abort
+@order glibc.malloc.arena_max
+@order glibc.malloc.mmap_threshold
+@order glibc.malloc.tcache_count
+@order glibc.malloc.arena_test
+@order glibc.pthread.mutex_spin_count
+@order glibc.gmon.maxarcs
+@order glibc.mem.decorate_maps
+@order glibc.rtld.optional_static_tls
+@order glibc.malloc.tcache_max
+@order glibc.malloc.check
diff --git a/sysdeps/unix/sysv/linux/i386/dl-tunables.list b/sysdeps/unix/sysv/linux/i386/dl-tunables.list
new file mode 100644
index 0000000000000000..a41d09297ba61748
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/dl-tunables.list
@@ -0,0 +1,41 @@
+@order glibc.malloc.mxfast
+@order glibc.malloc.mmap_threshold
+@order glibc.malloc.tcache_max
+@order glibc.pthread.mutex_spin_count
+@order glibc.cpu.x86_rep_movsb_threshold
+@order glibc.malloc.tcache_unsorted_limit
+@order glibc.elision.tries
+@order glibc.cpu.x86_non_temporal_threshold
+@order glibc.cpu.x86_data_cache_size
+@order glibc.cpu.x86_shared_cache_size
+@order glibc.elision.skip_trylock_internal_abort
+@order glibc.rtld.dynamic_sort
+@order glibc.malloc.mmap_max
+@order glibc.malloc.trim_threshold
+@order glibc.elision.skip_lock_after_retries
+@order glibc.cpu.plt_rewrite
+@order glibc.rtld.optional_static_tls
+@order glibc.mem.decorate_maps
+@order glibc.cpu.hwcap_mask
+@order glibc.cpu.x86_ibt
+@order glibc.pthread.stack_cache_size
+@order glibc.rtld.nns
+@order glibc.malloc.arena_test
+@order glibc.malloc.hugetlb
+@order glibc.cpu.x86_rep_stosb_threshold
+@order glibc.malloc.perturb
+@order glibc.malloc.tcache_count
+@order glibc.elision.enable
+@order glibc.cpu.x86_shstk
+@order glibc.gmon.maxarcs
+@order glibc.malloc.check
+@order glibc.gmon.minarcs
+@order glibc.malloc.top_pad
+@order glibc.pthread.stack_hugetlb
+@order glibc.mem.tagging
+@order glibc.cpu.hwcaps
+@order glibc.elision.skip_lock_internal_abort
+@order glibc.malloc.arena_max
+@order glibc.elision.skip_lock_busy
+@order glibc.pthread.rseq
+@order glibc.cpu.x86_memset_non_temporal_threshold
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/dl-tunables.list b/sysdeps/unix/sysv/linux/powerpc/powerpc64/dl-tunables.list
new file mode 100644
index 0000000000000000..cbc5300bd0b99781
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/dl-tunables.list
@@ -0,0 +1,33 @@
+@order glibc.rtld.nns
+@order glibc.elision.skip_lock_after_retries
+@order glibc.malloc.trim_threshold
+@order glibc.malloc.perturb
+@order glibc.pthread.rseq
+@order glibc.mem.tagging
+@order glibc.elision.tries
+@order glibc.elision.enable
+@order glibc.malloc.hugetlb
+@order glibc.malloc.mxfast
+@order glibc.rtld.dynamic_sort
+@order glibc.elision.skip_lock_busy
+@order glibc.malloc.top_pad
+@order glibc.pthread.stack_cache_size
+@order glibc.gmon.minarcs
+@order glibc.cpu.hwcap_mask
+@order glibc.malloc.mmap_max
+@order glibc.elision.skip_trylock_internal_abort
+@order glibc.malloc.tcache_unsorted_limit
+@order glibc.cpu.hwcaps
+@order glibc.pthread.stack_hugetlb
+@order glibc.elision.skip_lock_internal_abort
+@order glibc.malloc.arena_max
+@order glibc.malloc.mmap_threshold
+@order glibc.cpu.cached_memopt
+@order glibc.malloc.tcache_count
+@order glibc.malloc.arena_test
+@order glibc.pthread.mutex_spin_count
+@order glibc.gmon.maxarcs
+@order glibc.mem.decorate_maps
+@order glibc.rtld.optional_static_tls
+@order glibc.malloc.tcache_max
+@order glibc.malloc.check
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/dl-tunables.list b/sysdeps/unix/sysv/linux/riscv/rv64/dl-tunables.list
new file mode 100644
index 0000000000000000..a8d32f0a9ac2d968
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/dl-tunables.list
@@ -0,0 +1,31 @@
+@order glibc.rtld.nns
+@order glibc.elision.skip_lock_after_retries
+@order glibc.malloc.trim_threshold
+@order glibc.malloc.perturb
+@order glibc.pthread.rseq
+@order glibc.mem.tagging
+@order glibc.elision.tries
+@order glibc.elision.enable
+@order glibc.malloc.hugetlb
+@order glibc.malloc.mxfast
+@order glibc.rtld.dynamic_sort
+@order glibc.elision.skip_lock_busy
+@order glibc.malloc.top_pad
+@order glibc.pthread.stack_cache_size
+@order glibc.gmon.minarcs
+@order glibc.cpu.hwcap_mask
+@order glibc.malloc.mmap_max
+@order glibc.elision.skip_trylock_internal_abort
+@order glibc.malloc.tcache_unsorted_limit
+@order glibc.pthread.stack_hugetlb
+@order glibc.elision.skip_lock_internal_abort
+@order glibc.malloc.arena_max
+@order glibc.malloc.mmap_threshold
+@order glibc.malloc.tcache_count
+@order glibc.malloc.arena_test
+@order glibc.pthread.mutex_spin_count
+@order glibc.gmon.maxarcs
+@order glibc.mem.decorate_maps
+@order glibc.rtld.optional_static_tls
+@order glibc.malloc.tcache_max
+@order glibc.malloc.check
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/dl-tunables.list b/sysdeps/unix/sysv/linux/s390/s390-64/dl-tunables.list
new file mode 100644
index 0000000000000000..0325052deed5476a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/dl-tunables.list
@@ -0,0 +1,32 @@
+@order glibc.rtld.nns
+@order glibc.elision.skip_lock_after_retries
+@order glibc.malloc.trim_threshold
+@order glibc.malloc.perturb
+@order glibc.pthread.rseq
+@order glibc.mem.tagging
+@order glibc.elision.tries
+@order glibc.elision.enable
+@order glibc.malloc.hugetlb
+@order glibc.malloc.mxfast
+@order glibc.rtld.dynamic_sort
+@order glibc.elision.skip_lock_busy
+@order glibc.malloc.top_pad
+@order glibc.pthread.stack_cache_size
+@order glibc.gmon.minarcs
+@order glibc.cpu.hwcap_mask
+@order glibc.malloc.mmap_max
+@order glibc.elision.skip_trylock_internal_abort
+@order glibc.malloc.tcache_unsorted_limit
+@order glibc.cpu.hwcaps
+@order glibc.pthread.stack_hugetlb
+@order glibc.elision.skip_lock_internal_abort
+@order glibc.malloc.arena_max
+@order glibc.malloc.mmap_threshold
+@order glibc.malloc.tcache_count
+@order glibc.malloc.arena_test
+@order glibc.pthread.mutex_spin_count
+@order glibc.gmon.maxarcs
+@order glibc.mem.decorate_maps
+@order glibc.rtld.optional_static_tls
+@order glibc.malloc.tcache_max
+@order glibc.malloc.check
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/dl-tunables.list b/sysdeps/unix/sysv/linux/x86_64/64/dl-tunables.list
new file mode 100644
index 0000000000000000..eb65aa06f6abf904
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/64/dl-tunables.list
@@ -0,0 +1,42 @@
+@order glibc.malloc.mxfast
+@order glibc.malloc.mmap_threshold
+@order glibc.malloc.tcache_max
+@order glibc.pthread.mutex_spin_count
+@order glibc.cpu.x86_rep_movsb_threshold
+@order glibc.malloc.tcache_unsorted_limit
+@order glibc.elision.tries
+@order glibc.cpu.x86_non_temporal_threshold
+@order glibc.cpu.x86_data_cache_size
+@order glibc.cpu.x86_shared_cache_size
+@order glibc.elision.skip_trylock_internal_abort
+@order glibc.rtld.dynamic_sort
+@order glibc.malloc.mmap_max
+@order glibc.cpu.prefer_map_32bit_exec
+@order glibc.malloc.trim_threshold
+@order glibc.elision.skip_lock_after_retries
+@order glibc.cpu.plt_rewrite
+@order glibc.rtld.optional_static_tls
+@order glibc.mem.decorate_maps
+@order glibc.cpu.hwcap_mask
+@order glibc.cpu.x86_ibt
+@order glibc.pthread.stack_cache_size
+@order glibc.rtld.nns
+@order glibc.malloc.arena_test
+@order glibc.malloc.hugetlb
+@order glibc.cpu.x86_rep_stosb_threshold
+@order glibc.malloc.perturb
+@order glibc.malloc.tcache_count
+@order glibc.elision.enable
+@order glibc.cpu.x86_shstk
+@order glibc.gmon.maxarcs
+@order glibc.malloc.check
+@order glibc.gmon.minarcs
+@order glibc.malloc.top_pad
+@order glibc.pthread.stack_hugetlb
+@order glibc.mem.tagging
+@order glibc.cpu.hwcaps
+@order glibc.elision.skip_lock_internal_abort
+@order glibc.malloc.arena_max
+@order glibc.elision.skip_lock_busy
+@order glibc.pthread.rseq
+@order glibc.cpu.x86_memset_non_temporal_threshold