From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 190D338582BA; Mon, 5 Feb 2024 19:06:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 190D338582BA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707159980; bh=7zr6gj0N1sGLDgr6dyvxzPo3GfgpXKNW/v8RpKDQbW4=; h=From:To:Subject:Date:From; b=dy7uC4ZVxmuYf5pp8mQTdPULX/yd06+EbGYPJGBappIIrhvTM/Z2Pgwh1BbEpeZxM 0SwcA2XNaeCjusV+KfBCPppYSakd6oTQ+nG/MqwI35xHeP21O+dMxFV7C/vXF1ntIm RofxFxMCFculjlUB8wLv0Vw9H04D7TFVscRt/EBc= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/release/2.36/master] arm: Remove wrong ldr from _dl_start_user (BZ 31339) X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/release/2.36/master X-Git-Oldrev: 2853e541c58af1f5d868c4161ea9562e7876a989 X-Git-Newrev: ec6aaab3e1d754a1ad762f9e9ca4e2525ce87ad3 Message-Id: <20240205190620.190D338582BA@sourceware.org> Date: Mon, 5 Feb 2024 19:06:20 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ec6aaab3e1d754a1ad762f9e9ca4e2525ce87ad3 commit ec6aaab3e1d754a1ad762f9e9ca4e2525ce87ad3 Author: Adhemerval Zanella Date: Mon Feb 5 16:10:24 2024 +0000 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 Reviewed-by: Szabolcs Nagy (cherry picked from commit 1e25112dc0cb2515d27d8d178b1ecce778a9d37a) Diff: --- sysdeps/arm/dl-machine.h | 1 - 1 file changed, 1 deletion(-) 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\