From: Mark Brown <broonie@kernel.org>
To: Will Deacon <will@kernel.org>
Cc: mark.rutland@arm.com, android-kvm@google.com,
catalin.marinas@arm.com, ndesaulniers@google.com,
clang-built-linux@googlegroups.com,
linux-arm-kernel@lists.infradead.org, daniel.kiss@arm.com
Subject: Re: Clang miscompiling arm64 kernel with BTI and PAC?
Date: Mon, 15 Jun 2020 12:53:37 +0100 [thread overview]
Message-ID: <20200615115337.GG4447@sirena.org.uk> (raw)
In-Reply-To: <20200615105524.GA2694@willie-the-truck>
[-- Attachment #1.1: Type: text/plain, Size: 1235 bytes --]
On Mon, Jun 15, 2020 at 11:55:24AM +0100, Will Deacon wrote:
> Here, the switch statement has been replaced by a jump table which we *tail
> call* into. The register dump shows we're going to 0xffffd68929392e14:
> ffff800010032e14: d503233f paciasp
> ffff800010032e18: a9bf7bfd stp x29, x30, [sp, #-16]!
> ffff800010032e1c: 910003fd mov x29, sp
> ffff800010032e20: aa0803e0 mov x0, x8
> ffff800010032e24: 940017c0 bl ffff800010038d24 <kvm_vm_ioctl_check_extension>
> ffff800010032e28: 93407c00 sxtw x0, w0
> ffff800010032e2c: a8c17bfd ldp x29, x30, [sp], #16
> ffff800010032e30: d50323bf autiasp
> ffff800010032e34: d65f03c0 ret
> The problem is that the paciasp instruction is not BTYPE-compatible with BR;
> it expects to be called with a branch-and-link, and so we panic. I think you
> need to emit a 'bti j' here prior to the paciasp.
I checked with our internal teams and they actually ran into this
recently with some other code, the patch:
https://reviews.llvm.org/D81746
([AArch64] Fix BTI instruction emission) should fix this, it's been
reviewed so should be merged shortly.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-06-15 11:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-15 10:55 Clang miscompiling arm64 kernel with BTI and PAC? Will Deacon
2020-06-15 11:37 ` Mark Brown
2020-06-15 11:53 ` Mark Brown [this message]
2020-06-15 12:02 ` Will Deacon
2020-06-15 14:31 ` Nathan Chancellor
2020-06-15 15:00 ` Daniel Kiss
2020-06-16 17:37 ` Will Deacon
2020-06-16 17:49 ` Nathan Chancellor
2020-06-16 17:55 ` Will Deacon
2020-06-16 18:35 ` Nick Desaulniers
2020-06-17 6:36 ` Fangrui Song
2020-06-18 11:22 ` Daniel Kiss
2020-06-16 18:09 ` Tom Stellard
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=20200615115337.GG4447@sirena.org.uk \
--to=broonie@kernel.org \
--cc=android-kvm@google.com \
--cc=catalin.marinas@arm.com \
--cc=clang-built-linux@googlegroups.com \
--cc=daniel.kiss@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=ndesaulniers@google.com \
--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;
as well as URLs for NNTP newsgroup(s).