From: sashiko-bot@kernel.org
To: "Steffen Eiden" <seiden@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
kvmarm@lists.linux.dev, "Vasily Gorbik" <gor@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
kvm@vger.kernel.org, "Alexander Gordeev" <agordeev@linux.ibm.com>,
"Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH v2 20/20] s390: Report AEF features to sysfs
Date: Mon, 31 Aug 2026 22:43:47 +0000 [thread overview]
Message-ID: <20260831224348.3C97B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831145536.913567-21-seiden@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [High] aef_init_save_area() unconditionally executes the 'qaaf' hardware instruction without checking for hardware support, causing a boot failure or kernel panic on unsupported hosts.
- [Medium] Missing error code assignment when kset_create_and_add() fails, resulting in a false success return.
Pre-existing issues:
- [High] The EX_TABLE entry in the qaaf() inline assembly incorrectly protects the non-faulting lhi instruction instead of the potentially faulting .insn instruction.
--
commit 90a00cf465554d5bd4e3bc2a83bb5b6d1a27209d
Author: Steffen Eiden <seiden@linux.ibm.com>
s390: Report AEF features to sysfs
Display various information about the Arm execution Facility (AEF) to
userspace. The files are located in /sys/firmware/aef/. Show if the
feature is available and usable for the host, which formats are
available, and how many arm vCPUS per guest are supported by the
machine. Additionally, provide the raw binary output of QAAF fc1 (Query
Model Capabilities) in the file qmc and fc2 (Initial
System-Registers-Save Area) in the file save_area.
> diff --git a/arch/s390/kernel/aef.c b/arch/s390/kernel/aef.c
> index 825e2643a8921..2691f1ac63dca 100644
> --- a/arch/s390/kernel/aef.c
> +++ b/arch/s390/kernel/aef.c
[ ... ]
> @@ -40,6 +40,66 @@ const struct aef_info *aef_info(void)
> }
> EXPORT_SYMBOL(aef_info);
>
[ ... ]
> +static int __init aef_init_save_area(void)
> +{
> + int ret;
> +
> + union qaaf_gr0_gisrsa gr0 = {
> + .fc = QAAF_FC_GISRSA,
> + .saf = SAE_SAVE_AREA_FORMAT_0,
> + };
> +
> + ret = qaaf(gr0.val, (union qaaf_block *)&save_area);
[Severity: High]
Does aef_init_save_area() need to check if info.sae_avail is set before
executing qaaf()?
If aef_query_info() early returns success when the AEF feature is unsupported,
aef_init_save_area() executes the qaaf instruction unconditionally. This
will cause a boot failure or kernel panic on unsupported hosts.
[Severity: High]
This is a pre-existing issue, but this call unconditionally triggers a kernel
panic on older hardware due to an issue with the qaaf() inline assembly.
arch/s390/include/asm/sae.h:qaaf() {
...
asm volatile(
" lgr 0,%[r0]\n"
" .insn rre,0xb9ad0000,%[r1],0\n"
"0: lhi %[exc],0\n"
"1:\n"
EX_TABLE(0b, 1b)
...
}
The EX_TABLE entry incorrectly protects the non-faulting lhi instruction (label
0:) instead of the preceding, potentially faulting .insn instruction. When qaaf
faults, the exception table misses it, resulting in an unhandled hardware
exception.
> + if (ret)
> + return ret;
> +
> + return 0;
> +}
[ ... ]
> @@ -95,7 +155,33 @@ static int __init aef_sysfs_init(void)
> if (rc)
> return rc;
>
> + aef_kobj = kobject_create_and_add("aef", firmware_kobj);
> + if (!aef_kobj)
> + return -ENOMEM;
> +
> + rc = sysfs_create_file(aef_kobj, aef_sysfs_qval_attr(arm_guest_supp));
> + if (rc)
> + goto out_kobj;
> +
> + aef_query_kset = kset_create_and_add("query", NULL, aef_kobj);
> + if (!aef_query_kset)
> + goto out_arm_guest_supp;
[Severity: Medium]
Will this error path in aef_sysfs_init() return a false success?
If kset_create_and_add() fails due to memory exhaustion, the local variable
'rc' remains 0 from the successful sysfs_create_file() call above. The initcall
will report success despite failing to create the sysfs structure.
> +
> + rc = sysfs_create_group(&aef_query_kset->kobj, &aef_query_attr_group);
> + if (rc)
> + goto out_kset;
> +
> return 0;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831145536.913567-1-seiden@linux.ibm.com?part=20
prev parent reply other threads:[~2026-08-31 22:43 UTC|newest]
Thread overview: 41+ 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-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-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-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-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-08-31 14:55 ` [PATCH v2 07/20] KVM: arm64: Share more arm64 code " Steffen Eiden
2026-08-31 19:01 ` sashiko-bot
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-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
2026-08-31 14:55 ` [PATCH v2 20/20] s390: Report AEF features to sysfs Steffen Eiden
2026-08-31 22:43 ` sashiko-bot [this message]
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=20260831224348.3C97B1F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox