aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-05-30 12:40:04 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-06-03 09:59:01 -0300
commitd952c6efaa87c6973819bcb74712b86fc35a033e (patch)
tree3a8124520fc32dfacc25dbcdf98772c3eab8fd81
parent515d4166f4dbcf43b1568e3f63a19d9a92b2d50e (diff)
downloadglibc-d952c6efaa87c6973819bcb74712b86fc35a033e.zip
glibc-d952c6efaa87c6973819bcb74712b86fc35a033e.tar.gz
glibc-d952c6efaa87c6973819bcb74712b86fc35a033e.tar.bz2
sparc: Fix argument passing to __libc_start_main (BZ 32981)
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)
-rw-r--r--NEWS2
-rw-r--r--sysdeps/sparc/sparc32/start.S4
-rw-r--r--sysdeps/sparc/sparc64/start.S4
3 files changed, 10 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index e5d4a83..90d090e 100644
--- 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
Version 2.41
diff --git a/sysdeps/sparc/sparc32/start.S b/sysdeps/sparc/sparc32/start.S
index 694b020..cef7c96 100644
--- a/sysdeps/sparc/sparc32/start.S
+++ b/sysdeps/sparc/sparc32/start.S
@@ -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
diff --git a/sysdeps/sparc/sparc64/start.S b/sysdeps/sparc/sparc64/start.S
index c9c25c2..08e1e77 100644
--- a/sysdeps/sparc/sparc64/start.S
+++ b/sysdeps/sparc/sparc64/start.S
@@ -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