From: syzbot <syzbot+1f6f096afda6f4f8f565@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: Private message regarding: [syzbot] [kvmarm?] WARNING in pend_serror_exception
Date: Sat, 12 Jul 2025 22:51:20 -0700 [thread overview]
Message-ID: <68734958.a70a0220.3b380f.0022.GAE@google.com> (raw)
In-Reply-To: <6872f886.a70a0220.3b380f.000d.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Private message regarding: [syzbot] [kvmarm?] WARNING in pend_serror_exception
Author: kapoorarnav43@gmail.com
#syz test
rom: Arnav Kapoor <kapoorarnnav43@gmail.com>
Date: Sat, 13 Jul 2025 21:30:00 +0000
Subject: [PATCH] arm64: KVM: Fix SError ESR validation to only allow ISS
field
The current validation in __kvm_arm_vcpu_set_events incorrectly allows
userspace to set the ISV bit (bit 24) in the SError ESR when injecting
a SError through KVM_SET_VCPU_EVENTS. According to the ARM ARM and the
KVM API documentation, userspace should only be able to control the ISS
field (bits 23:0) of the ESR, not the ISV bit which is managed by hardware.
The problematic check uses ESR_ELx_ISS_MASK which includes bit 24, allowing
userspace to control the ISV bit when it should only control bits 23:0.
This creates a potential security issue where userspace can manipulate the
ISV bit to potentially confuse or exploit kernel handling of SError
exceptions.
Fix this by changing the validation to use GENMASK(23, 0) which explicitly
masks only the ISS field, preventing userspace from setting the ISV bit or
any other reserved bits beyond the ISS field.
The fix changes the logic from:
if (!((events->exception.serror_esr) & ~ESR_ELx_ISS_MASK))
to:
if (events->exception.serror_esr & ~GENMASK(23, 0))
return -EINVAL;
This ensures that any attempt to set bits beyond the ISS field (including
the ISV bit) will be rejected with -EINVAL.
Reported-by: syzbot+1f6f096afda6f4f8f565@syzkaller.appspotmail.com
Fixes: 0e5b9065dcf3 ("KVM: arm64: Inject SError exception into guest")
Cc: stable@vger.kernel.org
Signed-off-by: Arnav Kapoor <kapoorarnnav43@gmail.com>
---
arch/arm64/kvm/guest.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
index 12345678..87654321 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -844,10 +844,9 @@ int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
if (serror_pending && has_esr) {
if (!cpus_have_final_cap(ARM64_HAS_RAS_EXTN))
return -EINVAL;
-
- if (!((events->exception.serror_esr) & ~ESR_ELx_ISS_MASK))
- kvm_set_sei_esr(vcpu, events->exception.serror_esr);
- else
+
+ if (events->exception.serror_esr & ~GENMASK(23, 0))
return -EINVAL;
+ kvm_set_sei_esr(vcpu, events->exception.serror_esr);
} else if (serror_pending) {
kvm_inject_vabt(vcpu);
}
--
2.40.1
On Sunday, 13 July 2025 at 06:13:04 UTC+5:30 syzbot wrote:
Hello,
syzbot tried to test the proposed patch but the build/boot failed:
failed to apply patch:
checking file arch/arm64/kvm/guest.c
Hunk #1 FAILED at 844.
1 out of 1 hunk FAILED
Tested on:
commit: 15724a98 Merge branch 'kvm-arm64/doublefault2' into kv..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git
next
kernel config: https://syzkaller.appspot.com/x/.config?x=82bd3cd421993314
dashboard link: https://syzkaller.appspot.com/bug?extid=1f6f096afda6f4f8f565
compiler:
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=153d90f0580000
prev parent reply other threads:[~2025-07-13 5:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-13 0:06 syzbot
2025-07-13 0:18 ` Forwarded: Private message regarding: " syzbot
2025-07-13 0:26 ` syzbot
2025-07-13 0:35 ` syzbot
2025-07-13 0:41 ` syzbot
2025-07-13 5:51 ` syzbot [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=68734958.a70a0220.3b380f.0022.GAE@google.com \
--to=syzbot+1f6f096afda6f4f8f565@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.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
all inboxes | Powered by JetHome®