Sync with glibc-2.39-16.fc40 (RHEL-43307, RHEL-43456)
Fedora commit: ed89a91b42
Upstream commit: 7f9f25f255ee2c00178779fbce502f4b94b848b9
- Linux: Include <dl-symbol-redir-ifunc.h> in dl-sysdep.c
- x86: Properly set x86 minimum ISA level [BZ #31883]
- x86: Properly set MINIMUM_X86_ISA_LEVEL for i386 [BZ #31867]
- localedata: ssy_ER: Fix syntax error
- malloc: New test to check malloc alternate path using memory obstruction
- malloc: Improve aligned_alloc and calloc test coverage.
- malloc/Makefile: Split and sort tests
- x86/cet: fix shadow stack test scripts
Resolves: RHEL-43307
Resolves: RHEL-43456
This commit is contained in:
parent
657b0dc854
commit
a83b494d0e
57
glibc-upstream-2.39-66.patch
Normal file
57
glibc-upstream-2.39-66.patch
Normal file
@ -0,0 +1,57 @@
|
||||
commit 00899eba260ff3edb62bc6f45c1860bc64fd59e0
|
||||
Author: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Mon Feb 5 15:22:39 2024 -0500
|
||||
|
||||
x86/cet: fix shadow stack test scripts
|
||||
|
||||
Some shadow stack test scripts use the '==' operator with the 'test'
|
||||
command to validate exit codes resulting in the following error:
|
||||
|
||||
sysdeps/x86_64/tst-shstk-legacy-1e.sh: 31: test: 139: unexpected operator
|
||||
|
||||
The '==' operator is invalid for the 'test' command, use '-eq' like the
|
||||
previous call to 'test'.
|
||||
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
(cherry picked from commit 155bb9d036646138348fee0ac045de601811e0c5)
|
||||
|
||||
diff --git a/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh b/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh
|
||||
index 46f12337571127c6..0a9a164a3e8f4610 100755
|
||||
--- a/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh
|
||||
+++ b/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh
|
||||
@@ -26,7 +26,7 @@ ${common_objpfx}elf/tst-shstk-legacy-1e-static
|
||||
status=$?
|
||||
if test $status -eq 77; then
|
||||
exit 77
|
||||
-elif test $status == 139; then
|
||||
+elif test $status -eq 139; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
diff --git a/sysdeps/x86_64/tst-shstk-legacy-1e.sh b/sysdeps/x86_64/tst-shstk-legacy-1e.sh
|
||||
index 31212453d9374013..3dec5623e41dc3c8 100755
|
||||
--- a/sysdeps/x86_64/tst-shstk-legacy-1e.sh
|
||||
+++ b/sysdeps/x86_64/tst-shstk-legacy-1e.sh
|
||||
@@ -28,7 +28,7 @@ ${test_program_prefix} \
|
||||
status=$?
|
||||
if test $status -eq 77; then
|
||||
exit 77
|
||||
-elif test $status == 139; then
|
||||
+elif test $status -eq 139; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
diff --git a/sysdeps/x86_64/tst-shstk-legacy-1g.sh b/sysdeps/x86_64/tst-shstk-legacy-1g.sh
|
||||
index e84087068e6b7b15..249831e816f6589c 100755
|
||||
--- a/sysdeps/x86_64/tst-shstk-legacy-1g.sh
|
||||
+++ b/sysdeps/x86_64/tst-shstk-legacy-1g.sh
|
||||
@@ -28,7 +28,7 @@ ${test_program_prefix} \
|
||||
status=$?
|
||||
if test $status -eq 77; then
|
||||
exit 77
|
||||
-elif test $status == 139; then
|
||||
+elif test $status -eq 139; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
232
glibc-upstream-2.39-67.patch
Normal file
232
glibc-upstream-2.39-67.patch
Normal file
@ -0,0 +1,232 @@
|
||||
commit 305ee48826961b9b2ad2b2fb36ec19622d8e1d77
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Thu May 9 20:27:39 2024 -0700
|
||||
|
||||
malloc/Makefile: Split and sort tests
|
||||
|
||||
Put each test on a separate line and sort tests.
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit d49cd6a1913da9744b9a0ffbefb3f7958322382e)
|
||||
|
||||
diff --git a/malloc/Makefile b/malloc/Makefile
|
||||
index c83ade5f10063113..77ba1a91093ebc55 100644
|
||||
--- a/malloc/Makefile
|
||||
+++ b/malloc/Makefile
|
||||
@@ -24,60 +24,92 @@ include ../Makeconfig
|
||||
|
||||
dist-headers := malloc.h
|
||||
headers := $(dist-headers) obstack.h mcheck.h
|
||||
-tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
|
||||
- tst-malloc-check tst-mallocfork tst-trim1 \
|
||||
- tst-malloc-usable tst-realloc tst-reallocarray tst-posix_memalign \
|
||||
- tst-pvalloc tst-pvalloc-fortify tst-memalign tst-mallopt \
|
||||
- tst-malloc-backtrace tst-malloc-thread-exit \
|
||||
- tst-malloc-thread-fail tst-malloc-fork-deadlock \
|
||||
- tst-mallocfork2 \
|
||||
- tst-mallocfork3 \
|
||||
- tst-interpose-nothread \
|
||||
- tst-interpose-thread \
|
||||
- tst-alloc_buffer \
|
||||
- tst-free-errno \
|
||||
- tst-malloc-tcache-leak \
|
||||
- tst-malloc_info tst-mallinfo2 \
|
||||
- tst-malloc-too-large \
|
||||
- tst-malloc-stats-cancellation \
|
||||
- tst-tcfree1 tst-tcfree2 tst-tcfree3 \
|
||||
- tst-safe-linking \
|
||||
- tst-mallocalign1 \
|
||||
- tst-memalign-2 \
|
||||
- tst-memalign-3 \
|
||||
- tst-aligned-alloc
|
||||
+tests := \
|
||||
+ mallocbug \
|
||||
+ tst-aligned-alloc \
|
||||
+ tst-alloc_buffer \
|
||||
+ tst-calloc \
|
||||
+ tst-free-errno \
|
||||
+ tst-interpose-nothread \
|
||||
+ tst-interpose-thread \
|
||||
+ tst-malloc \
|
||||
+ tst-malloc-backtrace \
|
||||
+ tst-malloc-check \
|
||||
+ tst-malloc-fork-deadlock \
|
||||
+ tst-malloc-stats-cancellation \
|
||||
+ tst-malloc-tcache-leak \
|
||||
+ tst-malloc-thread-exit \
|
||||
+ tst-malloc-thread-fail \
|
||||
+ tst-malloc-too-large \
|
||||
+ tst-malloc-usable \
|
||||
+ tst-malloc_info tst-mallinfo2 \
|
||||
+ tst-mallocalign1 \
|
||||
+ tst-mallocfork \
|
||||
+ tst-mallocfork2 \
|
||||
+ tst-mallocfork3 \
|
||||
+ tst-mallopt \
|
||||
+ tst-memalign \
|
||||
+ tst-memalign-2 \
|
||||
+ tst-memalign-3 \
|
||||
+ tst-obstack \
|
||||
+ tst-posix_memalign \
|
||||
+ tst-pvalloc \
|
||||
+ tst-pvalloc-fortify \
|
||||
+ tst-realloc \
|
||||
+ tst-reallocarray \
|
||||
+ tst-safe-linking \
|
||||
+ tst-tcfree1 tst-tcfree2 tst-tcfree3 \
|
||||
+ tst-trim1 \
|
||||
+ tst-valloc \
|
||||
+# tests
|
||||
|
||||
tests-static := \
|
||||
- tst-interpose-static-nothread \
|
||||
- tst-interpose-static-thread \
|
||||
- tst-aligned-alloc-static
|
||||
+ tst-aligned-alloc-static \
|
||||
+ tst-interpose-static-nothread \
|
||||
+ tst-interpose-static-thread \
|
||||
+# tests-static
|
||||
|
||||
# Test for the malloc_set_state symbol removed in glibc 2.25.
|
||||
ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes)
|
||||
-tests += tst-mallocstate tst-compathooks-off tst-compathooks-on
|
||||
+tests += \
|
||||
+ tst-compathooks-off \
|
||||
+ tst-compathooks-on \
|
||||
+ tst-mallocstate \
|
||||
+# tests
|
||||
endif
|
||||
|
||||
tests-internal := tst-scratch_buffer
|
||||
|
||||
# The dynarray framework is only available inside glibc.
|
||||
tests-internal += \
|
||||
- tst-dynarray \
|
||||
- tst-dynarray-fail \
|
||||
- tst-dynarray-at-fail \
|
||||
+ tst-dynarray \
|
||||
+ tst-dynarray-at-fail \
|
||||
+ tst-dynarray-fail \
|
||||
+# tests-internal
|
||||
|
||||
-tests += tst-malloc-usable-tunables tst-mxfast
|
||||
+tests += \
|
||||
+ tst-malloc-usable-tunables \
|
||||
+ tst-mxfast \
|
||||
+# tests
|
||||
|
||||
tests += $(tests-static)
|
||||
test-srcs = tst-mtrace
|
||||
|
||||
# These tests either are run with MALLOC_CHECK_=3 by default or do not work
|
||||
# with MALLOC_CHECK_=3 because they expect a specific failure.
|
||||
-tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \
|
||||
- tst-mxfast tst-safe-linking \
|
||||
- tst-compathooks-off tst-compathooks-on tst-memalign-2 tst-memalign-3 \
|
||||
- tst-mallocfork2 \
|
||||
- tst-mallocfork3 \
|
||||
- tst-malloc-tcache-leak
|
||||
+tests-exclude-malloc-check = \
|
||||
+ tst-compathooks-off \
|
||||
+ tst-compathooks-on \
|
||||
+ tst-malloc-check \
|
||||
+ tst-malloc-tcache-leak \
|
||||
+ tst-malloc-usable \
|
||||
+ tst-mallocfork2 \
|
||||
+ tst-mallocfork3 \
|
||||
+ tst-memalign-2 \
|
||||
+ tst-memalign-3 \
|
||||
+ tst-mxfast \
|
||||
+ tst-safe-linking \
|
||||
+# tests-exclude-malloc-check
|
||||
|
||||
# Run all tests with MALLOC_CHECK_=3
|
||||
tests-malloc-check = $(filter-out $(tests-exclude-malloc-check) \
|
||||
@@ -87,18 +119,19 @@ tests-malloc-check = $(filter-out $(tests-exclude-malloc-check) \
|
||||
# the Transparent Huge Pages support (1) or automatic huge page support (2).
|
||||
# We need exclude some tests that define the ENV vars.
|
||||
tests-exclude-hugetlb1 = \
|
||||
- tst-compathooks-off \
|
||||
- tst-compathooks-on \
|
||||
- tst-interpose-nothread \
|
||||
- tst-interpose-thread \
|
||||
- tst-interpose-static-nothread \
|
||||
- tst-interpose-static-thread \
|
||||
- tst-malloc-usable \
|
||||
- tst-malloc-usable-tunables \
|
||||
- tst-mallocstate \
|
||||
- tst-malloc-tcache-leak \
|
||||
- tst-mallocfork2 \
|
||||
- tst-mallocfork3
|
||||
+ tst-compathooks-off \
|
||||
+ tst-compathooks-on \
|
||||
+ tst-interpose-nothread \
|
||||
+ tst-interpose-static-nothread \
|
||||
+ tst-interpose-static-thread \
|
||||
+ tst-interpose-thread \
|
||||
+ tst-malloc-tcache-leak \
|
||||
+ tst-malloc-usable \
|
||||
+ tst-malloc-usable-tunables \
|
||||
+ tst-mallocfork2 \
|
||||
+ tst-mallocfork3 \
|
||||
+ tst-mallocstate \
|
||||
+# tests-exclude-hugetlb1
|
||||
# The tst-free-errno relies on the used malloc page size to mmap an
|
||||
# overlapping region.
|
||||
tests-exclude-hugetlb2 = \
|
||||
@@ -114,22 +147,25 @@ ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes)
|
||||
# Tests that don't play well with mcheck. They are either bugs in mcheck or
|
||||
# the tests expect specific internal behavior that is changed due to linking to
|
||||
# libmcheck.a.
|
||||
-tests-exclude-mcheck = tst-mallocstate \
|
||||
- tst-safe-linking \
|
||||
- tst-malloc-backtrace \
|
||||
- tst-malloc-fork-deadlock \
|
||||
- tst-malloc-stats-cancellation \
|
||||
- tst-malloc-tcache-leak \
|
||||
- tst-malloc-thread-exit \
|
||||
- tst-malloc-thread-fail \
|
||||
- tst-malloc-usable-tunables \
|
||||
- tst-malloc_info \
|
||||
- tst-compathooks-off tst-compathooks-on \
|
||||
- tst-memalign-2 \
|
||||
- tst-memalign-3 \
|
||||
- tst-mxfast \
|
||||
- tst-mallocfork2 \
|
||||
- tst-mallocfork3
|
||||
+tests-exclude-mcheck = \
|
||||
+ tst-compathooks-off \
|
||||
+ tst-compathooks-on \
|
||||
+ tst-malloc-backtrace \
|
||||
+ tst-malloc-fork-deadlock \
|
||||
+ tst-malloc-stats-cancellation \
|
||||
+ tst-malloc-tcache-leak \
|
||||
+ tst-malloc-thread-exit \
|
||||
+ tst-malloc-thread-fail \
|
||||
+ tst-malloc-usable-tunables \
|
||||
+ tst-malloc_info \
|
||||
+ tst-mallocfork2 \
|
||||
+ tst-mallocfork3 \
|
||||
+ tst-mallocstate \
|
||||
+ tst-memalign-2 \
|
||||
+ tst-memalign-3 \
|
||||
+ tst-mxfast \
|
||||
+ tst-safe-linking \
|
||||
+# tests-exclude-mcheck
|
||||
|
||||
tests-mcheck = $(filter-out $(tests-exclude-mcheck) $(tests-static), $(tests))
|
||||
endif
|
||||
@@ -159,10 +195,12 @@ extra-libs-others = $(extra-libs)
|
||||
extra-test-objs += \
|
||||
tst-interpose-aux-nothread.o \
|
||||
tst-interpose-aux-thread.o \
|
||||
+# extra-test-objs
|
||||
|
||||
test-extras = \
|
||||
tst-interpose-aux-nothread \
|
||||
tst-interpose-aux-thread \
|
||||
+# test-extras
|
||||
|
||||
libmemusage-routines = memusage
|
||||
libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
|
244
glibc-upstream-2.39-68.patch
Normal file
244
glibc-upstream-2.39-68.patch
Normal file
@ -0,0 +1,244 @@
|
||||
commit a2da98aa2a13b1bde7fd3a98f31b04ddecfafa8f
|
||||
Author: Joe Simmons-Talbott <josimmon@redhat.com>
|
||||
Date: Tue May 14 14:36:50 2024 +0000
|
||||
|
||||
malloc: Improve aligned_alloc and calloc test coverage.
|
||||
|
||||
Add a DSO (malloc/tst-aligned_alloc-lib.so) that can be used during
|
||||
testing to interpose malloc with a call that randomly uses either
|
||||
aligned_alloc, __libc_malloc, or __libc_calloc in the place of malloc.
|
||||
Use LD_PRELOAD with the DSO to mirror malloc/tst-malloc.c testing as an
|
||||
example in malloc/tst-malloc-random.c. Add malloc/tst-aligned-alloc-random.c
|
||||
as another example that does a number of malloc calls with randomly sized,
|
||||
but limited to 0xffff, requests.
|
||||
|
||||
The intention is to be able to utilize existing malloc testing to ensure
|
||||
that similar allocation APIs are also exposed to the same rigors.
|
||||
|
||||
Reviewed-by: DJ Delorie <dj@redhat.com>
|
||||
(cherry picked from commit 3395157ff2b0657d70c36169156f67440205c8bf)
|
||||
|
||||
diff --git a/malloc/Makefile b/malloc/Makefile
|
||||
index 77ba1a91093ebc55..c1a03f3cb02c464d 100644
|
||||
--- a/malloc/Makefile
|
||||
+++ b/malloc/Makefile
|
||||
@@ -27,6 +27,7 @@ headers := $(dist-headers) obstack.h mcheck.h
|
||||
tests := \
|
||||
mallocbug \
|
||||
tst-aligned-alloc \
|
||||
+ tst-aligned-alloc-random \
|
||||
tst-alloc_buffer \
|
||||
tst-calloc \
|
||||
tst-free-errno \
|
||||
@@ -36,6 +37,7 @@ tests := \
|
||||
tst-malloc-backtrace \
|
||||
tst-malloc-check \
|
||||
tst-malloc-fork-deadlock \
|
||||
+ tst-malloc-random \
|
||||
tst-malloc-stats-cancellation \
|
||||
tst-malloc-tcache-leak \
|
||||
tst-malloc-thread-exit \
|
||||
@@ -193,6 +195,7 @@ extra-libs-others = $(extra-libs)
|
||||
|
||||
# Helper objects for some tests.
|
||||
extra-test-objs += \
|
||||
+ tst-aligned_alloc-lib.so \
|
||||
tst-interpose-aux-nothread.o \
|
||||
tst-interpose-aux-thread.o \
|
||||
# extra-test-objs
|
||||
@@ -202,6 +205,9 @@ test-extras = \
|
||||
tst-interpose-aux-thread \
|
||||
# test-extras
|
||||
|
||||
+modules-names = \
|
||||
+ tst-aligned_alloc-lib
|
||||
+
|
||||
libmemusage-routines = memusage
|
||||
libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
|
||||
|
||||
@@ -408,3 +414,9 @@ tst-mallocstate-malloc-check-ENV = LD_PRELOAD=$(objpfx)libc_malloc_debug.so
|
||||
# libc_malloc_debug.so.
|
||||
$(objpfx)tst-mallocstate: $(objpfx)libc_malloc_debug.so
|
||||
$(objpfx)tst-mallocstate-malloc-check: $(objpfx)libc_malloc_debug.so
|
||||
+
|
||||
+$(objpfx)tst-aligned-alloc-random.out: $(objpfx)tst-aligned_alloc-lib.so
|
||||
+$(objpfx)tst-malloc-random.out: $(objpfx)tst-aligned_alloc-lib.so
|
||||
+
|
||||
+tst-aligned-alloc-random-ENV = LD_PRELOAD=$(objpfx)tst-aligned_alloc-lib.so
|
||||
+tst-malloc-random-ENV = LD_PRELOAD=$(objpfx)tst-aligned_alloc-lib.so
|
||||
diff --git a/malloc/tst-aligned-alloc-random.c b/malloc/tst-aligned-alloc-random.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..f2825ce38f04e04e
|
||||
--- /dev/null
|
||||
+++ b/malloc/tst-aligned-alloc-random.c
|
||||
@@ -0,0 +1,43 @@
|
||||
+/* Test for randomized malloc that calls aligned_alloc
|
||||
+ Copyright (C) 2024 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 <stdlib.h>
|
||||
+#include <support/check.h>
|
||||
+#include <time.h>
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ void *p1;
|
||||
+ int i;
|
||||
+
|
||||
+ srandom (time (NULL));
|
||||
+
|
||||
+ for (i = 0; i < 1024; i++)
|
||||
+ {
|
||||
+ size_t size = random () & 0xffff;
|
||||
+
|
||||
+ p1 = malloc (size);
|
||||
+ TEST_VERIFY (p1 != NULL);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
diff --git a/malloc/tst-aligned_alloc-lib.c b/malloc/tst-aligned_alloc-lib.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..0205df5acf6297a5
|
||||
--- /dev/null
|
||||
+++ b/malloc/tst-aligned_alloc-lib.c
|
||||
@@ -0,0 +1,72 @@
|
||||
+/* Module used for improved aligned_alloc testing.
|
||||
+ Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
+ Copyright The GNU Toolchain Authors.
|
||||
+ 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; see the file COPYING.LIB. If
|
||||
+ not, see <https://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <array_length.h>
|
||||
+#include <libc-symbols.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+extern void *__libc_malloc (size_t size);
|
||||
+extern void *__libc_calloc (size_t n, size_t size);
|
||||
+
|
||||
+int aligned_alloc_count = 0;
|
||||
+int libc_malloc_count = 0;
|
||||
+int libc_calloc_count = 0;
|
||||
+
|
||||
+/* Get a random alignment value. Biased towards the smaller values. Must be
|
||||
+ a power of 2. */
|
||||
+static size_t get_random_alignment (void)
|
||||
+{
|
||||
+ size_t aligns[] = {
|
||||
+ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384
|
||||
+ };
|
||||
+
|
||||
+ return aligns[random () % array_length (aligns)];
|
||||
+}
|
||||
+
|
||||
+static void *get_random_alloc (size_t size)
|
||||
+{
|
||||
+ void *retval;
|
||||
+ size_t align;
|
||||
+
|
||||
+ switch (random() % 3)
|
||||
+ {
|
||||
+ case 1:
|
||||
+ align = get_random_alignment ();
|
||||
+ retval = aligned_alloc (align, size);
|
||||
+ aligned_alloc_count++;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ retval = __libc_calloc (1, size);
|
||||
+ libc_calloc_count++;
|
||||
+ break;
|
||||
+ default:
|
||||
+ retval = __libc_malloc (size);
|
||||
+ libc_malloc_count++;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void * __random_malloc (size_t size)
|
||||
+{
|
||||
+ return get_random_alloc (size);
|
||||
+}
|
||||
+strong_alias (__random_malloc, malloc)
|
||||
diff --git a/malloc/tst-malloc-random.c b/malloc/tst-malloc-random.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..762b70c918cc6004
|
||||
--- /dev/null
|
||||
+++ b/malloc/tst-malloc-random.c
|
||||
@@ -0,0 +1,20 @@
|
||||
+/* Test malloc with random calls to aligned_alloc and calloc.
|
||||
+
|
||||
+ Copyright (C) 2024 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 "tst-malloc.c"
|
||||
diff --git a/malloc/tst-malloc.c b/malloc/tst-malloc.c
|
||||
index a7491d3d00f9525f..f7a6e4654c374d01 100644
|
||||
--- a/malloc/tst-malloc.c
|
||||
+++ b/malloc/tst-malloc.c
|
||||
@@ -18,7 +18,9 @@
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <libc-diag.h>
|
||||
+#include <time.h>
|
||||
|
||||
static int errors = 0;
|
||||
|
||||
@@ -35,6 +37,8 @@ do_test (void)
|
||||
void *p, *q;
|
||||
int save;
|
||||
|
||||
+ srandom (time (NULL));
|
||||
+
|
||||
errno = 0;
|
||||
|
||||
DIAG_PUSH_NEEDS_COMMENT;
|
107
glibc-upstream-2.39-69.patch
Normal file
107
glibc-upstream-2.39-69.patch
Normal file
@ -0,0 +1,107 @@
|
||||
commit 9de9cd17e73db0ba9af9ef11dc12d490fb59720c
|
||||
Author: sayan paul <saypaul@redhat.com>
|
||||
Date: Wed May 29 15:31:04 2024 +0530
|
||||
|
||||
malloc: New test to check malloc alternate path using memory obstruction
|
||||
|
||||
The test aims to ensure that malloc uses the alternate path to
|
||||
allocate memory when sbrk() or brk() fails.To achieve this,
|
||||
the test first creates an obstruction at current program break,
|
||||
tests that obstruction with a failing sbrk(), then checks if malloc
|
||||
is still returning a valid ptr thus inferring that malloc() used
|
||||
mmap() instead of brk() or sbrk() to allocate the memory.
|
||||
Reviewed-by: Arjun Shankar <arjun@redhat.com>
|
||||
Reviewed-by: Zack Weinberg <zack@owlfolio.org>
|
||||
|
||||
(cherry picked from commit 127fc56152347d73cb7c1c283e60e1cb1f15e9f9)
|
||||
|
||||
diff --git a/malloc/Makefile b/malloc/Makefile
|
||||
index c1a03f3cb02c464d..cc14cf66c9661f99 100644
|
||||
--- a/malloc/Makefile
|
||||
+++ b/malloc/Makefile
|
||||
@@ -34,6 +34,7 @@ tests := \
|
||||
tst-interpose-nothread \
|
||||
tst-interpose-thread \
|
||||
tst-malloc \
|
||||
+ tst-malloc-alternate-path \
|
||||
tst-malloc-backtrace \
|
||||
tst-malloc-check \
|
||||
tst-malloc-fork-deadlock \
|
||||
diff --git a/malloc/tst-malloc-alternate-path.c b/malloc/tst-malloc-alternate-path.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..43ae916815d6ff47
|
||||
--- /dev/null
|
||||
+++ b/malloc/tst-malloc-alternate-path.c
|
||||
@@ -0,0 +1,72 @@
|
||||
+/* Test that malloc uses mmap when sbrk or brk fails.
|
||||
+ Copyright (C) 2024 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/>. */
|
||||
+
|
||||
+/* This test sets up an obstruction to ensure that brk/sbrk fails to
|
||||
+ grow the heap, then verifies that malloc uses mmap for allocations
|
||||
+ instead. */
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+#include <sys/mman.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <libc-pointer-arith.h>
|
||||
+#include <support/check.h>
|
||||
+#include <stddef.h>
|
||||
+#include <stdalign.h>
|
||||
+
|
||||
+#define LARGE_SIZE (10 * (1 << 20)) // 10 MB
|
||||
+static long page_size;
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ /* Get current program break. */
|
||||
+ void *current_brk = sbrk (0);
|
||||
+
|
||||
+ page_size = sysconf (_SC_PAGESIZE);
|
||||
+
|
||||
+ /* Round up to the next page boundary. */
|
||||
+ void *next_page_boundary = PTR_ALIGN_UP (current_brk, page_size);
|
||||
+
|
||||
+ /* Place a mapping using mmap at the next page boundary. */
|
||||
+ void *obstruction_addr
|
||||
+ = mmap (next_page_boundary, page_size, PROT_READ,
|
||||
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
|
||||
+
|
||||
+ /* Check if memory obstruction is set up correctly. */
|
||||
+ TEST_VERIFY_EXIT (obstruction_addr == next_page_boundary);
|
||||
+
|
||||
+ /* Try to extend the heap beyond the obstruction using sbrk */
|
||||
+ int *ptr = sbrk (page_size);
|
||||
+ TEST_VERIFY_EXIT (ptr == (void *) -1);
|
||||
+
|
||||
+ /* Attempt multiple small allocations using malloc. */
|
||||
+ for (size_t i = 0; i < page_size / alignof (max_align_t); i++)
|
||||
+ {
|
||||
+ TEST_VERIFY (malloc (alignof (max_align_t)));
|
||||
+ }
|
||||
+
|
||||
+ /* Attempt to allocate a large block of memory using malloc. */
|
||||
+ TEST_VERIFY_EXIT (malloc (LARGE_SIZE) != NULL);
|
||||
+
|
||||
+ /* Check if malloc changed current program break. */
|
||||
+ TEST_VERIFY_EXIT (current_brk == sbrk (0));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
21
glibc-upstream-2.39-70.patch
Normal file
21
glibc-upstream-2.39-70.patch
Normal file
@ -0,0 +1,21 @@
|
||||
commit e1d0040a6d1b0714e1ad14abeb7b90bfbd86a8dc
|
||||
Author: Mike FABIAN <mfabian@redhat.com>
|
||||
Date: Wed Feb 7 18:41:02 2024 +0100
|
||||
|
||||
localedata: ssy_ER: Fix syntax error
|
||||
|
||||
(cherry picked from commit 07fd072caff50bca2a7e9f5737a5b38280d2ffda)
|
||||
|
||||
diff --git a/localedata/locales/ssy_ER b/localedata/locales/ssy_ER
|
||||
index 05d94c9f10398c45..43a16e0f5452ad6a 100644
|
||||
--- a/localedata/locales/ssy_ER
|
||||
+++ b/localedata/locales/ssy_ER
|
||||
@@ -106,7 +106,7 @@ country_ab3 "ERI"
|
||||
country_num 232
|
||||
country_car "ER"
|
||||
% country_isbn unknown, Need ISO 2108
|
||||
-# https://en.wikipedia.org/wiki/Saho_language has "Saaho" as the endonym but CLDR has "Saho"
|
||||
+% https://en.wikipedia.org/wiki/Saho_language has "Saaho" as the endonym but CLDR has "Saho"
|
||||
lang_name "Saho"
|
||||
lang_ab ""
|
||||
lang_term "ssy"
|
69
glibc-upstream-2.39-71.patch
Normal file
69
glibc-upstream-2.39-71.patch
Normal file
@ -0,0 +1,69 @@
|
||||
commit b7f5b0a7114e29577daf64e68970673b61e5fcba
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Mon Jun 10 13:02:06 2024 -0700
|
||||
|
||||
x86: Properly set MINIMUM_X86_ISA_LEVEL for i386 [BZ #31867]
|
||||
|
||||
On i386, set the default minimum ISA level to 0, not 1 (baseline which
|
||||
includes SSE2). There are no changes in config.h nor in config.make on
|
||||
x86-64. This fixes BZ #31867.
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Tested-by: Ian Jordan <immoloism@gmail.com>
|
||||
Reviewed-by: Sam James <sam@gentoo.org>
|
||||
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
||||
(cherry picked from commit 09bc68b0ac26331a0109f0578c9368e09176da18)
|
||||
|
||||
diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
|
||||
index d28d9bcb296c6380..1e2325d0d7212d67 100644
|
||||
--- a/sysdeps/x86/configure
|
||||
+++ b/sysdeps/x86/configure
|
||||
@@ -139,8 +139,10 @@ libc_cv_have_x86_isa_level=4
|
||||
libc_cv_have_x86_isa_level=3
|
||||
#elif MINIMUM_X86_ISA_LEVEL == 2
|
||||
libc_cv_have_x86_isa_level=2
|
||||
-#else
|
||||
+#elif defined __x86_64__
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
+#else
|
||||
+libc_cv_have_x86_isa_level=MINIMUM_X86_ISA_LEVEL
|
||||
#endif
|
||||
EOF
|
||||
eval `${CC-cc} $CFLAGS $CPPFLAGS $ISAFLAG -I$srcdir -E conftest.c | grep libc_cv_have_x86_isa_level`
|
||||
@@ -148,8 +150,10 @@ EOF
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_have_x86_isa_level" >&5
|
||||
printf "%s\n" "$libc_cv_have_x86_isa_level" >&6; }
|
||||
-else
|
||||
+elif test $base_machine = x86_64; then
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
+else
|
||||
+ libc_cv_have_x86_isa_level=0
|
||||
fi
|
||||
if test $libc_cv_have_x86_isa_level = baseline; then
|
||||
printf "%s\n" "#define MINIMUM_X86_ISA_LEVEL 1" >>confdefs.h
|
||||
diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
|
||||
index 5b0acd03d2a30c9b..0b32fdfd4f1bb115 100644
|
||||
--- a/sysdeps/x86/configure.ac
|
||||
+++ b/sysdeps/x86/configure.ac
|
||||
@@ -96,14 +96,18 @@ libc_cv_have_x86_isa_level=4
|
||||
libc_cv_have_x86_isa_level=3
|
||||
#elif MINIMUM_X86_ISA_LEVEL == 2
|
||||
libc_cv_have_x86_isa_level=2
|
||||
-#else
|
||||
+#elif defined __x86_64__
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
+#else
|
||||
+libc_cv_have_x86_isa_level=MINIMUM_X86_ISA_LEVEL
|
||||
#endif
|
||||
EOF
|
||||
eval `${CC-cc} $CFLAGS $CPPFLAGS $ISAFLAG -I$srcdir -E conftest.c | grep libc_cv_have_x86_isa_level`
|
||||
rm -rf conftest*])
|
||||
-else
|
||||
+elif test $base_machine = x86_64; then
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
+else
|
||||
+ libc_cv_have_x86_isa_level=0
|
||||
fi
|
||||
if test $libc_cv_have_x86_isa_level = baseline; then
|
||||
AC_DEFINE_UNQUOTED(MINIMUM_X86_ISA_LEVEL, 1)
|
82
glibc-upstream-2.39-72.patch
Normal file
82
glibc-upstream-2.39-72.patch
Normal file
@ -0,0 +1,82 @@
|
||||
commit f05638731eeaae70c53b4fb30bfc58bc3c52a6d5
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Tue Jun 11 20:14:56 2024 -0700
|
||||
|
||||
x86: Properly set x86 minimum ISA level [BZ #31883]
|
||||
|
||||
Properly set libc_cv_have_x86_isa_level in shell for MINIMUM_X86_ISA_LEVEL
|
||||
defined as
|
||||
|
||||
(__X86_ISA_V1 + __X86_ISA_V2 + __X86_ISA_V3 + __X86_ISA_V4)
|
||||
|
||||
Also set __X86_ISA_V2 to 1 for i386 if __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||
is defined. There are no changes in config.h nor in config.make on x86-64.
|
||||
On i386, -march=x86-64-v2 with GCC generates
|
||||
|
||||
#define MINIMUM_X86_ISA_LEVEL 2
|
||||
|
||||
in config.h and
|
||||
|
||||
have-x86-isa-level = 2
|
||||
|
||||
in config.make. This fixes BZ #31883.
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
||||
(cherry picked from commit 29807a271edca3e47195bda0c69ae45e245551a9)
|
||||
|
||||
diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
|
||||
index 1e2325d0d7212d67..04c6ba3e6ca53fb6 100644
|
||||
--- a/sysdeps/x86/configure
|
||||
+++ b/sysdeps/x86/configure
|
||||
@@ -141,8 +141,10 @@ libc_cv_have_x86_isa_level=3
|
||||
libc_cv_have_x86_isa_level=2
|
||||
#elif defined __x86_64__
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
+#elif MINIMUM_X86_ISA_LEVEL == 1
|
||||
+libc_cv_have_x86_isa_level=1
|
||||
#else
|
||||
-libc_cv_have_x86_isa_level=MINIMUM_X86_ISA_LEVEL
|
||||
+libc_cv_have_x86_isa_level=0
|
||||
#endif
|
||||
EOF
|
||||
eval `${CC-cc} $CFLAGS $CPPFLAGS $ISAFLAG -I$srcdir -E conftest.c | grep libc_cv_have_x86_isa_level`
|
||||
diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
|
||||
index 0b32fdfd4f1bb115..8a259d3971488e4b 100644
|
||||
--- a/sysdeps/x86/configure.ac
|
||||
+++ b/sysdeps/x86/configure.ac
|
||||
@@ -98,8 +98,10 @@ libc_cv_have_x86_isa_level=3
|
||||
libc_cv_have_x86_isa_level=2
|
||||
#elif defined __x86_64__
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
+#elif MINIMUM_X86_ISA_LEVEL == 1
|
||||
+libc_cv_have_x86_isa_level=1
|
||||
#else
|
||||
-libc_cv_have_x86_isa_level=MINIMUM_X86_ISA_LEVEL
|
||||
+libc_cv_have_x86_isa_level=0
|
||||
#endif
|
||||
EOF
|
||||
eval `${CC-cc} $CFLAGS $CPPFLAGS $ISAFLAG -I$srcdir -E conftest.c | grep libc_cv_have_x86_isa_level`
|
||||
diff --git a/sysdeps/x86/isa-level.h b/sysdeps/x86/isa-level.h
|
||||
index 2c7f74212b9a27e5..03c1fe2bf54e0673 100644
|
||||
--- a/sysdeps/x86/isa-level.h
|
||||
+++ b/sysdeps/x86/isa-level.h
|
||||
@@ -35,7 +35,17 @@
|
||||
# define __X86_ISA_V1 0
|
||||
#endif
|
||||
|
||||
-#if __X86_ISA_V1 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 \
|
||||
+#ifdef __x86_64__
|
||||
+# ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
|
||||
+# define __GCC_HAVE_SYNC_COMPARE_AND_SWAP
|
||||
+# endif
|
||||
+#else
|
||||
+# ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||
+# define __GCC_HAVE_SYNC_COMPARE_AND_SWAP
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#if __X86_ISA_V1 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP \
|
||||
&& defined HAVE_X86_LAHF_SAHF && defined __POPCNT__ && defined __SSE3__ \
|
||||
&& defined __SSSE3__ && defined __SSE4_1__ && defined __SSE4_2__
|
||||
/* NB: ISAs in x86-64 ISA level v2 are used. */
|
28
glibc-upstream-2.39-75.patch
Normal file
28
glibc-upstream-2.39-75.patch
Normal file
@ -0,0 +1,28 @@
|
||||
commit 7f9f25f255ee2c00178779fbce502f4b94b848b9
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Tue Jun 18 10:56:34 2024 +0200
|
||||
|
||||
Linux: Include <dl-symbol-redir-ifunc.h> in dl-sysdep.c
|
||||
|
||||
The _dl_sysdep_parse_arguments function contains initalization
|
||||
of a large on-stack variable:
|
||||
|
||||
dl_parse_auxv_t auxv_values = { 0, };
|
||||
|
||||
This uses a non-inline version of memset on powerpc64le-linux-gnu,
|
||||
so it must use the baseline memset.
|
||||
|
||||
(cherry picked from commit f6ea5d1291cf3f264514d03872ebae84e0293b69)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c
|
||||
index e1b14e9eb34ff5cb..a8ec2d7c18cc423e 100644
|
||||
--- a/sysdeps/unix/sysv/linux/dl-sysdep.c
|
||||
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.c
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <sys/utsname.h>
|
||||
#include <tls.h>
|
||||
#include <unistd.h>
|
||||
+#include <dl-symbol-redir-ifunc.h>
|
||||
|
||||
#include <dl-machine.h>
|
||||
#include <dl-hwcap-check.h>
|
24
glibc.spec
24
glibc.spec
@ -170,7 +170,7 @@ Version: %{glibcversion}
|
||||
# - It allows using the Release number without the %%dist tag in the dependency
|
||||
# generator to make the generated requires interchangeable between Rawhide
|
||||
# and ELN (.elnYY < .fcXX).
|
||||
%global baserelease 15
|
||||
%global baserelease 16
|
||||
Release: %{baserelease}%{?dist}
|
||||
|
||||
# Licenses:
|
||||
@ -397,6 +397,16 @@ Patch86: glibc-upstream-2.39-62.patch
|
||||
Patch87: glibc-upstream-2.39-63.patch
|
||||
Patch88: glibc-upstream-2.39-64.patch
|
||||
Patch89: glibc-upstream-2.39-65.patch
|
||||
Patch90: glibc-upstream-2.39-66.patch
|
||||
Patch91: glibc-upstream-2.39-67.patch
|
||||
Patch92: glibc-upstream-2.39-68.patch
|
||||
Patch93: glibc-upstream-2.39-69.patch
|
||||
Patch94: glibc-upstream-2.39-70.patch
|
||||
Patch95: glibc-upstream-2.39-71.patch
|
||||
Patch96: glibc-upstream-2.39-72.patch
|
||||
# NEWS update: glibc-upstream-2.39-73.patch
|
||||
# NEWS update: glibc-upstream-2.39-74.patch
|
||||
Patch97: glibc-upstream-2.39-75.patch
|
||||
|
||||
##############################################################################
|
||||
# Continued list of core "glibc" package information:
|
||||
@ -2622,6 +2632,18 @@ update_gconv_modules_cache ()
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Fri Jun 21 2024 Arjun Shankar <arjun@redhat.com> - 2.39-16
|
||||
- Sync with upstream branch release/2.39/master,
|
||||
commit 7f9f25f255ee2c00178779fbce502f4b94b848b9:
|
||||
- Linux: Include <dl-symbol-redir-ifunc.h> in dl-sysdep.c
|
||||
- x86: Properly set x86 minimum ISA level [BZ #31883]
|
||||
- x86: Properly set MINIMUM_X86_ISA_LEVEL for i386 [BZ #31867]
|
||||
- localedata: ssy_ER: Fix syntax error
|
||||
- malloc: New test to check malloc alternate path using memory obstruction
|
||||
- malloc: Improve aligned_alloc and calloc test coverage.
|
||||
- malloc/Makefile: Split and sort tests
|
||||
- x86/cet: fix shadow stack test scripts
|
||||
|
||||
* Wed Jun 05 2024 Arjun Shankar <arjun@redhat.com> - 2.39-15
|
||||
- Sync with upstream branch release/2.39/master,
|
||||
commit 6ade91c21140d8c803c289932dbfc74537f65a1f:
|
||||
|
Loading…
Reference in New Issue
Block a user