glibc/SOURCES/glibc-rh2162962.patch

307 lines
10 KiB
Diff
Raw Normal View History

2023-05-09 05:36:28 +00:00
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.
The files for RHEL 9.1z were created by applying the gen-tunables.awk
part of this patch to RHEL 9.1.0 (glibc-2.34-40.el9_2.1, to be
precise). The sysdeps/unix/sysv/linux/**/dl-tunables.list files were
created based on the generated error message during the RHEL 9.1.z
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 fa63e86d1a51fe61..c5445e95f9fc36e7 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.
@@ -83,6 +84,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.
{
@@ -145,6 +177,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.\""
@@ -155,7 +212,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];
@@ -171,7 +229,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..d9d62499be4d67cb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-tunables.list
@@ -0,0 +1,28 @@
+# Order of tunables in RHEL 9.1.z.
+@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.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.cpu.hwcap_mask
+@order glibc.malloc.mmap_max
+@order glibc.elision.skip_trylock_internal_abort
+@order glibc.malloc.tcache_unsorted_limit
+@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.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..e83962ec3af11691
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/dl-tunables.list
@@ -0,0 +1,35 @@
+# Order of tunables in RHEL 9.1.z.
+@order glibc.rtld.nns
+@order glibc.elision.skip_lock_after_retries
+@order glibc.malloc.trim_threshold
+@order glibc.malloc.perturb
+@order glibc.cpu.x86_shared_cache_size
+@order glibc.pthread.rseq
+@order glibc.mem.tagging
+@order glibc.elision.tries
+@order glibc.elision.enable
+@order glibc.cpu.x86_rep_movsb_threshold
+@order glibc.malloc.mxfast
+@order glibc.rtld.dynamic_sort
+@order glibc.elision.skip_lock_busy
+@order glibc.malloc.top_pad
+@order glibc.cpu.x86_rep_stosb_threshold
+@order glibc.cpu.x86_non_temporal_threshold
+@order glibc.cpu.x86_shstk
+@order glibc.pthread.stack_cache_size
+@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.x86_ibt
+@order glibc.cpu.hwcaps
+@order glibc.elision.skip_lock_internal_abort
+@order glibc.malloc.arena_max
+@order glibc.malloc.mmap_threshold
+@order glibc.cpu.x86_data_cache_size
+@order glibc.malloc.tcache_count
+@order glibc.malloc.arena_test
+@order glibc.pthread.mutex_spin_count
+@order glibc.rtld.optional_static_tls
+@order glibc.malloc.tcache_max
+@order glibc.malloc.check
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/dl-tunables.list b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/dl-tunables.list
new file mode 100644
index 0000000000000000..8f01840ef57874e7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/dl-tunables.list
@@ -0,0 +1,28 @@
+# Order of tunables in RHEL 9.1.z.
+@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.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.cpu.hwcap_mask
+@order glibc.malloc.mmap_max
+@order glibc.elision.skip_trylock_internal_abort
+@order glibc.malloc.tcache_unsorted_limit
+@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.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..c3bc83f33910af22
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/dl-tunables.list
@@ -0,0 +1,27 @@
+# Order of tunables in RHEL 9.1.z.
+@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.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.cpu.hwcap_mask
+@order glibc.malloc.mmap_max
+@order glibc.elision.skip_trylock_internal_abort
+@order glibc.malloc.tcache_unsorted_limit
+@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.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..e83962ec3af11691
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/64/dl-tunables.list
@@ -0,0 +1,35 @@
+# Order of tunables in RHEL 9.1.z.
+@order glibc.rtld.nns
+@order glibc.elision.skip_lock_after_retries
+@order glibc.malloc.trim_threshold
+@order glibc.malloc.perturb
+@order glibc.cpu.x86_shared_cache_size
+@order glibc.pthread.rseq
+@order glibc.mem.tagging
+@order glibc.elision.tries
+@order glibc.elision.enable
+@order glibc.cpu.x86_rep_movsb_threshold
+@order glibc.malloc.mxfast
+@order glibc.rtld.dynamic_sort
+@order glibc.elision.skip_lock_busy
+@order glibc.malloc.top_pad
+@order glibc.cpu.x86_rep_stosb_threshold
+@order glibc.cpu.x86_non_temporal_threshold
+@order glibc.cpu.x86_shstk
+@order glibc.pthread.stack_cache_size
+@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.x86_ibt
+@order glibc.cpu.hwcaps
+@order glibc.elision.skip_lock_internal_abort
+@order glibc.malloc.arena_max
+@order glibc.malloc.mmap_threshold
+@order glibc.cpu.x86_data_cache_size
+@order glibc.malloc.tcache_count
+@order glibc.malloc.arena_test
+@order glibc.pthread.mutex_spin_count
+@order glibc.rtld.optional_static_tls
+@order glibc.malloc.tcache_max
+@order glibc.malloc.check