From: Dave Martin <Dave.Martin@arm.com>
To: Jeremy Linton <jeremy.linton@arm.com>
Cc: Ard Biesheuvel <ardb@kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
Catalin Marinas <catalin.marinas@arm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Mark Brown <broonie@kernel.org>,
Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
Will Deacon <will@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [BUG][PATCH] arm64: bti: fix BTI to handle local indirect branches
Date: Tue, 6 Oct 2020 10:38:17 +0100 [thread overview]
Message-ID: <20201006093817.GV6642@arm.com> (raw)
In-Reply-To: <c7959ca7-5212-0dfb-2ebc-6247083d356b@arm.com>
On Mon, Oct 05, 2020 at 02:24:47PM -0500, Jeremy Linton wrote:
> Hi,
>
> On 10/5/20 1:54 PM, Ard Biesheuvel wrote:
> >On Mon, 5 Oct 2020 at 20:18, Jeremy Linton <jeremy.linton@arm.com> wrote:
> >>
> >>The AES code uses a 'br x7' as part of a function called by
> >>a macro, that ends up needing a BTI_J as a target.
> >
> >Could we instead just drop the tail call, i.e, replace it with a ret
> >and do a 'bl' after it returns? The indirect call does not really
> >serve a purpose here anyway
>
> Yes, that is an option, it adds an extra ret. Which probably doesn't mean
> much in most cases. I assumed this code was optimized this way because it
> mattered somewhere.
Since this really does seem to be a tail-call and since x16 and x17
appear to be otherwise unused here, can we not just use x16 or x17
instead of x7?
This relies on there being no other calls to veneered functions in the
mix, but this code is all in a single section so that shouldn't be a
concern.
Due to the magic status of x16 and x17 in br instructions, the resulting
jump should be compatible with BTI c. I think this matches how the
compiler should typically compile tail-calls.
Cheers
---Dave
next prev parent reply other threads:[~2020-10-06 9:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-05 18:18 [BUG][PATCH] arm64: bti: fix BTI to handle local indirect branches Jeremy Linton
2020-10-05 18:54 ` Ard Biesheuvel
2020-10-05 19:24 ` Jeremy Linton
2020-10-06 9:38 ` Dave Martin [this message]
2020-10-06 9:50 ` Ard Biesheuvel
2020-10-05 19:59 ` Mark Brown
2020-10-05 20:10 ` Jeremy Linton
2020-10-05 20:28 ` Mark Brown
2020-10-06 7:23 ` kernel test robot
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=20201006093817.GV6642@arm.com \
--to=dave.martin@arm.com \
--cc=ardb@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=jeremy.linton@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will@kernel.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