From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org, jma14 <jma14@rice.edu>,
John Mellor-Crummey <johnmc@rice.edu>
Subject: Re: [PATCH v9 4/4] elf: Fix runtime linker auditing on aarch64 (BZ #26643)
Date: Thu, 13 Jan 2022 16:24:10 +0000 [thread overview]
Message-ID: <20220113162410.GA3294453@arm.com> (raw)
In-Reply-To: <c263f2d9-74c2-1c9a-a578-9a71bdc1ab3a@linaro.org>
The 01/11/2022 15:12, Adhemerval Zanella wrote:
>
>
> On 11/01/2022 14:09, Szabolcs Nagy wrote:
> > The 01/11/2022 13:49, Adhemerval Zanella wrote:
> >> On 11/01/2022 08:16, Szabolcs Nagy wrote:
> >>> The 01/03/2022 10:25, Adhemerval Zanella via Libc-alpha wrote:
> >>>> @@ -142,13 +143,17 @@ _dl_runtime_profile:
> >>>> Stack frame layout:
> >>>> [sp, #...] lr
> >>>> [sp, #...] &PLTGOT[n]
> >>>> - [sp, #96] La_aarch64_regs
> >>>> - [sp, #48] La_aarch64_retval
> >>>> - [sp, #40] frame size return from pltenter
> >>>> - [sp, #32] dl_profile_call saved x1
> >>>> - [sp, #24] dl_profile_call saved x0
> >>>> - [sp, #16] t1
> >>>> - [sp, #0] x29, lr <- x29
> >>>> + -----------------------
> >>>> + [sp, #384] La_aarch64_regs::lr_xreg (x0-x8)
> >>>> + [sp, #256] La_aarch64_regs::lr_vreg (q0-q7)
> >>>> + [sp, #240] La_aarch64_regs::sp and La_aarch64_regs::lr
> >>>> + [sp, #176] La_aarch64_retval::lrv_xreg (x0-x7)
> >>>> + [sp, # 48] La_aarch64_retval::lrv_vreg (q0-q7)
> >>>> + [sp, # 40] frame size return from pltenter
> >>>> + [sp, # 32] dl_profile_call saved x1
> >>>> + [sp, # 24] dl_profile_call saved x0
> >>>> + [sp, # 16] t1
> >>>> + [sp, # 0] x29, lr <- x29
> >>>> */
> >>>
> >>> the layout in the comment looks backwards.
> >>
> >> It follows the convention of the about layout:
> >>
> >> /* AArch64 we get called with:
> >> ip0 &PLTGOT[2]
> >> ip1 temp(dl resolver entry point)
> >> [sp, #8] lr
> >> [sp, #0] &PLTGOT[n]
> >> [...]
> >>
> >
> > i mean the order of the fields is wrong.
> >
> > lr_xreg has larger address than lr_vreg
> > but in the struct it is the opposite.
> >
> > i think you need to reorder the fields.
> > (but we don't have to document the exact offsets
> > here, so a simplified comment is fine too)
>
> Indeed, it should be:
>
> [sp, #384] La_aarch64_regs::lr_xreg (q0-q7)
> [sp, #256] La_aarch64_regs::lr_vreg (x0-x8)
xreg vs vreg is still wrong.
> [sp, #240] La_aarch64_regs::sp and La_aarch64_regs::lr
> [sp, #176] La_aarch64_retval::lrv_xreg (q0-q7)
> [sp, #48] La_aarch64_retval::lrv_vreg (x0-x7)
> [sp, #40] frame size return from pltenter
> [sp, #32] dl_profile_call saved x1
> [sp, #24] dl_profile_call saved x0
> [sp, #16] t1
> [sp, #0] x29, lr <- x29
>
> I have fixed it.
given
> + uint64_t lr_xreg[9];
> + La_aarch64_vector lr_vreg[8];
> + uint64_t lr_sp;
> + uint64_t lr_lr;
> + void *lr_vpcs;
i'd expect an order
lr_vpcs
lr_lr
lr_sp
lr_vreg[]
lr_xreg[]
x29, lr
on the stack.
prev parent reply other threads:[~2022-01-13 16:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-03 13:25 [PATCH v9 0/4] Multiple rtld-audit fixes Adhemerval Zanella
2022-01-03 13:25 ` [PATCH v9 1/4] elf: Add la_activity during application exit Adhemerval Zanella
2022-01-04 17:13 ` Jonathon Anderson
2022-01-03 13:25 ` [PATCH v9 2/4] elf: Fix initial-exec TLS access on audit modules (BZ #28096) Adhemerval Zanella
2022-01-03 13:25 ` [PATCH v9 3/4] elf: Issue la_symbind for bind-now (BZ #23734) Adhemerval Zanella
2022-01-03 13:25 ` [PATCH v9 4/4] elf: Fix runtime linker auditing on aarch64 (BZ #26643) Adhemerval Zanella
2022-01-11 11:16 ` Szabolcs Nagy
2022-01-11 16:49 ` Adhemerval Zanella
2022-01-11 17:09 ` Szabolcs Nagy
2022-01-11 18:12 ` Adhemerval Zanella
2022-01-13 16:24 ` Szabolcs Nagy [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=20220113162410.GA3294453@arm.com \
--to=szabolcs.nagy@arm.com \
--cc=adhemerval.zanella@linaro.org \
--cc=jma14@rice.edu \
--cc=johnmc@rice.edu \
--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).