From 323df513716564ca6d656700f5b783bfc53a4638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rat?= Date: Wed, 8 Jan 2025 17:27:31 +0100 Subject: [PATCH] Backport: debug/tst-longjmp_chk3 needs to be enabled Resolves: RHEL-68850 --- glibc-RHEL-68850-1.patch | 76 ++++++++++++++++++++++++++++++++++++++++ glibc-RHEL-68850-2.patch | 20 +++++++++++ glibc.spec | 3 ++ 3 files changed, 99 insertions(+) create mode 100644 glibc-RHEL-68850-1.patch create mode 100644 glibc-RHEL-68850-2.patch diff --git a/glibc-RHEL-68850-1.patch b/glibc-RHEL-68850-1.patch new file mode 100644 index 0000000..adcdece --- /dev/null +++ b/glibc-RHEL-68850-1.patch @@ -0,0 +1,76 @@ +commit 4b7cfcc3fbfab55a1bbb32a2da69c048060739d6 +Author: Florian Weimer +Date: Mon Nov 25 17:32:54 2024 +0100 + + debug: Wire up tst-longjmp_chk3 + + The test was added in commit ac8cc9e300a002228eb7e660df3e7b333d9a7414 + without all the required Makefile scaffolding. Tweak the test + so that it actually builds (including with dynamic SIGSTKSZ). + + Reviewed-by: Adhemerval Zanella + +Conflicts: + debug/Makefile (fixup context) + +diff --git a/debug/Makefile b/debug/Makefile +index 9fbc40dc69b477ca..ddae3817aef9afad 100644 +--- a/debug/Makefile ++++ b/debug/Makefile +@@ -192,13 +192,14 @@ tests = backtrace-tst \ + test-strcpy_chk \ + test-stpcpy_chk \ + tst-longjmp_chk2 \ ++ tst-longjmp_chk3 \ + tst-backtrace2 \ + tst-backtrace3 \ + tst-backtrace4 \ + tst-backtrace5 \ + tst-backtrace6 \ + tst-realpath-chk \ +- $(tests-all-chk) ++ $(tests-all-chk) \ + + ifeq ($(have-ssp),yes) + tests += tst-ssp-1 +diff --git a/debug/tst-longjmp_chk3.c b/debug/tst-longjmp_chk3.c +index 4434937c597dbe10..dfdecca9ef8a1cf6 100644 +--- a/debug/tst-longjmp_chk3.c ++++ b/debug/tst-longjmp_chk3.c +@@ -18,9 +18,12 @@ + + #include + #include ++#include + #include + +-static char buf[SIGSTKSZ * 4]; ++#include ++ ++static char *buf; + static jmp_buf jb; + + static void +@@ -49,8 +52,10 @@ do_test (void) + set_fortify_handler (handler); + + /* Create a valid signal stack and enable it. */ ++ size_t bufsize = SIGSTKSZ * 4; ++ buf = xmalloc (bufsize); + ss.ss_sp = buf; +- ss.ss_size = sizeof (buf); ++ ss.ss_size = bufsize; + ss.ss_flags = 0; + if (sigaltstack (&ss, NULL) < 0) + { +@@ -65,8 +70,8 @@ do_test (void) + + /* Shrink the signal stack so the jmpbuf is now invalid. + We adjust the start & end to handle stacks that grow up & down. */ +- ss.ss_sp = buf + sizeof (buf) / 2; +- ss.ss_size = sizeof (buf) / 4; ++ ss.ss_sp = buf + bufsize / 2; ++ ss.ss_size = bufsize / 4; + if (sigaltstack (&ss, NULL) < 0) + { + printf ("second sigaltstack failed: %m\n"); diff --git a/glibc-RHEL-68850-2.patch b/glibc-RHEL-68850-2.patch new file mode 100644 index 0000000..f6e4789 --- /dev/null +++ b/glibc-RHEL-68850-2.patch @@ -0,0 +1,20 @@ +commit 4836a9af89f1b4d482e6c72ff67e36226d36434c +Author: Florian Weimer +Date: Tue Nov 26 19:26:13 2024 +0100 + + debug: Fix tst-longjmp_chk3 build failure on Hurd + + Explicitly include for _exit and getpid. + +diff --git a/debug/tst-longjmp_chk3.c b/debug/tst-longjmp_chk3.c +index dfdecca9ef8a1cf6..254cd671902ca9a0 100644 +--- a/debug/tst-longjmp_chk3.c ++++ b/debug/tst-longjmp_chk3.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #include + diff --git a/glibc.spec b/glibc.spec index 6d58cbd..8985577 100644 --- a/glibc.spec +++ b/glibc.spec @@ -1048,6 +1048,8 @@ Patch740: glibc-RHEL-65910.patch Patch741: glibc-RHEL-69028.patch Patch742: glibc-RHEL-70395-1.patch Patch743: glibc-RHEL-70395-2.patch +Patch744: glibc-RHEL-68850-1.patch +Patch745: glibc-RHEL-68850-2.patch ############################################################################## # Continued list of core "glibc" package information: @@ -3057,6 +3059,7 @@ update_gconv_modules_cache () - Backport: testsuite fixes for rhel-57588, rhel-57589, and rhel-57590 (RHEL-65910) - Backport new multi-threaded test for sem_getvalue (RHEL-69028) - Backport pthread_getcpuclockid tests (RHEL-70395) +- Backport: Debug/tst-longjmp_chk3 needs to be enabled (RHEL-68850) * Thu Dec 19 2024 DJ Delorie - 2.34-148 - Increase ungetc test coverage, guarantee single char pushback (RHEL-46738)