about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-02-05 16:10:24 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-02-05 15:43:21 -0300
commitec6aaab3e1d754a1ad762f9e9ca4e2525ce87ad3 (patch)
tree6d644a4d8884ef41f936d61223a596cd9a78ed53
parent2853e541c58af1f5d868c4161ea9562e7876a989 (diff)
downloadglibc-ec6aaab3e1d754a1ad762f9e9ca4e2525ce87ad3.tar.gz
glibc-ec6aaab3e1d754a1ad762f9e9ca4e2525ce87ad3.tar.xz
glibc-ec6aaab3e1d754a1ad762f9e9ca4e2525ce87ad3.zip
arm: Remove wrong ldr from _dl_start_user (BZ 31339)
The commit 49d877a80b29d3002887b084eec6676d9f5fec18 (arm: Remove
_dl_skip_args usage) removed the _SKIP_ARGS literal, which was
previously loader to r4 on loader _start.  However, the cleanup did not
remove the following 'ldr r4, [sl, r4]' on _dl_start_user, used to check
to skip the arguments after ld self-relocations.

In my testing, the kernel initially set r4 to 0, which makes the
ldr instruction just read the _GLOBAL_OFFSET_TABLE_.  However, since r4
is a callee-saved register; a different runtime might not zero
initialize it and thus trigger an invalid memory access.

Checked on arm-linux-gnu.

Reported-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
(cherry picked from commit 1e25112dc0cb2515d27d8d178b1ecce778a9d37a)
-rw-r--r--sysdeps/arm/dl-machine.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 6a422713bd..659c6f16da 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -137,7 +137,6 @@ _start:\n\
 _dl_start_user:\n\
 	adr	r6, .L_GET_GOT\n\
 	add	sl, sl, r6\n\
-	ldr	r4, [sl, r4]\n\
 	@ save the entry point in another register\n\
 	mov	r6, r0\n\
 	@ get the original arg count\n\