public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Sam James <sam@gentoo.org>,
	Adrian Ratiu <adrian.ratiu@collabora.com>,
	libc-alpha@sourceware.org
Subject: Re: [PATCH] arm: Remove unused ldr _dl_start_user
Date: Mon, 05 Feb 2024 18:19:45 +0000	[thread overview]
Message-ID: <874jemai4a.fsf@gentoo.org> (raw)
In-Reply-To: <53d1dad6-4506-4ff9-9d1e-0c4125ad8726@linaro.org>


Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> writes:

> On 05/02/24 14:13, Sam James wrote:
>> 
>> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>> 
>>> 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 caller-saved register; a different runtime might not zero
>>> initialize it and thus trigger an invalid memory access.
>> 
>> Tag the bug?
>> 
>> Also, I feel like the title perhaps makes the change sound more cosmetic
>> than it is.
>
> Right, I will change to 'arm: Remove wrong ldr _dl_start_user (BZ 31339)'

wfm, thanks!

>
>> 
>>>
>>> Checked on arm-linux-gnu.
>>>
>>> Reported-by: Adrian Ratiu <adrian.ratiu@collabora.com>
>>> ---
>>>  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 b857bbc868..dd1a0f6b6e 100644
>>> --- a/sysdeps/arm/dl-machine.h
>>> +++ b/sysdeps/arm/dl-machine.h
>>> @@ -139,7 +139,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\
>> 


      reply	other threads:[~2024-02-05 18:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 16:18 Adhemerval Zanella
2024-02-05 17:06 ` Szabolcs Nagy
2024-02-05 17:08   ` Adhemerval Zanella Netto
2024-02-05 17:13 ` Sam James
2024-02-05 18:09   ` Adhemerval Zanella Netto
2024-02-05 18:19     ` Sam James [this message]

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=874jemai4a.fsf@gentoo.org \
    --to=sam@gentoo.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=adrian.ratiu@collabora.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).