]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
sparc: Fix argument passing to __libc_start_main (BZ 32981)
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 30 May 2025 15:40:04 +0000 (12:40 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 3 Jun 2025 12:59:01 +0000 (09:59 -0300)
sparc start.S does not provide the final argument for
__libc_start_main, which is the highest stack address used to
update the __libc_stack_end.A

This fixes elf/tst-execstack-prog-static-tunable on sparc64.
On sparcv9 this does not happen because the kernel puts an
auxv value, which turns to point to a value in the stack itself.

Checked on sparc64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit 404526ee2e58f3c075253943ddc9988f4bd6b80c)

NEWS
sysdeps/sparc/sparc32/start.S
sysdeps/sparc/sparc64/start.S

diff --git a/NEWS b/NEWS
index e5d4a8304879170e0dba34dfc315bcefca3816f0..90d090ea77ba9e785a097096d60fbcb1bac40fea 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,8 @@ The following bugs were resolved with this release:
   [32882] tst-audit10 fails with SIGILL on CPUs without AVX
   [32897] dynamic-link: pthread_getattr_np fails when executable stack
     tunable is set
+  [32981] ports: elf/tst-execstack-prog-static-tunable fails on
+    sparc64-linux-gnu
   [32987] elf: Fix subprocess status handling for tst-dlopen-sgid
 \f
 Version 2.41
index 694b020ce0defff4b73eb0415d8fdbe1b1c3e262..cef7c96cac7253f9093c3bc6d54d714f17013ca5 100644 (file)
@@ -73,6 +73,10 @@ _start:
      be NULL.  */
        mov     %g1, %o5
 
+  /* Provide the highest stack address to update the __libc_stack_end (used
+     to enable executable stacks if required).  */
+       st      %sp, [%sp+23*4]
+
   /* Let libc do the rest of the initialization, and call main.  */
        call    __libc_start_main
         nop
index c9c25c2e4794a0405996dd93d88e06cf5604206f..08e1e77210540cdac66493c22fe9b3c6859c9cd1 100644 (file)
@@ -74,6 +74,10 @@ _start:
      be NULL.  */
        mov     %g1, %o5
 
+  /* Provide the highest stack address to update the __libc_stack_end (used
+     to enable executable stacks if required).  */
+       stx     %sp, [%sp+STACK_BIAS+22*8]
+
   /* Let libc do the rest of the initialization, and call main.  */
        call    __libc_start_main
         nop