From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Oliver Upton <oliver.upton@linux.dev>,
Marc Zyngier <maz@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.15 11/69] KVM: arm64: Prevent access to vCPU events before init
Date: Mon, 31 Aug 2026 15:34:44 +0200 [thread overview]
Message-ID: <20260831133359.072287714@linuxfoundation.org> (raw)
In-Reply-To: <20260831133358.601894154@linuxfoundation.org>
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Upton <oliver.upton@linux.dev>
[ Upstream commit 0aa1b76fe1429629215a7c79820e4b96233ac4a3 ]
Another day, another syzkaller bug. KVM erroneously allows userspace to
pend vCPU events for a vCPU that hasn't been initialized yet, leading to
KVM interpreting a bunch of uninitialized garbage for routing /
injecting the exception.
In one case the injection code and the hyp disagree on whether the vCPU
has a 32bit EL1 and put the vCPU into an illegal mode for AArch64,
tripping the BUG() in exception_target_el() during the next injection:
kernel BUG at arch/arm64/kvm/inject_fault.c:40!
Internal error: Oops - BUG: 00000000f2000800 [#1] SMP
CPU: 3 UID: 0 PID: 318 Comm: repro Not tainted 6.17.0-rc4-00104-g10fd0285305d #6 PREEMPT
Hardware name: linux,dummy-virt (DT)
pstate: 21402009 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
pc : exception_target_el+0x88/0x8c
lr : pend_serror_exception+0x18/0x13c
sp : ffff800082f03a10
x29: ffff800082f03a10 x28: ffff0000cb132280 x27: 0000000000000000
x26: 0000000000000000 x25: ffff0000c2a99c20 x24: 0000000000000000
x23: 0000000000008000 x22: 0000000000000002 x21: 0000000000000004
x20: 0000000000008000 x19: ffff0000c2a99c20 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 00000000200000c0
x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
x8 : ffff800082f03af8 x7 : 0000000000000000 x6 : 0000000000000000
x5 : ffff800080f621f0 x4 : 0000000000000000 x3 : 0000000000000000
x2 : 000000000040009b x1 : 0000000000000003 x0 : ffff0000c2a99c20
Call trace:
exception_target_el+0x88/0x8c (P)
kvm_inject_serror_esr+0x40/0x3b4
__kvm_arm_vcpu_set_events+0xf0/0x100
kvm_arch_vcpu_ioctl+0x180/0x9d4
kvm_vcpu_ioctl+0x60c/0x9f4
__arm64_sys_ioctl+0xac/0x104
invoke_syscall+0x48/0x110
el0_svc_common.constprop.0+0x40/0xe0
do_el0_svc+0x1c/0x28
el0_svc+0x34/0xf0
el0t_64_sync_handler+0xa0/0xe4
el0t_64_sync+0x198/0x19c
Code: f946bc01 b4fffe61 9101e020 17fffff2 (d4210000)
Reject the ioctls outright as no sane VMM would call these before
KVM_ARM_VCPU_INIT anyway. Even if it did the exception would've been
thrown away by the eventual reset of the vCPU's state.
Cc: stable@vger.kernel.org # 6.17
Fixes: b7b27facc7b5 ("arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS")
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/kvm/arm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 5ca8782edb960..ca69ae7f86d70 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -1313,6 +1313,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
case KVM_GET_VCPU_EVENTS: {
struct kvm_vcpu_events events;
+ if (!kvm_vcpu_initialized(vcpu))
+ return -ENOEXEC;
+
if (kvm_arm_vcpu_get_events(vcpu, &events))
return -EINVAL;
@@ -1324,6 +1327,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
case KVM_SET_VCPU_EVENTS: {
struct kvm_vcpu_events events;
+ if (!kvm_vcpu_initialized(vcpu))
+ return -ENOEXEC;
+
if (copy_from_user(&events, argp, sizeof(events)))
return -EFAULT;
--
2.53.0
next prev parent reply other threads:[~2026-08-31 14:02 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 13:34 [PATCH 5.15 00/69] 5.15.220-rc1 review Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 01/69] RDMA/rxe: Fix OOB in free_rd_atomic_resources() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 02/69] ext4: dont enable DAX on new encrypted files Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 03/69] io_uring/io-wq: fix worker accounting when canceling creation callbacks Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 04/69] ipvs: reload ip header after head reallocation Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 05/69] bpf: Remove tst_run from lwt_seg6local_prog_ops Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 06/69] jfs: add check read-only before truncation in jfs_truncate_nolock() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 07/69] jfs: add check read-only before txBeginAnon() call Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 08/69] can: j1939: implement NETDEV_UNREGISTER notification handler Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 09/69] can: j1939: add missing calls in " Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 10/69] can: j1939: make j1939_sk_bind() fail if device is no longer registered Greg Kroah-Hartman
2026-08-31 13:34 ` Greg Kroah-Hartman [this message]
2026-08-31 13:34 ` [PATCH 5.15 12/69] bpf: Fix use-after-free in offloaded map/prog info fill Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 13/69] Revert "PM: sleep: Use complete() in device_pm_sleep_init()" Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 14/69] smc: Use __sk_dst_get() and dst_dev_rcu() in smc_vlan_by_tcpsk() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 15/69] selinux: switch two allocations to use kzalloc_objs() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 16/69] Revert "mtd: maps: vmu-flash: fix fault in unaligned fixup" Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 17/69] Revert "smb: client: use kvzalloc() for megabyte buffer in simple fallocate" Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 18/69] ALSA: pcm: fix wait_time calculations Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 19/69] ASoC: tegra: Fix Master Volume Control Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 20/69] ALSA: pcm: fix use-after-free on linked stream runtime in snd_pcm_drain() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 21/69] ALSA: PCM: Fix wait queue list corruption in snd_pcm_drain() on linked streams Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 22/69] ipv4: igmp: Fix potential UAF in igmp_gq_start_timer() Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 23/69] kcov: replace local_irq_save() with a local_lock_t Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 24/69] kcov: fix data corruption and race conditions on PREEMPT_RT Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 25/69] ext4: propagate errors from fast commit range replay Greg Kroah-Hartman
2026-08-31 13:34 ` [PATCH 5.15 26/69] nilfs2: correct return value kernel-doc descriptions for ioctl functions Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 27/69] nilfs2: reject invalid block index in GC ioctl Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 28/69] nfc: nci: add data_len bound checks to activation parameter extractors Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 29/69] HID: magicmouse: prevent unbounded recursion in magicmouse_raw_event() Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 30/69] nvme: rename CDR/MORE/DNR to NVME_STATUS_* Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 31/69] nvmet-tcp: bound SGL data length before allocating command buffers Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 32/69] HID: uclogic: fix use-after-free of inrange_timer on remove Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 33/69] HID: ft260: fix i2c probing for hwmon devices Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 34/69] HID: ft260: improve i2c write performance Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 35/69] HID: ft260: improve i2c large reads performance Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 36/69] HID: ft260: skip unexpected HID input reports Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 37/69] HID: ft260: wake up device from power saving mode Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 38/69] HID: ft260: missed NACK from busy device Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 39/69] HID: ft260: validate i2c input report length Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 40/69] HID: ft260: fix stack-use-after-return write in I2C read race Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 41/69] HID: input: read battery capacity from its actual report offset Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 42/69] fpga: dfl: fme: add error handling Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 43/69] accessibility: speakup: unregister tty ldisc on later init failures Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 44/69] xhci: dbgtty: Fix unregister on tty_register_driver() failure Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 45/69] xhci: dbgtty: Fix unregister on tty_alloc_driver() failure Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 46/69] fuse: fix invalidate lock leak on setattr writeback failure Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 47/69] fuse: fix invalidate lock leak on open O_TRUNC DAX failure Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 48/69] usb: usbtest: disable dynamic ID support Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 49/69] usb: gadget: f_tcm: keep port count until LUN teardown completes Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 50/69] xfrm: espintcp: fix UAF during close Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 51/69] xfrm: drop ESP-in-TCP packets with no ingress device Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 52/69] xfrm: ah6: validate routing header segments_left Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 53/69] xfrm: fix xfrm_state_construct() auth-trunc leak Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 54/69] net: bridge: mcast: fix use-after-free of a master VLANs multicast context Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 55/69] ipv6: seg6: clear IPv4 control block on IPIP decapsulation Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 56/69] mm/swap: reject swapon() on filesystem-level encrypted files Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 57/69] crypto: atmel-tdes - use scatterlist length before DMA mapping Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 58/69] crypto: qce - fix CCM AAD buffer underallocation Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 59/69] crypto: mxs-dcp - fix source scatterlist length access Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 60/69] crypto: qce - Remove unsafe/deprecated algorithms Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 61/69] KVM: s390: vsie: zero stale crypto bits Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 62/69] usb: core: Add lock to usb_wakeup_notification() Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 63/69] usb: core: Strengthen error handling in hub_hub_status() Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 64/69] ALSA: usb-audio: fix OOB write in snd_usbmidi_novation_output() Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 65/69] ALSA: usb-audio: Complete cleanup after system-resume errors Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 66/69] USB: serial: option: fix slab OOB read in interrupt URB callback Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 67/69] USB: serial: spcp8x5: drop broken carrier detect support Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 68/69] USB: c67x00: fix use-after-free in c67x00_add_iso_urb() Greg Kroah-Hartman
2026-08-31 13:35 ` [PATCH 5.15 69/69] usb: usbfs: fix use-after-free of usb_device in usbdev_release() Greg Kroah-Hartman
2026-08-31 17:25 ` [PATCH 5.15 00/69] 5.15.220-rc1 review Florian Fainelli
2026-08-31 19:12 ` Brett A C Sheffield
2026-09-01 4:56 ` Harshit Mogalapalli
2026-09-01 8:43 ` Pavel Machek
2026-09-01 16:47 ` Shuah Khan
2026-09-01 23:32 ` Ron Economos
2026-09-02 5:21 ` Barry K. Nathan
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=20260831133359.072287714@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=patches@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/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