From: Andrew Jones <drjones@redhat.com> To: Mark Rutland <mark.rutland@arm.com> Cc: linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, cdall@linaro.org, arnd@arndb.de, marc.zyngier@arm.com, catalin.marinas@arm.com, yao.qi@arm.com, kernel-hardening@lists.openwall.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, awallis@codeaurora.org, kvmarm@lists.cs.columbia.edu Subject: Re: [PATCHv2 12/12] arm64: docs: document pointer authentication Date: Mon, 4 Dec 2017 13:49:31 +0100 Message-ID: <20171204124931.wg3wmgvzedayprql@kamzik.brq.redhat.com> (raw) In-Reply-To: <20171204123932.pru4lw753xm7qlwb@lakrids.cambridge.arm.com> On Mon, Dec 04, 2017 at 12:39:33PM +0000, Mark Rutland wrote: > On Tue, Nov 28, 2017 at 04:07:26PM +0100, Andrew Jones wrote: > > Hi Mark, > > Hi Drew, > > > On Mon, Nov 27, 2017 at 04:38:06PM +0000, Mark Rutland wrote: > > > +Architecture overview > > > +--------------------- > > > + > > > +The ARMv8.3 Pointer Authentication extension adds primitives that can be > > > +used to mitigate certain classes of attack where an attacker can corrupt > > > +the contents of some memory (e.g. the stack). > > > + > > > +The extension uses a Pointer Authentication Code (PAC) to determine > > > +whether pointers have been modified unexpectedly. A PAC is derived from > > > +a pointer, another value (such as the stack pointer), and a secret key > > > +held in system registers. > > > + > > > +The extension adds instructions to insert a valid PAC into a pointer, > > > +and to verify/remove the PAC from a pointer. The PAC occupies a number > > > +of high-order bits of the pointer, which varies dependent on the > > > +configured virtual address size and whether pointer tagging is in use. > > > + > > > +A subset of these instructions have been allocated from the HINT > > > +encoding space. In the absence of the extension (or when disabled), > > > +these instructions behave as NOPs. Applications and libraries using > > > +these instructions operate correctly regardless of the presence of the > > > +extension. > > > > Correctly, but obviously without the additional security. So I assume > > it's expected that applications that demand this security to probe for > > it themselves, presumably by the checking the HWCAP. Is that correct? > > Yes. Applications which wish to mandate pointer authentication > (presumably using instructions outside of the HINT space) must check the > relevant HWCAP first. > > [...] > > > > +Virtualization > > > +-------------- > > > + > > > +When CONFIG_ARM64_POINTER_AUTHENTICATION is selected, and uniform HW > > > +support is present, KVM will context switch all keys used by vCPUs. > > > +Otherwise, the feature is disabled. When disabled, accesses to keys, or > > > +use of instructions enabled within the guest will trap to EL2, and an > > > +UNDEFINED exception will be injected into the guest. > > > > If host applications will just run, with the instructions behaving like > > NOPs, when the extension is either not present or not enabled, then > > shouldn't guest applications also just run? > > The enabled/disabled wording is probably the confusing bit here. > > At EL1 we have conditional enables for instructions using > AP{I,D}{A,B}Key, which behave as NOPs when disabled. > > At EL2 we have a single conditional trap for all instructions using > pointer authentication, that traps to EL2 when instructions are not > NOP'd by EL1. > > So "disabled by EL2" is actually "trapped by EL2", and "disabled by EL1" > is "NOP'd by EL1". > > > I.e. instead of injecting UNDEF, just treat the instructions as NOPs. > > Or did I misunderstand the trapping? > > I think the documentation explained it poorly. Did the above help? Yes, both the above and the below have helped me understand. Thanks for the clarification! drew > > > Does use of the instructions at EL0 trap to EL1 or EL2? > > If disabled by EL1, the instructions behave as NOPs (regardless of the > EL2 traps). > > If enabled by EL1, but trapped by EL2, the instructions trap to EL2. > > If enabled by EL1, and not trapped by EL2, the instructions work as > usual. > > I'll see if I can document this better. > > Thanks, > Mark.
prev parent reply index Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-11-27 16:37 [PATCHv2 00/12] ARMv8.3 pointer authentication userspace support Mark Rutland 2017-11-27 16:37 ` [PATCHv2 01/12] asm-generic: mm_hooks: allow hooks to be overridden individually Mark Rutland 2017-11-27 16:37 ` [PATCHv2 02/12] arm64: add pointer authentication register bits Mark Rutland 2017-11-27 16:37 ` [PATCHv2 03/12] arm64/cpufeature: add ARMv8.3 id_aa64isar1 bits Mark Rutland 2017-11-27 16:37 ` [PATCHv2 04/12] arm64/cpufeature: detect pointer authentication Mark Rutland 2017-11-27 16:37 ` [PATCHv2 05/12] arm64: Don't trap host pointer auth use to EL2 Mark Rutland 2018-02-06 12:39 ` Christoffer Dall 2018-02-12 16:00 ` Mark Rutland 2017-11-27 16:38 ` [PATCHv2 06/12] arm64: add basic pointer authentication support Mark Rutland 2018-05-22 19:06 ` Adam Wallis 2017-11-27 16:38 ` [PATCHv2 07/12] arm64: expose user PAC bit positions via ptrace Mark Rutland 2017-11-27 16:38 ` [PATCHv2 08/12] arm64: perf: strip PAC when unwinding userspace Mark Rutland 2017-11-27 16:38 ` [PATCHv2 09/12] arm64/kvm: preserve host HCR_EL2 value Mark Rutland 2018-02-06 12:39 ` Christoffer Dall 2018-04-09 14:57 ` Mark Rutland 2018-04-09 19:03 ` Christoffer Dall 2017-11-27 16:38 ` [PATCHv2 10/12] arm64/kvm: context-switch ptrauth registers Mark Rutland 2018-02-06 12:38 ` Christoffer Dall 2018-03-09 14:28 ` Mark Rutland 2018-04-09 12:58 ` Christoffer Dall 2018-04-09 14:37 ` Mark Rutland 2017-11-27 16:38 ` [PATCHv2 11/12] arm64: enable pointer authentication Mark Rutland 2017-11-27 16:38 ` [PATCHv2 12/12] arm64: docs: document " Mark Rutland 2017-11-28 15:07 ` Andrew Jones 2017-12-04 12:39 ` Mark Rutland 2017-12-04 12:49 ` Andrew Jones [this message]
Reply instructions: You may reply publically 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=20171204124931.wg3wmgvzedayprql@kamzik.brq.redhat.com \ --to=drjones@redhat.com \ --cc=arnd@arndb.de \ --cc=awallis@codeaurora.org \ --cc=catalin.marinas@arm.com \ --cc=cdall@linaro.org \ --cc=kernel-hardening@lists.openwall.com \ --cc=kvmarm@lists.cs.columbia.edu \ --cc=linux-arch@vger.kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=marc.zyngier@arm.com \ --cc=mark.rutland@arm.com \ --cc=will.deacon@arm.com \ --cc=yao.qi@arm.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
LKML Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \ linux-kernel@vger.kernel.org public-inbox-index lkml Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git