Re: [PATCH v2 2/2] kunit: enable hardware acceleration when available

2024-11-05 Thread Kristina Martsenko
On 02/11/2024 12:09, Tamir Duberstein wrote: > Use KVM or HVF if supported by the QEMU binary and available on the > system. > > This produces a nice improvement on my Apple M3 Pro running macOS 14.7: > > Before: > ./tools/testing/kunit/kunit.py exec --arch arm64 > [HH:MM:SS] Elapsed time: 10.145

Re: [PATCH v5 2/5] arm64/kvm: preserve host HCR_EL2/MDCR_EL2 value

2019-02-15 Thread Kristina Martsenko
On 14/02/2019 11:03, Amit Daniel Kachhap wrote: > Hi, > > On 2/13/19 11:04 PM, Kristina Martsenko wrote: >> On 28/01/2019 06:58, Amit Daniel Kachhap wrote: >>> When restoring HCR_EL2 for the host, KVM uses HCR_HOST_VHE_FLAGS, which >>> is a constant value. This

Re: [PATCH v5 5/5] arm64/kvm: control accessibility of ptrauth key registers

2019-02-13 Thread Kristina Martsenko
> Cc: Christoffer Dall > Cc: Marc Zyngier > Cc: Kristina Martsenko > Cc: kvm...@lists.cs.columbia.edu > Cc: Ramana Radhakrishnan > Cc: Will Deacon > --- > Documentation/arm64/pointer-authentication.txt | 3 ++ > arch/arm64/kvm/sys_regs.c | 42 &g

Re: [PATCH v5 4/5] arm64/kvm: add a userspace option to enable pointer authentication

2019-02-13 Thread Kristina Martsenko
On 28/01/2019 06:58, Amit Daniel Kachhap wrote: > This feature will allow the KVM guest to allow the handling of > pointer authentication instructions or to treat them as undefined > if not set. It uses the existing vcpu API KVM_ARM_VCPU_INIT to > supply this parameter instead of creating a new API

Re: [PATCH v5 3/5] arm64/kvm: context-switch ptrauth registers

2019-02-13 Thread Kristina Martsenko
Hi Amit, (Please always Cc: everyone who commented on previous versions of the series.) On 28/01/2019 06:58, Amit Daniel Kachhap wrote: > When pointer authentication is supported, a guest may wish to use it. > This patch adds the necessary KVM infrastructure for this to work, with > a semi-lazy c

Re: [PATCH v5 3/5] arm64/kvm: context-switch ptrauth register

2019-02-13 Thread Kristina Martsenko
On 31/01/2019 16:25, James Morse wrote: > Hi Amit, > > On 28/01/2019 06:58, Amit Daniel Kachhap wrote: >> When pointer authentication is supported, a guest may wish to use it. >> This patch adds the necessary KVM infrastructure for this to work, with >> a semi-lazy context switch of the pointer au

Re: [PATCH v5 2/5] arm64/kvm: preserve host HCR_EL2/MDCR_EL2 value

2019-02-13 Thread Kristina Martsenko
On 28/01/2019 06:58, Amit Daniel Kachhap wrote: > When restoring HCR_EL2 for the host, KVM uses HCR_HOST_VHE_FLAGS, which > is a constant value. This works today, as the host HCR_EL2 value is > always the same, but this will get in the way of supporting extensions > that require HCR_EL2 bits to be

Re: [PATCH v5 1/5] arm64: Add utilities to save restore pointer authentication keys

2019-02-13 Thread Kristina Martsenko
On 31/01/2019 16:20, James Morse wrote: > Hi Amit, > > On 28/01/2019 06:58, Amit Daniel Kachhap wrote: >> The keys can be switched either inside an assembly or such >> functions which do not have pointer authentication checks, so a GCC >> attribute is added to enable it. >> >> A function ptrauth_k

Re: [PATCH v6 04/13] arm64/kvm: hide ptrauth from guests

2018-12-10 Thread Kristina Martsenko
On 10/12/2018 20:22, Richard Henderson wrote: > On 12/10/18 2:12 PM, Kristina Martsenko wrote: >> The plan was to disable trapping, yes. However, after that thread there >> was a retrospective change applied to the architecture, such that the >> XPACLRI (and XPACD/XPACI) instr

Re: [PATCH v6 04/13] arm64/kvm: hide ptrauth from guests

2018-12-10 Thread Kristina Martsenko
On 09/12/2018 14:53, Richard Henderson wrote: > On 12/7/18 12:39 PM, Kristina Martsenko wrote: >> From: Mark Rutland >> >> In subsequent patches we're going to expose ptrauth to the host kernel >> and userspace, but things are a bit trickier for guest kernels. F

Re: [PATCH v6 02/13] arm64: add pointer authentication register bits

2018-12-10 Thread Kristina Martsenko
On 09/12/2018 14:24, Richard Henderson wrote: > On 12/7/18 12:39 PM, Kristina Martsenko wrote: >> #define SCTLR_ELx_DSSBS (1UL << 44) >> +#define SCTLR_ELx_ENIA (1 << 31) > > 1U or 1UL lest you produce signed -0x8000. Thanks, this was setting all S

[PATCH v6 12/13] arm64: enable pointer authentication

2018-12-07 Thread Kristina Martsenko
From: Mark Rutland Now that all the necessary bits are in place for userspace, add the necessary Kconfig logic to allow this to be enabled. Signed-off-by: Mark Rutland Signed-off-by: Kristina Martsenko Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/Kconfig | 23

[PATCH v6 11/13] arm64: add ptrace regsets for ptrauth key management

2018-12-07 Thread Kristina Martsenko
-by: Kristina Martsenko --- arch/arm64/include/uapi/asm/ptrace.h | 18 + arch/arm64/kernel/ptrace.c | 72 include/uapi/linux/elf.h | 2 + 3 files changed, 92 insertions(+) diff --git a/arch/arm64/include/uapi/asm/ptrace.h b/arch

[PATCH v6 10/13] arm64: add prctl control for resetting ptrauth keys

2018-12-07 Thread Kristina Martsenko
Add an arm64-specific prctl to allow a thread to reinitialize its pointer authentication keys to random values. This can be useful when exec() is not used for starting new processes, to ensure that different processes still have different keys. Signed-off-by: Kristina Martsenko --- arch/arm64

[PATCH v6 09/13] arm64: perf: strip PAC when unwinding userspace

2018-12-07 Thread Kristina Martsenko
used. This only affects the LR value, and not the FP. This only affects the in-kernel unwinder. When userspace performs unwinding, it is up to userspace to strip PACs as necessary (which can be determined from DWARF information). Signed-off-by: Mark Rutland Signed-off-by: Kristina Martsenko Cc: Ca

[PATCH v6 13/13] arm64: docs: document pointer authentication

2018-12-07 Thread Kristina Martsenko
From: Mark Rutland Now that we've added code to support pointer authentication, add some documentation so that people can figure out if/how to use it. Signed-off-by: Mark Rutland Signed-off-by: Kristina Martsenko Reviewed-by: Ramana Radhakrishnan Cc: Andrew Jones Cc: Catalin Marina

[PATCH v6 07/13] arm64: add basic pointer authentication support

2018-12-07 Thread Kristina Martsenko
). Signed-off-by: Mark Rutland Signed-off-by: Kristina Martsenko Tested-by: Adam Wallis Cc: Catalin Marinas Cc: Ramana Radhakrishnan Cc: Suzuki K Poulose Cc: Will Deacon --- arch/arm64/include/asm/pointer_auth.h | 75 +++ arch/arm64/include/asm/thread_info.h

[PATCH v6 08/13] arm64: expose user PAC bit positions via ptrace

2018-12-07 Thread Kristina Martsenko
support, and the address authentication feature is enabled. Otherwise, the regset is hidden. Signed-off-by: Mark Rutland Signed-off-by: Kristina Martsenko Cc: Catalin Marinas Cc: Ramana Radhakrishnan Cc: Will Deacon --- arch/arm64/include/asm/pointer_auth.h | 8 arch/arm64/include/uapi

[PATCH v6 06/13] arm64/cpufeature: detect pointer authentication

2018-12-07 Thread Kristina Martsenko
cks for both address and generic authentication, separately. It is assumed that if all CPUs support an IMP DEF algorithm, the same algorithm is used across all CPUs. Signed-off-by: Mark Rutland Signed-off-by: Kristina Martsenko Cc: Catalin Marinas Cc: Suzuki K Poulose Cc: Will Deacon --- a

[PATCH v6 05/13] arm64: Don't trap host pointer auth use to EL2

2018-12-07 Thread Kristina Martsenko
etting them. This does not enable support for KVM guests, since KVM manages HCR_EL2 itself when running VMs. Signed-off-by: Mark Rutland Signed-off-by: Kristina Martsenko Acked-by: Christoffer Dall Cc: Catalin Marinas Cc: Marc Zyngier Cc: Will Deacon Cc: kvm...@lists.cs.columbia.edu --- arch

[PATCH v6 03/13] arm64/kvm: consistently handle host HCR_EL2 flags

2018-12-07 Thread Kristina Martsenko
Signed-off-by: Mark Rutland Signed-off-by: Kristina Martsenko Reviewed-by: Christoffer Dall Cc: Catalin Marinas Cc: Marc Zyngier Cc: Will Deacon Cc: kvm...@lists.cs.columbia.edu --- arch/arm64/include/asm/kvm_arm.h | 1 + arch/arm64/kernel/head.S | 5 ++--- arch/arm64/kvm/hyp/switch.

[PATCH v6 04/13] arm64/kvm: hide ptrauth from guests

2018-12-07 Thread Kristina Martsenko
attempt to use ptrauth instructions, triggering a trap to EL2, resulting in noise from kvm_handle_unknown_ec(). So let's write up a handler for the PAC trap, which silently injects an UNDEF into the guest, as if the feature were really missing. Signed-off-by: Mark Rutland Signed-off-by: Kri

[PATCH v6 00/13] ARMv8.3 pointer authentication userspace support

2018-12-07 Thread Kristina Martsenko
/mark/boot-wrapper-aarch64.git Kristina Martsenko (3): arm64: add comments about EC exception levels arm64: add prctl control for resetting ptrauth keys arm64: add ptrace regsets for ptrauth key management Mark Rutland (10): arm64: add pointer authentication register bits arm64/kvm

[PATCH v6 01/13] arm64: add comments about EC exception levels

2018-12-07 Thread Kristina Martsenko
To make it clear which exceptions can't be taken to EL1 or EL2, add comments next to the ESR_ELx_EC_* macro definitions. Signed-off-by: Kristina Martsenko --- arch/arm64/include/asm/esr.h | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm64/includ

[PATCH v6 02/13] arm64: add pointer authentication register bits

2018-12-07 Thread Kristina Martsenko
functionality. * A new ESR_ELx.EC code used when the new instructions are affected by configurable traps This patch adds the relevant definitions to and for these, to be used by subsequent patches. Signed-off-by: Mark Rutland Signed-off-by: Kristina Martsenko Cc: Catalin Marinas Cc: Marc

Re: [PATCH v5 11/17] arm64: docs: document pointer authentication

2018-10-19 Thread Kristina Martsenko
On 19/10/2018 12:35, Catalin Marinas wrote: > On Tue, Oct 16, 2018 at 05:14:39PM +0100, Kristina Martsenko wrote: >> On 05/10/2018 10:04, Ramana Radhakrishnan wrote: >>> On 05/10/2018 09:47, Kristina Martsenko wrote: >>>> +Virtualization >>>> +---

Re: [RFC 17/17] arm64: compile the kernel with ptrauth -msign-return-address

2018-10-11 Thread Kristina Martsenko
On 05/10/2018 10:01, Ramana Radhakrishnan wrote: > On 05/10/2018 09:47, Kristina Martsenko wrote: >> Compile all functions with two ptrauth instructions: paciasp in the >> prologue to sign the return address, and autiasp in the epilogue to >> authenticate the return addr

[RFC 17/17] arm64: compile the kernel with ptrauth -msign-return-address

2018-10-05 Thread Kristina Martsenko
auth for both userspace and the kernel. Signed-off-by: Mark Rutland Signed-off-by: Kristina Martsenko --- arch/arm64/Makefile | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 106039d25e2f..dbcd43ea99d8 100644 --- a/arch/arm64/Makefile +++ b

[RFC 16/17] arm64: initialize and switch ptrauth kernel keys

2018-10-05 Thread Kristina Martsenko
-by: Kristina Martsenko --- arch/arm64/include/asm/pointer_auth.h | 9 - arch/arm64/include/asm/ptrauth-asm.h | 13 + arch/arm64/include/asm/thread_info.h | 1 + arch/arm64/kernel/asm-offsets.c | 1 + arch/arm64/kernel/entry.S | 4 arch/arm64/kernel

[RFC 15/17] arm64: enable ptrauth earlier

2018-10-05 Thread Kristina Martsenko
cpu_enable callback, to avoid compiling the whole callchain down to cpu_enable without pointer auth. Note the change in behavior: if the boot CPU has pointer auth and a late CPU does not, we panic. Until now we would have just disabled pointer auth in this case. Signed-off-by: Kristina Martsenko

[RFC 14/17] arm64: unwind: strip PAC from kernel addresses

2018-10-05 Thread Kristina Martsenko
: Kristina Martsenko --- arch/arm64/include/asm/pointer_auth.h | 10 +++--- arch/arm64/kernel/ptrace.c| 2 +- arch/arm64/kernel/stacktrace.c| 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/pointer_auth.h b/arch/arm64/include