diff --git a/glibc.spec b/glibc.spec index 17c32a7a4d59082c6c7ce6b009e504dafa059c4c..b2b9f56e9f7726d575bd404ac7665a2ff90bbf7b 100644 --- a/glibc.spec +++ b/glibc.spec @@ -62,7 +62,7 @@ ############################################################################## Name: glibc Version: 2.28 -Release: 113 +Release: 114 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -181,6 +181,7 @@ Patch94: backport-0004-posix-Remove-alloca-usage-for-internal-fnmatch-imple.patc Patch95: posix-Fix-double-free-after-allocation-failure-in-re.patch Patch96: benchtests-Set-float-type-on-threshold-argument.patch Patch97: stdio-Fix-aliasing-violation.patch +Patch98: use_uintptr_t_for_address_diagnostic.patch Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) @@ -1300,6 +1301,9 @@ fi %endif %changelog +* Fri Oct 17 2025 panzhe - 2.28-114 +- nptl: Use uintptr_t for address diagnostic in nptl/tst-pthread-getattr + * Wed Oct 15 2025 panzhe - 2.28-113 - debuginfo: Fix invalid macro _enable_debug_packages diff --git a/use_uintptr_t_for_address_diagnostic.patch b/use_uintptr_t_for_address_diagnostic.patch new file mode 100644 index 0000000000000000000000000000000000000000..b4cb2e4f1e0aab2820f4aab71742cd4ccaf0e952 --- /dev/null +++ b/use_uintptr_t_for_address_diagnostic.patch @@ -0,0 +1,88 @@ +From 8a814e20d443adc460a1030fa1a66aa9ae817483 Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Tue, 30 Jul 2019 10:35:08 +0200 +Subject: [PATCH] nptl: Use uintptr_t for address diagnostic in + nptl/tst-pthread-getattr +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Recent GCC versions warn about the attempt to return the address of a +local variable: + +tst-pthread-getattr.c: In function ‘allocate_and_test’: +tst-pthread-getattr.c:54:10: error: function returns address of local variable [-Werror=return-local-addr] + 54 | return mem; + | ^~~ +In file included from ../include/alloca.h:3, + from tst-pthread-getattr.c:26: +../stdlib/alloca.h:35:23: note: declared here + 35 | # define alloca(size) __builtin_alloca (size) + | ^~~~~~~~~~~~~~~~~~~~~~~ +tst-pthread-getattr.c:51:9: note: in expansion of macro ‘alloca’ + 51 | mem = alloca ((size_t) (mem - target)); + | ^~~~~~ + +The address itself is used in a check in the caller, so using +uintptr_t instead is reasonable. +--- + nptl/tst-pthread-getattr.c | 17 +++++++++-------- + 1 files changed, 9 insertions(+), 8 deletions(-) + +diff --git a/nptl/tst-pthread-getattr.c b/nptl/tst-pthread-getattr.c +index a954778767..c13795c4bd 100644 +--- a/nptl/tst-pthread-getattr.c ++++ b/nptl/tst-pthread-getattr.c +@@ -41,9 +41,11 @@ + + static size_t pagesize; + +-/* Check if the page in which TARGET lies is accessible. This will segfault +- if it fails. */ +-static volatile char * ++/* Test that the page in which TARGET lies is accessible. This will ++ segfault if the write fails. This function has only half a page ++ of thread stack left and so should not do anything and immediately ++ return the address to which the stack reached. */ ++static volatile uintptr_t + allocate_and_test (char *target) + { + volatile char *mem = (char *) &mem; +@@ -51,7 +53,7 @@ allocate_and_test (char *target) + mem = alloca ((size_t) (mem - target)); + + *mem = 42; +- return mem; ++ return (uintptr_t) mem; + } + + static int +@@ -84,7 +86,6 @@ check_stack_top (void) + { + struct rlimit stack_limit; + void *stackaddr; +- volatile void *mem; + size_t stacksize = 0; + int ret; + uintptr_t pagemask = ~(pagesize - 1); +@@ -130,14 +131,14 @@ check_stack_top (void) + stack and test access there. It is however sufficient to simply check if + the top page is accessible, so we target our access halfway up the top + page. Thanks Chris Metcalf for this idea. */ +- mem = allocate_and_test (stackaddr + pagesize / 2); ++ uintptr_t mem = allocate_and_test (stackaddr + pagesize / 2); + + /* Before we celebrate, make sure we actually did test the same page. */ +- if (((uintptr_t) stackaddr & pagemask) != ((uintptr_t) mem & pagemask)) ++ if (((uintptr_t) stackaddr & pagemask) != (mem & pagemask)) + { + printf ("We successfully wrote into the wrong page.\n" + "Expected %#" PRIxPTR ", but got %#" PRIxPTR "\n", +- (uintptr_t) stackaddr & pagemask, (uintptr_t) mem & pagemask); ++ (uintptr_t) stackaddr & pagemask, mem & pagemask); + + return 1; + } +-- +2.25.1 +