From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Cc: DJ Delorie <dj@redhat.com>
Subject: [PATCH 5/8] alpha: Fix the la_pltexit path of _dl_runtime_profile
Date: Mon, 28 Sep 2026 15:55:09 -0300 [thread overview]
Message-ID: <20260928185535.1353957-6-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20260928185535.1353957-1-adhemerval.zanella@linaro.org>
The la_pltexit path of both _dl_runtime_profile_new and
_dl_runtime_profile_old had two issues:
- The call destination was saved in the new argument frame, which
the memcpy of the stack arguments then overwrote. The trampoline
jumped to a random address for any frame size larger than 14*8.
- The return values were not reloaded from La_alpha_retval after
_dl_audit_pltexit. The caller got whatever _dl_audit_pltexit
left in the return registers.
The tst-audit-plt-flags XFAIL is removed.
Checked on alpha-linux-gnu.
---
sysdeps/alpha/Makefile | 4 ----
sysdeps/alpha/dl-trampoline.S | 26 ++++++++++++++++++++------
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/sysdeps/alpha/Makefile b/sysdeps/alpha/Makefile
index ebf6288ccc4..faa59ab27a6 100644
--- a/sysdeps/alpha/Makefile
+++ b/sysdeps/alpha/Makefile
@@ -69,10 +69,6 @@ CFLAGS-s_isnan.c += -fno-builtin-isnanf
test-xfail-test-float32x-float64-div = yes
endif
-ifeq ($(subdir),elf)
-test-xfail-tst-audit-plt-flags = yes
-endif
-
# Build everything with full IEEE math support, and with dynamic rounding;
# there are a number of math routines that are defined to work with the
# "current" rounding mode, and it's easiest to set this with all of them.
diff --git a/sysdeps/alpha/dl-trampoline.S b/sysdeps/alpha/dl-trampoline.S
index c69d03c03b8..2602b3d0c58 100644
--- a/sysdeps/alpha/dl-trampoline.S
+++ b/sysdeps/alpha/dl-trampoline.S
@@ -161,8 +161,9 @@ _dl_runtime_profile_new:
bic $18, 15, $18
subq $30, $18, $30
- /* Save the call destination around memcpy. */
- stq $0, 14*8($30)
+ /* Save the call destination around memcpy, in the fixed frame
+ since the new argument frame is overwritten by the copy. */
+ stq $0, 14*8($15)
/* Copy the stack arguments into place. */
lda $16, 0($30)
@@ -171,7 +172,7 @@ _dl_runtime_profile_new:
ldgp $29, 0($26)
/* Reload the argument registers. */
- ldq $27, 14*8($30)
+ ldq $27, 14*8($15)
ldq $16, 2*8($15)
ldq $17, 3*8($15)
ldq $18, 4*8($15)
@@ -199,6 +200,12 @@ _dl_runtime_profile_new:
stt $f1, 19*8($15)
bsr $26, _dl_audit_pltexit !samegp
+ /* Reload the return values, which la_pltexit may change. */
+ ldq $0, 16*8($15)
+ ldq $1, 17*8($15)
+ ldt $f0, 18*8($15)
+ ldt $f1, 19*8($15)
+
mov $15, $30
cfi_def_cfa_register (30)
ldq $26, 0($30)
@@ -494,8 +501,9 @@ _dl_runtime_profile_old:
bic $18, 15, $18
subq $30, $18, $30
- /* Save the call destination around memcpy. */
- stq $0, 46*8($30)
+ /* Save the call destination around memcpy, in the fixed frame
+ since the new argument frame is overwritten by the copy. */
+ stq $0, 46*8($15)
/* Copy the stack arguments into place. */
lda $16, 0($30)
@@ -504,7 +512,7 @@ _dl_runtime_profile_old:
ldgp $29, 0($26)
/* Reload the argument registers. */
- ldq $27, 46*8($30)
+ ldq $27, 46*8($15)
ldq $16, 2*8($15)
ldq $17, 3*8($15)
ldq $18, 4*8($15)
@@ -532,6 +540,12 @@ _dl_runtime_profile_old:
stt $f1, 49*8($15)
bsr $26, _dl_audit_pltexit !samegp
+ /* Reload the return values, which la_pltexit may change. */
+ ldq $0, 46*8($15)
+ ldq $1, 47*8($15)
+ ldt $f0, 48*8($15)
+ ldt $f1, 49*8($15)
+
mov $15, $30
cfi_def_cfa_register (30)
ldq $26, 0($30)
--
2.53.0
next prev parent reply other threads:[~2026-09-28 18:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 18:55 [PATCH 0/8] [PATCH 0/8] elf: Fix auditing with multiple auditors and la_pltexit Adhemerval Zanella
2026-09-28 18:55 ` [PATCH 1/8] elf: Fix auditor iteration in _dl_audit_symbind_alt (BZ 34684) Adhemerval Zanella
2026-09-28 18:55 ` [PATCH 2/8] elf: Keep la_symbind and la_pltenter flags per auditor (BZ 34687) Adhemerval Zanella
2026-09-28 18:55 ` [PATCH 3/8] elf: Honor LA_SYMB_NOPLTENTER/NOPLTEXIT per auditor (BZ 34688) Adhemerval Zanella
2026-09-28 18:55 ` [PATCH 4/8] aarch64: Return with ret from the la_pltexit path of _dl_runtime_profile Adhemerval Zanella
2026-09-30 15:53 ` Yury Khrustalev
2026-09-28 18:55 ` Adhemerval Zanella [this message]
2026-09-28 18:55 ` [PATCH 6/8] LoongArch: Fix " Adhemerval Zanella
2026-09-28 18:55 ` [PATCH 7/8] riscv: " Adhemerval Zanella
2026-09-28 18:55 ` [PATCH 8/8] hppa: " Adhemerval Zanella
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260928185535.1353957-6-adhemerval.zanella@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=dj@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).