From: Segher Boessenkool <segher@kernel.crashing.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Paul Mackerras <paulus@samba.org>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] powerpc/booke: Avoid link stack corruption in several places
Date: Tue, 24 Aug 2021 12:15:56 -0500 [thread overview]
Message-ID: <20210824171556.GJ1583@gate.crashing.org> (raw)
In-Reply-To: <e9fbc285eceb720e6c0e032ef47fe8b05f669b48.1629791751.git.christophe.leroy@csgroup.eu>
Hi!
On Tue, Aug 24, 2021 at 07:56:26AM +0000, Christophe Leroy wrote:
> Use bcl 20,31,+4 instead of bl in order to preserve link stack.
You use $+4 actually, which is clearer than .+4 or just +4 (and I am
surprised that the latter even works btw, I never knew :-) -- either
way it looks like a typo).
> - bl invstr /* Find our address */
> + bcl 20,31,$+4 /* Find our address */
> invstr: mflr r6 /* Make it accessible */
You can remove the label now. This isn't true in all cases, but here
you can (all times it is called "invstr").
> @@ -85,7 +85,7 @@ skpinv: addi r6,r6,1 /* Increment */
> addi r6,r6,10
> slw r6,r8,r6 /* convert to mask */
>
> - bl 1f /* Find our address */
> + bcl 20,31,$+4 /* Find our address */
> 1: mflr r7
Here, too.
> @@ -1045,7 +1045,7 @@ head_start_47x:
> sync
>
> /* Find the entry we are running from */
> - bl 1f
> + bcl 20,31,$+4
> 1: mflr r23
> tlbsx r23,0,r23
> tlbre r24,r23,0
And here.
> @@ -1132,7 +1132,7 @@ _GLOBAL(switch_to_as1)
> bne 1b
>
> /* Get the tlb entry used by the current running code */
> - bl 0f
> + bcl 20,31,$+4
> 0: mflr r4
> tlbsx 0,r4
> @@ -1166,7 +1166,7 @@ _GLOBAL(switch_to_as1)
> _GLOBAL(restore_to_as0)
> mflr r0
>
> - bl 0f
> + bcl 20,31,$+4
> 0: mflr r9
> addi r9,r9,1f - 0b
And these.
> --- a/arch/powerpc/mm/nohash/tlb_low.S
> +++ b/arch/powerpc/mm/nohash/tlb_low.S
> @@ -199,7 +199,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_476_DD2)
> * Touch enough instruction cache lines to ensure cache hits
> */
> 1: mflr r9
> - bl 2f
> + bcl 20,31,$+4
> 2: mflr r6
> li r7,32
> PPC_ICBT(0,R6,R7) /* touch next cache line */
> @@ -414,7 +414,7 @@ _GLOBAL(loadcam_multi)
> * Set up temporary TLB entry that is the same as what we're
> * running from, but in AS=1.
> */
> - bl 1f
> + bcl 20,31,$+4
> 1: mflr r6
> tlbsx 0,r8
> mfspr r6,SPRN_MAS1
And these too.
There does not see to be a warning for usused local labels, it would be
useful in this case :-)
Segher
next prev parent reply other threads:[~2021-08-24 17:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-24 7:56 [PATCH v3] powerpc/booke: Avoid link stack corruption in several places Christophe Leroy
2021-08-24 17:15 ` Segher Boessenkool [this message]
2021-08-27 13:15 ` Michael Ellerman
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=20210824171556.GJ1583@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.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 NNTP newsgroup(s).