From: sashiko-bot@kernel.org
To: "Fuad Tabba" <fuad.tabba@linux.dev>
Cc: "Marc Zyngier" <maz@kernel.org>,
"Oliver Upton" <oupton@kernel.org>,
kvmarm@lists.linux.dev
Subject: Re: [PATCH v3 2/2] KVM: arm64: selftests: Add MMIO sign-extending load test
Date: Mon, 06 Jul 2026 12:08:23 +0000 [thread overview]
Message-ID: <20260706120824.0853C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260706115522.954913-3-fuad.tabba@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test executes guest code at EL0 but fails to map the executable text segment with unprivileged access permissions (PTE_USER), causing an immediate Instruction Abort.
--
commit 8d8bc26c675634520d0cf6c2769677a38145f1a9
Author: Fuad Tabba <fuad.tabba@linux.dev>
KVM: arm64: selftests: Add MMIO sign-extending load test
Add a test for sign-extending MMIO loads (LDRSB, LDRSH, LDRSW) into Xt
and Wt destinations, with and without the sign bit set. The host supplies
the MMIO data and checks the guest register holds the sign-extended value.
> diff --git a/tools/testing/selftests/kvm/arm64/mmio_sign_ext.c b/tools/testing/selftests/kvm/arm64/mmio_sign_ext.c
> new file mode 100644
> --- /dev/null
> +++ b/tools/testing/selftests/kvm/arm64/mmio_sign_ext.c
[ ... ]
> +static void guest_code(void)
> +{
> + guest_loads_le();
> +
> + if (guest_mixed_endian_el0()) {
> + write_sysreg(read_sysreg(sctlr_el1) | SCTLR_EL1_E0E, sctlr_el1);
> + isb();
> +
> + asm volatile(
> + " msr elr_el1, %[pc]\n"
> + " msr spsr_el1, %[spsr]\n"
> + " mov x0, %[mmio]\n"
> + " isb\n"
> + " eret\n"
[ ... ]
> +int main(void)
> +{
> + struct kvm_vcpu *vcpu;
> + struct kvm_vm *vm;
> + struct ucall uc;
> + unsigned int i;
> + bool be;
> +
> + vm = vm_create_with_one_vcpu(&vcpu, guest_code);
> + virt_map(vm, MMIO_ADDR, MMIO_ADDR, 1);
> +
> + vm_init_descriptor_tables(vm);
> + vcpu_init_descriptor_tables(vcpu);
> + vm_install_sync_handler(vm, VECTOR_SYNC_LOWER_64, ESR_ELx_EC_SVC64,
> + el0_svc_handler);
> +
> + be = vcpu_mixed_endian_el0(vcpu);
> + if (be)
> + make_el0_accessible(vm, MMIO_ADDR, vm->page_size);
[Severity: Medium]
Will this cause an immediate Instruction Abort on hardware supporting
mixed endianness at EL0?
The MMIO address is made EL0-accessible here, but the code segment
containing el0_be_loads is not. KVM selftests map the test payload
(including the .text segment) as EL1-only by default (AP[1]=0).
When vcpu_mixed_endian_el0() is true, guest_code() drops to EL0 using eret
to execute el0_be_loads. Since the page containing el0_be_loads lacks
unprivileged access permissions (PTE_USER), the instruction fetch at EL0
will trigger a Permission Fault.
Should the page containing el0_be_loads also be made EL0-accessible here?
> +
> + ksft_print_header();
> + ksft_set_plan(ARRAY_SIZE(tests) * (be ? 2 : 1));
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260706115522.954913-1-fuad.tabba@linux.dev?part=2
next prev parent reply other threads:[~2026-07-06 12:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 11:55 [PATCH v3 0/2] KVM: arm64: Fix and test MMIO sign-extending loads Fuad Tabba
2026-07-06 11:55 ` [PATCH v3 1/2] KVM: arm64: Fix sign-extension of MMIO loads Fuad Tabba
2026-07-06 11:55 ` [PATCH v3 2/2] KVM: arm64: selftests: Add MMIO sign-extending load test Fuad Tabba
2026-07-06 12:08 ` sashiko-bot [this message]
2026-07-06 12:19 ` Fuad Tabba
2026-07-06 16:19 ` [PATCH v3 0/2] KVM: arm64: Fix and test MMIO sign-extending loads Marc Zyngier
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=20260706120824.0853C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=fuad.tabba@linux.dev \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.