From: sashiko-bot@kernel.org
To: "Steffen Eiden" <seiden@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Oliver Upton" <oupton@kernel.org>,
kvmarm@lists.linux.dev, "Vasily Gorbik" <gor@linux.ibm.com>,
"Marc Zyngier" <maz@kernel.org>,
kvm@vger.kernel.org
Subject: Re: [PATCH v2 19/20] KVM: s390: arm64: Promote PTRAUTH capability
Date: Mon, 31 Aug 2026 22:35:49 +0000 [thread overview]
Message-ID: <20260831223549.953B91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831145536.913567-20-seiden@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Missing PTRAUTH traps configuration causes guest crashes.
- [Low] Macro redefinition of 'vcpu_has_ptrauth' causes a build failure.
--
commit cda854ae1be029b75a496434857cbf27f60d5cc0
Author: Steffen Eiden <seiden@linux.ibm.com>
KVM: s390: arm64: Promote PTRAUTH capability
Promote the pointer authentication capability if supported by hardware.
> diff --git a/arch/s390/include/asm/kvm_host_arm64.h b/arch/s390/include/asm/kvm_host_arm64.h
> index 73eb09e98848f..32facf0457049 100644
> --- a/arch/s390/include/asm/kvm_host_arm64.h
> +++ b/arch/s390/include/asm/kvm_host_arm64.h
> @@ -32,6 +32,8 @@ bool cpus_have_final_cap(unsigned int num);
> #define KVM_HAVE_MMU_RWLOCK
> #define KVM_MAX_VCPUS 1
> #define KVM_S390_ARM64_IMPL_FEATURES ( \
> + BIT(KVM_ARM_VCPU_PTRAUTH_ADDRESS) | \
> + BIT(KVM_ARM_VCPU_PTRAUTH_GENERIC) | \
> BIT(KVM_ARM_VCPU_SVE) \
> )
[Severity: High]
Does promoting these PTRAUTH capabilities lead to a guest crash?
When a guest executes Pointer Authentication instructions, the hardware checks
the Hypervisor Configuration Register (HCR_EL2) bits HCR_API and HCR_APK.
Because vcpu_reset_hcr() hardcodes vcpu->arch.hcr_elz and omits these bits:
arch/s390/kvm/arm64/reset.c:vcpu_reset_hcr() {
vcpu->arch.hcr_elz = HCR_EL2_E2H | HCR_EL2_RW | HCR_EL2_AMO |
HCR_EL2_IMO | HCR_EL2_FMO | HCR_EL2_PTW;
/* traps */
vcpu->arch.hcr_elz |= HCR_EL2_TSC | HCR_EL2_TID1 | HCR_EL2_TID2 |
HCR_EL2_TID3 | HCR_EL2_TID4 | HCR_EL2_TID5 |
HCR_EL2_TIDCP | HCR_EL2_TLOR;
}
PTRAUTH instructions will unconditionally trap to the hypervisor with
ESR_ELx_EC_PAC. Since arm_exit_handlers[] lacks a handler for ESR_ELx_EC_PAC:
arch/s390/kvm/arm64/handle_exit.c:arm_exit_handlers[] = {
[0 ... ESR_ELx_EC_MAX] = kvm_handle_unknown_ec,
[ESR_ELx_EC_HVC64] = handle_hvc,
[ESR_ELx_EC_SYS64] = kvm_handle_sys_reg,
[ESR_ELx_EC_IABT_LOW] = kvm_handle_guest_abort,
[ESR_ELx_EC_DABT_LOW] = kvm_handle_guest_abort,
};
It seems the hypervisor will fall back to kvm_handle_unknown_ec(), injecting
an unexpected undefined instruction exception back to the guest and crashing
it. Should we configure the traps or add an exit handler before enabling this?
[ ... ]
> diff --git a/arch/s390/kvm/arm64/feature.h b/arch/s390/kvm/arm64/feature.h
> index 892cf8bcf3a12..c11ac0daa4287 100644
> --- a/arch/s390/kvm/arm64/feature.h
> +++ b/arch/s390/kvm/arm64/feature.h
> @@ -94,4 +94,9 @@ static inline u64 kvm_sae_irptc(void)
>
> bool system_supports_sve(void);
>
> +#define vcpu_has_ptrauth(vcpu) \
> + (vcpu_has_feature(vcpu, KVM_ARM_VCPU_PTRAUTH_ADDRESS) || \
> + vcpu_has_feature(vcpu, KVM_ARM_VCPU_PTRAUTH_GENERIC))
[Severity: Low]
Can this macro redefinition cause a build failure on s390?
Because the C files including this header (like arm.c and feature.c) also
include <linux/kvm_host.h>, they transitively include <arm64/kvm_host.h>.
Since CONFIG_ARM64_PTR_AUTH is not set on s390, <arm64/kvm_host.h> defines
vcpu_has_ptrauth(vcpu) as false.
Redefining it here without first using #undef vcpu_has_ptrauth might trigger
a -Wmacro-redefined warning, which breaks the build if -Werror is used.
> +bool system_has_full_ptr_auth(void);
> +
> #endif /* ARCH_S390_KVM_FEATURE_H */
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831145536.913567-1-seiden@linux.ibm.com?part=19
next prev parent reply other threads:[~2026-08-31 22:35 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 14:55 [PATCH v2 00/20] KVM: arm64 on s390 System Register Handling Steffen Eiden
2026-08-31 14:55 ` [PATCH v2 01/20] KVM: arm64: Refactor idreg caching into dedicated structure Steffen Eiden
2026-08-31 18:06 ` sashiko-bot
2026-08-31 14:55 ` [PATCH v2 02/20] KVM: arm64: Extract number of sys_reg_desc into a constant Steffen Eiden
2026-08-31 18:08 ` sashiko-bot
2026-09-01 7:48 ` Marc Zyngier
2026-08-31 14:55 ` [PATCH v2 03/20] arm64: sysreg: Define OSLSR_EL1_OSLK_MASK Steffen Eiden
2026-08-31 18:18 ` sashiko-bot
2026-09-01 7:51 ` Marc Zyngier
2026-09-01 9:25 ` Steffen Eiden
2026-09-02 7:49 ` Marc Zyngier
2026-08-31 14:55 ` [PATCH v2 04/20] arm64: Share more arm64 headers with s390 Steffen Eiden
2026-08-31 18:31 ` sashiko-bot
2026-09-01 8:08 ` Marc Zyngier
2026-08-31 14:55 ` [PATCH v2 05/20] KVM: s390: arm64: Prepare for sharing more arm64 code Steffen Eiden
2026-08-31 18:42 ` sashiko-bot
2026-09-01 8:15 ` Marc Zyngier
2026-08-31 14:55 ` [PATCH v2 06/20] KVM: arm64: Prepare sys_regs.c for sharing with s390 Steffen Eiden
2026-08-31 18:45 ` sashiko-bot
2026-09-01 8:17 ` Marc Zyngier
2026-09-01 9:29 ` Steffen Eiden
2026-08-31 14:55 ` [PATCH v2 07/20] KVM: arm64: Share more arm64 code " Steffen Eiden
2026-08-31 19:01 ` sashiko-bot
2026-09-01 8:30 ` Marc Zyngier
2026-08-31 14:55 ` [PATCH v2 08/20] s390: tools: Allow sharing arm64/kvm headers Steffen Eiden
2026-08-31 19:03 ` sashiko-bot
2026-08-31 14:55 ` [PATCH v2 09/20] s390: Introduce read/write ARM sysreg instructions Steffen Eiden
2026-08-31 19:16 ` sashiko-bot
2026-08-31 14:55 ` [PATCH v2 10/20] s390: Add functions to query arm guest time Steffen Eiden
2026-08-31 19:24 ` sashiko-bot
2026-08-31 14:55 ` [PATCH v2 11/20] KVM: s390: arm64: Query Available Arm features Steffen Eiden
2026-08-31 19:46 ` sashiko-bot
2026-09-01 11:44 ` Janosch Frank
2026-09-01 14:25 ` Steffen Eiden
2026-09-01 16:36 ` Janosch Frank
2026-08-31 14:55 ` [PATCH v2 12/20] KVM: s390: arm64: Implement feature sanitisation Steffen Eiden
2026-08-31 20:11 ` sashiko-bot
2026-08-31 14:55 ` [PATCH v2 13/20] KVM: s390: arm64: Implement arm sysreg managing infrastructure Steffen Eiden
2026-08-31 20:33 ` sashiko-bot
2026-08-31 14:55 ` [PATCH v2 14/20] KVM: s390: arm64: Integrate sysreg into the host Steffen Eiden
2026-08-31 21:15 ` sashiko-bot
2026-08-31 14:55 ` [PATCH v2 15/20] KVM: s390: arm64: Use QAAF init save area Steffen Eiden
2026-08-31 21:32 ` sashiko-bot
2026-08-31 14:55 ` [PATCH v2 16/20] KVM: s390: arm64: Implement exception injection Steffen Eiden
2026-08-31 21:38 ` sashiko-bot
2026-08-31 14:55 ` [PATCH v2 17/20] KVM: s390: arm64: Finalize page fault handling Steffen Eiden
2026-08-31 21:52 ` sashiko-bot
2026-08-31 14:55 ` [PATCH v2 18/20] KVM: s390: arm64: Implement SVE for arm guests Steffen Eiden
2026-08-31 22:16 ` sashiko-bot
2026-08-31 14:55 ` [PATCH v2 19/20] KVM: s390: arm64: Promote PTRAUTH capability Steffen Eiden
2026-08-31 22:35 ` sashiko-bot [this message]
2026-08-31 14:55 ` [PATCH v2 20/20] s390: Report AEF features to sysfs Steffen Eiden
2026-08-31 22:43 ` sashiko-bot
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=20260831223549.953B91F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-s390@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=seiden@linux.ibm.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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.