[COMMITTED] tests: elf: Fix flaky thp tests

Yury Khrustalev yury.khrustalev@arm.com
Mon Nov 2 10:47:23 GMT 2026


Several tests rely on a madvise syscall to appear in strace output
(or not appear in case of 'disable' tests). This syscall may occur
in malloc. To avoid this from happening, we use malloc tunable to
disable hugetlb for these tests.

Suggested-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 9c86ea03aa6879ec79972147b21d3f52cb921cdb)
---
Back port of test fix. Tested on aarch64-linux-gnu, armhf-linux-gnu,
i686-linux-gnu, x86_64-linux-gnu and no regressions have been found.
---
 sysdeps/unix/sysv/linux/Makefile | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 005847db7a..9a343695e5 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -845,7 +845,7 @@ $(objpfx)strace-tst-thp-1-enabled.out: \
   $(objpfx)tst-thp-1
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
 		'$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-1 > $@; \
 	  $(evaluate-test)
 
@@ -854,7 +854,7 @@ $(objpfx)strace-tst-thp-1-disabled.out: \
   $(objpfx)tst-thp-1
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
 		'$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-1 > $@; \
 	  $(evaluate-test)
 
@@ -863,7 +863,7 @@ $(objpfx)strace-tst-thp-1-pde-enabled.out: \
   $(objpfx)tst-thp-1-pde
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
 		'$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-1-pde > $@; \
 	  $(evaluate-test)
 
@@ -872,7 +872,7 @@ $(objpfx)strace-tst-thp-1-pde-disabled.out: \
   $(objpfx)tst-thp-1-pde
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
 		'$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-1-pde > $@; \
 	  $(evaluate-test)
 
@@ -880,7 +880,7 @@ $(objpfx)strace-tst-thp-1-static-enabled.out: \
   $(..)sysdeps/unix/sysv/linux/strace-tst-thp.sh \
   $(objpfx)tst-thp-1-static
 	$(SHELL) $< '' '$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-1-static > $@; \
 	  $(evaluate-test)
 
@@ -888,7 +888,7 @@ $(objpfx)strace-tst-thp-1-static-disabled.out: \
   $(..)sysdeps/unix/sysv/linux/strace-tst-thp.sh \
   $(objpfx)tst-thp-1-static
 	$(SHELL) $< '' '$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-1-static > $@; \
 	  $(evaluate-test)
 
@@ -896,7 +896,8 @@ $(objpfx)strace-tst-thp-align-default.out: \
   $(..)sysdeps/unix/sysv/linux/strace-tst-thp.sh $(objpfx)ld.so \
   $(objpfx)tst-thp-align $(objpfx)tst-thp-size-mod.so
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
-		'$(test-wrapper-env)' '$(run-program-env)' \
+		'$(test-wrapper-env)' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-align > $@; \
 	  $(evaluate-test)
 
@@ -905,7 +906,7 @@ $(objpfx)strace-tst-thp-align-enabled.out: \
   $(objpfx)tst-thp-align $(objpfx)tst-thp-size-mod.so
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
 		'$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-align > $@; \
 	  $(evaluate-test)
 
@@ -914,7 +915,7 @@ $(objpfx)strace-tst-thp-align-disabled.out: \
   $(objpfx)tst-thp-align $(objpfx)tst-thp-size-mod.so
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
 		'$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-align > $@; \
 	  $(evaluate-test)
 endif # [madvise]
-- 
2.47.3



More information about the Libc-stable mailing list