public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman•id.au>
To: "Naveen N. Rao" <naveen.n.rao@linux•ibm.com>,
	linuxppc-dev@lists•ozlabs.org
Cc: amodra@gmail•com
Subject: Re: [PATCH] powerpc/vdso: Fix incorrect CFI in gettimeofday.S
Date: Tue, 17 May 2022 22:32:09 +1000	[thread overview]
Message-ID: <877d6kpcfq.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <1652772528.r6qrwbbda5.naveen@linux.ibm.com>

"Naveen N. Rao" <naveen.n.rao@linux•ibm.com> writes:
> Michael Ellerman wrote:
>>
>> diff --git a/arch/powerpc/kernel/vdso/gettimeofday.S b/arch/powerpc/kernel/vdso/gettimeofday.S
>> index eb9c81e1c218..0aee255e9cbb 100644
>> --- a/arch/powerpc/kernel/vdso/gettimeofday.S
>> +++ b/arch/powerpc/kernel/vdso/gettimeofday.S
>> @@ -22,12 +22,15 @@
>>  .macro cvdso_call funct call_time=0
>>    .cfi_startproc
>>  	PPC_STLU	r1, -PPC_MIN_STKFRM(r1)
>> +  .cfi_adjust_cfa_offset PPC_MIN_STKFRM
>>  	mflr		r0
>> -  .cfi_register lr, r0
>>  	PPC_STLU	r1, -PPC_MIN_STKFRM(r1)
>> +  .cfi_adjust_cfa_offset PPC_MIN_STKFRM
>>  	PPC_STL		r0, PPC_MIN_STKFRM + PPC_LR_STKOFF(r1)
>
> <snip>
>
>> @@ -46,6 +50,7 @@
>>  	mtlr		r0
>>    .cfi_restore lr
>>  	addi		r1, r1, 2 * PPC_MIN_STKFRM
>> +  .cfi_def_cfa_offset 0
>
> Should this be .cfi_adjust_cfa_offset, given that we used that at the
> start of the function?
 
AIUI "adjust x" is offset += x, whereas "def x" is offset = x.

So we could use adjust here, but we'd need to adjust by -(2 * PPC_MIN_STKFRM).

It seemed clearer to just set the offset back to 0, which is what it is
at the start of the function.

But I'm not a CFI expert at all, so I'll defer to anyone else who has an
opinion :)

cheers

  reply	other threads:[~2022-05-17 12:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 12:50 [PATCH] powerpc/vdso: Fix incorrect CFI in gettimeofday.S Michael Ellerman
2022-05-02 14:27 ` Segher Boessenkool
2022-05-02 23:53   ` Alan Modra
2022-05-04 12:34     ` Michael Ellerman
2022-05-04 12:27   ` Michael Ellerman
2022-05-04 14:08     ` Segher Boessenkool
2022-05-08 11:11 ` Michael Ellerman
2022-05-17  7:33 ` Naveen N. Rao
2022-05-17 12:32   ` Michael Ellerman [this message]
2022-05-18  9:38     ` Naveen N. Rao
2022-05-19  1:30     ` Alan Modra
2022-05-20 12:14       ` Naveen N. Rao

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=877d6kpcfq.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman$(echo .)id.au \
    --cc=amodra@gmail$(echo .)com \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=naveen.n.rao@linux$(echo .)ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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