diff --git a/glibc-RHEL-101754-1.patch b/glibc-RHEL-101754-1.patch new file mode 100644 index 0000000..36e48d9 --- /dev/null +++ b/glibc-RHEL-101754-1.patch @@ -0,0 +1,96 @@ +Downstream-only patch to restore the original layout of +struct cpu_features, removing the memset_non_temporal_threshold +member that was added in glibc-upstream-2.39-174.patch, replacing +it with __rtld_global_ro_memset_non_temporal_threshold@GLIBC_PRIVATE. + +diff --git a/sysdeps/x86/Versions b/sysdeps/x86/Versions +index 4b10c4b5d722ecd0..33dbd67b64c3ab5e 100644 +--- a/sysdeps/x86/Versions ++++ b/sysdeps/x86/Versions +@@ -1,6 +1,7 @@ + ld { + GLIBC_PRIVATE { + _dl_x86_get_cpu_features; ++ __rtld_global_ro_memset_non_temporal_threshold; + } + } + libc { +diff --git a/sysdeps/x86/cacheinfo.h b/sysdeps/x86/cacheinfo.h +index 83491607c761ccc6..c041094d083baa11 100644 +--- a/sysdeps/x86/cacheinfo.h ++++ b/sysdeps/x86/cacheinfo.h +@@ -81,7 +81,7 @@ init_cacheinfo (void) + = cpu_features->non_temporal_threshold; + + __x86_memset_non_temporal_threshold +- = cpu_features->memset_non_temporal_threshold; ++ = __rtld_global_ro_memset_non_temporal_threshold; + + __x86_rep_movsb_threshold = cpu_features->rep_movsb_threshold; + __x86_rep_stosb_threshold = cpu_features->rep_stosb_threshold; +diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c +index 47dc3b1510a68fc9..4dc2b60aab65ed8e 100644 +--- a/sysdeps/x86/cpu-features.c ++++ b/sysdeps/x86/cpu-features.c +@@ -86,6 +86,9 @@ extern void TUNABLE_CALLBACK (set_x86_shstk) (tunable_val_t *) + + unsigned long int _dl_x86_features_tlsdesc_state_size; + ++unsigned long int __rtld_global_ro_memset_non_temporal_threshold; ++rtld_hidden_def (__rtld_global_ro_memset_non_temporal_threshold) ++ + static void + update_active (struct cpu_features *cpu_features) + { +diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h +index 10ad18061a1b47af..ebfea0a32ce0cff6 100644 +--- a/sysdeps/x86/dl-cacheinfo.h ++++ b/sysdeps/x86/dl-cacheinfo.h +@@ -1060,7 +1060,8 @@ dl_init_cacheinfo (struct cpu_features *cpu_features) + cpu_features->data_cache_size = data; + cpu_features->shared_cache_size = shared; + cpu_features->non_temporal_threshold = non_temporal_threshold; +- cpu_features->memset_non_temporal_threshold = memset_non_temporal_threshold; ++ __rtld_global_ro_memset_non_temporal_threshold ++ = memset_non_temporal_threshold; + cpu_features->rep_movsb_threshold = rep_movsb_threshold; + cpu_features->rep_stosb_threshold = rep_stosb_threshold; + cpu_features->rep_movsb_stop_threshold = rep_movsb_stop_threshold; +diff --git a/sysdeps/x86/dl-diagnostics-cpu.c b/sysdeps/x86/dl-diagnostics-cpu.c +index 8113a93883cfe7a2..9a3e0ec8b9214a9c 100644 +--- a/sysdeps/x86/dl-diagnostics-cpu.c ++++ b/sysdeps/x86/dl-diagnostics-cpu.c +@@ -86,7 +86,7 @@ _dl_diagnostics_cpu (void) + print_cpu_features_value ("non_temporal_threshold", + cpu_features->non_temporal_threshold); + print_cpu_features_value ("memset_non_temporal_threshold", +- cpu_features->memset_non_temporal_threshold); ++ __rtld_global_ro_memset_non_temporal_threshold); + print_cpu_features_value ("rep_movsb_threshold", + cpu_features->rep_movsb_threshold); + print_cpu_features_value ("rep_movsb_stop_threshold", +diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h +index 03c71387dd08982b..e1290ca2d4c9c39f 100644 +--- a/sysdeps/x86/include/cpu-features.h ++++ b/sysdeps/x86/include/cpu-features.h +@@ -944,8 +944,6 @@ struct cpu_features + unsigned long int shared_cache_size; + /* Threshold to use non temporal store in memmove. */ + unsigned long int non_temporal_threshold; +- /* Threshold to use non temporal store in memset. */ +- unsigned long int memset_non_temporal_threshold; + /* Threshold to use "rep movsb". */ + unsigned long int rep_movsb_threshold; + /* Threshold to stop using "rep movsb". */ +@@ -992,6 +990,11 @@ extern const struct cpu_features *_dl_x86_get_cpu_features (void) + xsave_state_size from struct cpu_features, this includes additional + registers. */ + extern unsigned long int _dl_x86_features_tlsdesc_state_size attribute_hidden; ++ ++/* Threshold to use non temporal store in memset. Moved out struct ++ cpu_features to preserve _rtld_global_ro layout. */ ++extern unsigned long int __rtld_global_ro_memset_non_temporal_threshold; ++rtld_hidden_proto (__rtld_global_ro_memset_non_temporal_threshold) + #endif + + #if defined (_LIBC) && !IS_IN (nonlib) diff --git a/glibc-RHEL-101754-2.patch b/glibc-RHEL-101754-2.patch new file mode 100644 index 0000000..742d153 --- /dev/null +++ b/glibc-RHEL-101754-2.patch @@ -0,0 +1,369 @@ +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 + + +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 diff --git a/glibc.spec b/glibc.spec index 044c8aa..13b7486 100644 --- a/glibc.spec +++ b/glibc.spec @@ -145,7 +145,7 @@ Version: %{glibcversion} # - It allows using the Release number without the %%dist tag in the dependency # generator to make the generated requires interchangeable between Rawhide # and ELN (.elnYY < .fcXX). -%global baserelease 41 +%global baserelease 42 Release: %{baserelease}%{?dist}.alma.1 # Licenses: @@ -574,6 +574,8 @@ Patch256: glibc-upstream-2.39-209.patch Patch257: glibc-upstream-2.39-210.patch Patch258: glibc-upstream-2.39-211.patch Patch259: glibc-RHEL-82285.patch +Patch260: glibc-RHEL-101754-1.patch +Patch261: glibc-RHEL-101754-2.patch ############################################################################## # Continued list of core "glibc" package information: @@ -2577,10 +2579,13 @@ update_gconv_modules_cache () %endif %changelog -* Wed Jul 02 2025 Eduard Abdullin - 2.39-41.alma.1 +* Sat Jul 05 2025 Eduard Abdullin - 2.39-42.alma.1 - Overwrite target for x86_64_v2 - Add /usr/lib64/lp64d to ricv64 +* Thu Jul 03 2025 Florian Weimer - 2.39-42 +- Restore _rtld_global_layout on x86-64, freeze tunables order (RHEL-101754) + * Tue Jul 01 2025 Florian Weimer - 2.39-41 - Downstream ABI adjustment for pthread_cond_t (RHEL-82285)