Revert "Backport: debug: Add regression tests for BZ 30932" (RHEL-46761)

This reverts RHEL-46761-5.patch applied in commit 835c6731c5.  The
revert is done via RHEL-46761-6.patch.

Reason for revert: Fix corresponding to regression test needs additional
fixes upstream before it is backported here.

Related: RHEL-46761
This commit is contained in:
Arjun Shankar 2025-02-11 12:52:29 +01:00
parent d45151a852
commit 1ed4da461e
2 changed files with 116 additions and 1 deletions

111
glibc-RHEL-46761-6.patch Normal file
View File

@ -0,0 +1,111 @@
This reverts glibc-RHEL-46761-5.patch, thus dropping the associated test
case.
diff --git a/debug/Makefile b/debug/Makefile
index cb93ed80da57f2cc..563e6249121e8bc9 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -110,7 +110,6 @@ CPPFLAGS-tst-longjmp_chk2.c += -D_FORTIFY_SOURCE=1
CFLAGS-tst-longjmp_chk3.c += -fexceptions -fasynchronous-unwind-tables
CPPFLAGS-tst-longjmp_chk3.c += -D_FORTIFY_SOURCE=1
CPPFLAGS-tst-realpath-chk.c += -D_FORTIFY_SOURCE=2
-CFLAGS-tst-sprintf-fortify-rdonly.c += -D_FORTIFY_SOURCE=2
# _FORTIFY_SOURCE tests.
# Auto-generate tests for _FORTIFY_SOURCE for different levels, compilers and
@@ -204,7 +203,6 @@ tests = backtrace-tst \
tst-backtrace5 \
tst-backtrace6 \
tst-realpath-chk \
- tst-sprintf-fortify-rdonly \
tst-sprintf-fortify-unchecked \
$(tests-all-chk) \
diff --git a/debug/tst-sprintf-fortify-rdonly.c b/debug/tst-sprintf-fortify-rdonly.c
deleted file mode 100644
index 78dece9102d7dfd3..0000000000000000
--- a/debug/tst-sprintf-fortify-rdonly.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Testcase for BZ 30932.
- Copyright (C) 2023 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <setjmp.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/resource.h>
-#include <unistd.h>
-
-#include <support/check.h>
-#include <support/support.h>
-#include <support/temp_file.h>
-
-jmp_buf chk_fail_buf;
-bool chk_fail_ok;
-
-const char *str2 = "F";
-char buf2[10] = "%s";
-
-static int
-do_test (void)
-{
- struct rlimit rl;
- int max_fd = 24;
-
- if (getrlimit (RLIMIT_NOFILE, &rl) == -1)
- FAIL_EXIT1 ("getrlimit (RLIMIT_NOFILE): %m");
-
- max_fd = (rl.rlim_cur < max_fd ? rl.rlim_cur : max_fd);
- rl.rlim_cur = max_fd;
-
- if (setrlimit (RLIMIT_NOFILE, &rl) == 1)
- FAIL_EXIT1 ("setrlimit (RLIMIT_NOFILE): %m");
-
- /* Exhaust the file descriptor limit with temporary files. */
- int nfiles = 0;
- for (; nfiles < max_fd; nfiles++)
- {
- int fd = create_temp_file ("tst-sprintf-fortify-rdonly-.", NULL);
- if (fd == -1)
- {
- if (errno != EMFILE)
- FAIL_EXIT1 ("create_temp_file: %m");
- break;
- }
- }
- TEST_VERIFY_EXIT (nfiles != 0);
-
- /* When the format string is writable and contains %n,
- with -D_FORTIFY_SOURCE=2 it causes __chk_fail. However, if libc can not
- open procfs to check if the input format string in within a writable
- memory segment, the fortify version can not perform the check. */
- char buf[128];
- int n1;
- int n2;
-
- strcpy (buf2 + 2, "%n%s%n");
- if (sprintf (buf, buf2, str2, &n1, str2, &n2) != 2
- || n1 != 1 || n2 != 2)
- FAIL_EXIT1 ("sprintf failed: %s %d %d", buf, n1, n2);
-
- return 0;
-}
-
-#include <support/test-driver.c>

View File

@ -157,7 +157,7 @@ end \
Summary: The GNU libc libraries Summary: The GNU libc libraries
Name: glibc Name: glibc
Version: %{glibcversion} Version: %{glibcversion}
Release: 165%{?dist} Release: 166%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for # In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries. # libraries.
@ -1109,6 +1109,7 @@ Patch801: glibc-RHEL-2419-8.patch
Patch802: glibc-RHEL-2419-9.patch Patch802: glibc-RHEL-2419-9.patch
Patch803: glibc-RHEL-2419-10.patch Patch803: glibc-RHEL-2419-10.patch
Patch804: glibc-RHEL-46738-5.patch Patch804: glibc-RHEL-46738-5.patch
Patch805: glibc-RHEL-46761-6.patch
############################################################################## ##############################################################################
# Continued list of core "glibc" package information: # Continued list of core "glibc" package information:
@ -3102,6 +3103,9 @@ update_gconv_modules_cache ()
%endif %endif
%changelog %changelog
* Tue Feb 11 2025 Arjun Shankar <arjun@redhat.com> - 2.34-166
- Revert: Backport: debug: Add regression tests for BZ 30932 (RHEL-46761)
* Mon Feb 10 2025 Florian Weimer <fweimer@redhat.com> - 2.34-165 * Mon Feb 10 2025 Florian Weimer <fweimer@redhat.com> - 2.34-165
- Hide internal struct _IO_FILE ABI change in installed header (RHEL-46738) - Hide internal struct _IO_FILE ABI change in installed header (RHEL-46738)