Backport: debug/tst-longjmp_chk3 needs to be enabled

Resolves: RHEL-68850
This commit is contained in:
Frédéric Bérat 2025-01-08 17:27:31 +01:00
parent 13a2c1bb05
commit 323df51371
3 changed files with 99 additions and 0 deletions

76
glibc-RHEL-68850-1.patch Normal file
View File

@ -0,0 +1,76 @@
commit 4b7cfcc3fbfab55a1bbb32a2da69c048060739d6
Author: Florian Weimer <fweimer@redhat.com>
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 <adhemerval.zanella@linaro.org>
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 <setjmp.h>
#include <signal.h>
+#include <stdio.h>
#include <string.h>
-static char buf[SIGSTKSZ * 4];
+#include <support/support.h>
+
+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");

20
glibc-RHEL-68850-2.patch Normal file
View File

@ -0,0 +1,20 @@
commit 4836a9af89f1b4d482e6c72ff67e36226d36434c
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Nov 26 19:26:13 2024 +0100
debug: Fix tst-longjmp_chk3 build failure on Hurd
Explicitly include <unistd.h> 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 <signal.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <support/support.h>

View File

@ -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 <dj@redhat.com> - 2.34-148
- Increase ungetc test coverage, guarantee single char pushback (RHEL-46738)