From 4733eb662762742bcf6858ef3211420bd6dbb475 Mon Sep 17 00:00:00 2001 From: Xie jiamei Date: Fri, 20 Jun 2025 15:15:38 +0800 Subject: [PATCH] x86: Avoid non_temporal_threshold calculation to HYGON CPUs Multiplying non_temporal_threshold by thread count can result in an excessively high non_temporal_threshold, causing the non-temporal path to be skipped. This logic was introduced to address issues specific to Intel platforms and is not present in the upstream master branch. To avoid regressions on Hygon CPUs, limit this behavior. Signed-off-by: Xie jiamei --- glibc.spec | 6 +++- ...mporal_threshold-calculation-to-Inte.patch | 30 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 x86-Limit-non_temporal_threshold-calculation-to-Inte.patch diff --git a/glibc.spec b/glibc.spec index ab27942..52d85cd 100644 --- a/glibc.spec +++ b/glibc.spec @@ -71,7 +71,7 @@ ############################################################################## Name: glibc Version: 2.34 -Release: 167 +Release: 168 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -377,6 +377,7 @@ Patch9051: elf-the-hugepage-feature-of-dynamic-library-keep-com.patch Patch9052: elf-add-some-debug-info-for-dynamic-library-hugepage.patch Patch9053: Use-THP-for-dynamic-shared-library.patch Patch9054: try-to-enable-system-thp-ability-when-LD_HUGEPAGE_LI.patch +Patch9055: x86-Limit-non_temporal_threshold-calculation-to-Inte.patch Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) @@ -1552,6 +1553,9 @@ fi %endif %changelog +* Fri June 20 2025 Xie jiamei - 2.34-168 +- x86: Limit non_temporal_threshold calculation to Intel CPUs + * Wed May 21 2025 shixuantong - 2.34-167 - Type:CVE - CVE:CVE-2025-4802 diff --git a/x86-Limit-non_temporal_threshold-calculation-to-Inte.patch b/x86-Limit-non_temporal_threshold-calculation-to-Inte.patch new file mode 100644 index 0000000..61750fb --- /dev/null +++ b/x86-Limit-non_temporal_threshold-calculation-to-Inte.patch @@ -0,0 +1,30 @@ +From 780c5ec622047492def40a38f73cd2d1c72b20ec Mon Sep 17 00:00:00 2001 +From: Xie jiamei +Date: Fri, 20 Jun 2025 15:03:06 +0800 +Subject: [PATCH] x86: Limit non_temporal_threshold calculation to Intel CPUs + +Multiplying non_temporal_threshold by thread count can result in an excessively +high non_temporal_threshold, causing the non-temporal path to be skipped. +This change reverts that logic, which is not present in the upstream master. + +Signed-off-by: Xie jiamei +--- + sysdeps/x86/dl-cacheinfo.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h +index 1cf8c9310b..023d3ea6d4 100644 +--- a/sysdeps/x86/dl-cacheinfo.h ++++ b/sysdeps/x86/dl-cacheinfo.h +@@ -925,7 +925,7 @@ dl_init_cacheinfo (struct cpu_features *cpu_features) + shared = tunable_size; + + /* keep x86 to use the same non_temporal_threshold like glibc2.28 */ +- if (threads != 0) ++ if (threads != 0 && cpu_features->basic.kind == arch_kind_amd) + non_temporal_threshold *= threads; + + tunable_size = TUNABLE_GET (x86_non_temporal_threshold, long int, NULL); +-- +2.17.1 + -- Gitee