[4/8] aarch64: Return with ret from the la_pltexit path of _dl_runtime_profile

Message ID 20260928185535.1353957-5-adhemerval.zanella@linaro.org (mailing list archive)
State Under Review
Delegated to: Florian Weimer
Headers
Series elf: Fix auditing with multiple auditors and la_pltexit |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed

Commit Message

Adhemerval Zanella Sept. 28, 2026, 6:55 p.m. UTC
  The la_pltexit path returned to the caller with 'br lr', and an indirect
branch must land on a BTI instruction (which the caller's return site
does not have).

Checked on aarch64-linux-gnu.
---
 sysdeps/aarch64/Makefile        | 4 ----
 sysdeps/aarch64/dl-trampoline.S | 4 +++-
 2 files changed, 3 insertions(+), 5 deletions(-)
  

Comments

Yury Khrustalev Sept. 30, 2026, 3:53 p.m. UTC | #1
On Mon, Sep 28, 2026 at 03:55:08PM -0300, Adhemerval Zanella wrote:
> The la_pltexit path returned to the caller with 'br lr', and an indirect
> branch must land on a BTI instruction (which the caller's return site
> does not have).

Thanks for this fix. LGTM though perhaps this commit can just be merged
with the previous one or moved before it (avoiding unnecessary change to
the makefile).

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>

> 
> Checked on aarch64-linux-gnu.
> ---
>  sysdeps/aarch64/Makefile        | 4 ----
>  sysdeps/aarch64/dl-trampoline.S | 4 +++-
>  2 files changed, 3 insertions(+), 5 deletions(-)
> ...

Thanks,
Yury
  

Patch

diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile
index 74c8fc8bada..f046148091c 100644
--- a/sysdeps/aarch64/Makefile
+++ b/sysdeps/aarch64/Makefile
@@ -29,10 +29,6 @@  $(objpfx)tst-audit27: $(objpfx)tst-audit27mod.so \
 $(objpfx)tst-audit27mod.so: $(libsupport)
 LDFLAGS-tst-audit27 += -Wl,-z,lazy
 tst-audit27-ENV = LD_AUDIT=$(objpfx)tst-auditmod27.so
-
-ifeq (yes,$(have-test-bti))
-test-xfail-tst-audit-plt-flags = yes
-endif
 endif
 
 ifeq ($(subdir),elf)
diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S
index b40d8bb31bc..412fb859064 100644
--- a/sysdeps/aarch64/dl-trampoline.S
+++ b/sysdeps/aarch64/dl-trampoline.S
@@ -321,7 +321,9 @@  _dl_runtime_profile:
 	add	sp, sp, SF_SIZE + 16
 	cfi_adjust_cfa_offset (- SF_SIZE - 16)
 
-	br	lr
+	/* Use ret instead of br: the caller's return site is not a BTI
+	   landing pad.  */
+	ret
 
 	cfi_endproc
 	.size _dl_runtime_profile, .-_dl_runtime_profile