public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Vladislav Khmelevsky <och95@yandex.ru>, libc-alpha@sourceware.org
Cc: woodard@redhat.com
Subject: Re: [PATCH] elf: Fix rtld-audit trampoline for aarch64
Date: Thu, 17 Nov 2022 15:15:53 -0300	[thread overview]
Message-ID: <8c6d9a21-464b-3b8d-661a-a3b3733e1bb7@linaro.org> (raw)
In-Reply-To: <20221117084729.2794073-1-och95@yandex.ru>



On 17/11/22 05:47, Vladislav Khmelevsky wrote:
> This patch fixes two problems with audit:
> 1. The DL_OFFSET_RV_VPCS offset was mixed up with DL_OFFSET_RG_VPCS,
> resulting in x2 register value nulling in RG structure.
> 2. We need to preserve the x8 register before function call, but don't have
> to save it's new value and restore it before return. Anyway the final
> restore was using OFFSET_RV instead of OFFSET_RG value which is wrong (althoug doesn't affect anything).

Patch looks ok, although I think currently the ABI only uses x0 and/or x1
to return value (for __int128_t for instance). So I think it should not
be a user-visible issue (at least tst-audit26 does check that lr_vpcs
and lrv_vpcs are zeroed). Are you seeing any issue with current code?
If so could you open a bug please?

> ---
>  sysdeps/aarch64/dl-trampoline.S | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S
> index 909b208578..d66f0b9c45 100644
> --- a/sysdeps/aarch64/dl-trampoline.S
> +++ b/sysdeps/aarch64/dl-trampoline.S
> @@ -298,12 +298,11 @@ _dl_runtime_profile:
>  	stp	x2, x3, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*1]
>  	stp	x4, x5, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*2]
>  	stp	x6, x7, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*3]
> -	str	x8,     [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*4]
>  	stp	q0, q1, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*0]
>  	stp	q2, q3, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*1]
>  	stp	q4, q5, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*2]
>  	stp	q6, q7, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*3]
> -	str	xzr,    [X29, #OFFSET_RV + DL_OFFSET_RG_VPCS]
> +	str	xzr,    [X29, #OFFSET_RV + DL_OFFSET_RV_VPCS]
>  
>  	/* Setup call to pltexit  */
>  	ldp	x0, x1, [x29, #OFFSET_SAVED_CALL_X0]
> @@ -315,7 +314,6 @@ _dl_runtime_profile:
>  	ldp	x2, x3, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*1]
>  	ldp	x4, x5, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*2]
>  	ldp	x6, x7, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*3]
> -	ldr	x8,     [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*4]
>  	ldp	q0, q1, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*0]
>  	ldp	q2, q3, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*1]
>  	ldp	q4, q5, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*2]

  reply	other threads:[~2022-11-17 18:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17  8:47 Vladislav Khmelevsky
2022-11-17 18:15 ` Adhemerval Zanella Netto [this message]
2022-11-17 18:23   ` Vladislav Khmelevsky
2022-11-17 18:36     ` Adhemerval Zanella Netto
2022-11-17 18:51       ` Vladislav Khmelevsky
2022-12-02 18:20         ` Carlos O'Donell

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=8c6d9a21-464b-3b8d-661a-a3b3733e1bb7@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=och95@yandex.ru \
    --cc=woodard@redhat.com \
    /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).