From nobody Tue Oct 7 06:57:52 2025 Received: from mail-il1-f207.google.com (mail-il1-f207.google.com [209.85.166.207]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96F3B1853 for ; Sun, 13 Jul 2025 00:18:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.207 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752365893; cv=none; b=FFfqFJMJlj1xdL3j+Av3A2HJE0KiawDAk/aHDDOjGsqw3MFLCryKZE9Sf8AoFgSmwSSBhU2WRPaZ1/Gppt2hgBllb1GMiN1T79cvYwUzF9YaliZ08k9e5HKMgyVNRor5EwusBiBptlmLe1X8W6wQ+M9xrhOJVlcSQMfhorAtcc0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752365893; c=relaxed/simple; bh=Hthcfaca7PpK8Z8xLt3lxHGkCe2s2agXQlmvOZ21HlQ=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=nJ+3eIGB1g88EwJDJPowPqL06jYMj8O2ODlF4Z8Xx1ieiHcNYzeXo5TzIn/3QO+VOGUK5W5mktt13CPjhKu5fSZjle4fpv27kXKXH7grzaW4aWx/95iIc3tewhp8Gqh8u9RqjnjRgkeZx0KYDFO/ip9LCns+4X0vh00nCgHjtwo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.166.207 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-il1-f207.google.com with SMTP id e9e14a558f8ab-3e059add15eso37465275ab.0 for ; Sat, 12 Jul 2025 17:18:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752365891; x=1752970691; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VoaGY1MZeQMxHNowKjU6To2/aSYirdx65b9Zfjncv9Y=; b=c3MekMd2rNhBr7YT4sVWjoAWaAVJOeqBLqYP7wqLXptqFvTzGoqqK3nba4XpquypT0 QP4H0qgNCtvgyv940QE5sTEeR69eFE6gaJYHif5f3W8Mu6F7Hy7wJd/SEbWp+a3HkiuR TarCMpmSICa5u/4407FCkNeRR0VhrpXGh5IqU/+iy3cSON8DAMtxos4xbXvSbbLNprz+ 4/i1WtISzh96JorA2aWJGAEnzrRvqA+qkEsDnuISCOl835mJsiXbVrkm/144RGQq51b1 zF/fmJmnD6U1deHRR94BySGgvnSEugi9OqaF/MQPTKt5OVy1hHalpIoPCtud5tfWMJ2r PVtQ== X-Gm-Message-State: AOJu0YwD22j7ysRIBEcu4ygsTHN3CzWl1I307SAmp7JGTyiVmrYyLfFx ZdNAGdjB7jxq/bKE5qidnXUku94RoB0+feiNO5ec7768TYEUFM3Sqz6TJv64kNuPcsn27Cihjjc uo4uIUoXnfyej7HJ0Zcm8BgCUKRQEH8drkI9xDBAq+dFBWrmjyYuYjuAF5THtvQ== X-Google-Smtp-Source: AGHT+IFYYP4paa5lmwhURS8tFyxMZTMJ4LsS279zsrl+IV6tJtA/jaGUjUPh3xui9aNNiOk73jA8qvg8B/9xBvGsk411eMstdUZF Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a92:ca4b:0:b0:3de:12ff:3617 with SMTP id e9e14a558f8ab-3e253325ab9mr83392975ab.15.1752365890706; Sat, 12 Jul 2025 17:18:10 -0700 (PDT) Date: Sat, 12 Jul 2025 17:18:10 -0700 In-Reply-To: <6872f886.a70a0220.3b380f.000d.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6872fb42.a70a0220.3b380f.0010.GAE@google.com> Subject: Forwarded: Private message regarding: [syzbot] [kvmarm?] WARNING in pend_serror_exception From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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_serr= or_exception Author: kapoorarnav43@gmail.com #syz test From: Arnav Kapoor Date: Fri, 27 Dec 2024 02:35:00 +0000 Subject: [PATCH] arm64: KVM: Fix SError ESR validation to only allow ISS=20 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: if (!((events->exception.serror_esr) & ~ESR_ELx_ISS_MASK)) kvm_set_sei_esr(vcpu, events->exception.serror_esr); else return -EINVAL; allows the ISV bit because ESR_ELx_ISS_MASK includes bit 24 (GENMASK(24,0)). However, the ISV bit should be set only by KVM itself when calling=20 kvm_set_sei_esr(), and userspace should not be able to control it. Fix this by changing the validation to only allow bits 23:0 (the actual ISS field without the ISV bit): if (events->exception.serror_esr & ~GENMASK(23, 0)) return -EINVAL; This prevents userspace from setting reserved bits and the ISV bit while still allowing control over the intended ISS field. The condition is simplified since we now have a straightforward check for invalid bits. Reported-by: syzbot+92be0215d467e7deb043@syzkaller.appspotmail.com Fixes: 0e5b9065dcf3 ("KVM: arm64: Inject SError exception into guest") Signed-off-by: Arnav Kapoor Reported-by: syzbot+1f6f09...@syzkaller.appspotmail.com=20 --- arch/arm64/kvm/guest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 123456..789012 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -843,7 +843,7 @@ 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)) + if (events->exception.serror_esr & ~GENMASK(23, 0)) + return -EINVAL; + + kvm_set_sei_esr(vcpu, events->exception.serror_esr); On Sunday, 13 July 2025 at 05:36:31 UTC+5:30 syzbot wrote: Hello,=20 syzbot found the following issue on:=20 HEAD commit: 15724a984643 Merge branch 'kvm-arm64/doublefault2' into kv..=20 git tree: git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git=20 next=20 console output: https://syzkaller.appspot.com/x/log.txt?x=3D123090f0580000=20 kernel config: https://syzkaller.appspot.com/x/.config?x=3D82bd3cd421993314=20 dashboard link: https://syzkaller.appspot.com/bug?extid=3D1f6f096afda6f4f8f= 565=20 compiler: Debian clang version 20.1.7=20 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD=20 20.1.7=20 userspace arch: arm64=20 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=3D1324fe8c580000=20 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=3D1206ed82580000=20 Downloadable assets:=20 disk image (non-bootable):=20 https://storage.googleapis.com/syzbot-assets/fa3fbcfdac58/non_bootable_disk= -15724a98.raw.xz=20 vmlinux:=20 https://storage.googleapis.com/syzbot-assets/ec0f03d375a1/vmlinux-15724a98.= xz=20 kernel image:=20 https://storage.googleapis.com/syzbot-assets/a36232f8c6dd/Image-15724a98.gz= .xz=20 IMPORTANT: if you fix the issue, please add the following tag to the=20 commit:=20 Reported-by: syzbot+1f6f09...@syzkaller.appspotmail.com=20 ------------[ cut here ]------------=20 WARNING: CPU: 0 PID: 3603 at arch/arm64/kvm/inject_fault.c:71=20 pend_serror_exception+0x19c/0x5ac arch/arm64/kvm/inject_fault.c:71=20 Modules linked in:=20 CPU: 0 UID: 0 PID: 3603 Comm: syz.2.16 Not tainted=20 6.16.0-rc3-syzkaller-g15724a984643 #0 PREEMPT=20 Hardware name: linux,dummy-virt (DT)=20 pstate: 81402009 (Nzcv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=3D--)=20 pc : pend_serror_exception+0x19c/0x5ac arch/arm64/kvm/inject_fault.c:71=20 lr : pend_serror_exception+0x19c/0x5ac arch/arm64/kvm/inject_fault.c:71=20 sp : ffff80008e807930=20 x29: ffff80008e807930 x28: d7f0000016ae8028 x27: 0000000000000001=20 x26: 0000000000000000 x25: 0000000000000001 x24: 00000000000000d7=20 x23: d7f0000016ae82a8 x22: 00000000000000d7 x21: d7f0000016ae8e81=20 x20: 0000000000000007 x19: efff800000000000 x18: 0000000000000000=20 x17: 000000000000005a x16: ffff800080011d9c x15: 0000000020000200=20 x14: ffffffffffffffff x13: 0000000000000028 x12: 0000000000000081=20 x11: 81f000001f049564 x10: 0000000000ff0100 x9 : 0000000000000000=20 x8 : 81f000001f048000 x7 : ffff800080b08704 x6 : ffff80008e807a88=20 x5 : ffff80008e807a88 x4 : 0000000000000001 x3 : ffff8000801a2e80=20 x2 : 0000000000000000 x1 : 0000000000000002 x0 : 0000000000000000=20 Call trace:=20 pend_serror_exception+0x19c/0x5ac arch/arm64/kvm/inject_fault.c:71 (P)=20 kvm_inject_serror_esr+0x274/0xe40 arch/arm64/kvm/inject_fault.c:330=20 __kvm_arm_vcpu_set_events+0x1d4/0x238 arch/arm64/kvm/guest.c:-1=20 kvm_arm_vcpu_set_events arch/arm64/kvm/arm.c:1698 [inline]=20 kvm_arch_vcpu_ioctl+0xed8/0x16b0 arch/arm64/kvm/arm.c:1810=20 kvm_vcpu_ioctl+0x5c4/0xc2c virt/kvm/kvm_main.c:4632=20 vfs_ioctl fs/ioctl.c:51 [inline]=20 __do_sys_ioctl fs/ioctl.c:907 [inline]=20 __se_sys_ioctl fs/ioctl.c:893 [inline]=20 __arm64_sys_ioctl+0x18c/0x244 fs/ioctl.c:893=20 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]=20 invoke_syscall+0x90/0x2b4 arch/arm64/kernel/syscall.c:49=20 el0_svc_common+0x180/0x2f4 arch/arm64/kernel/syscall.c:132=20 do_el0_svc+0x58/0x74 arch/arm64/kernel/syscall.c:151=20 el0_svc+0x58/0x160 arch/arm64/kernel/entry-common.c:767=20 el0t_64_sync_handler+0x78/0x108 arch/arm64/kernel/entry-common.c:786=20 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600=20 irq event stamp: 2728=20 hardirqs last enabled at (2727): []=20 __raw_read_unlock_irqrestore include/linux/rwlock_api_smp.h:241 [inline]=20 hardirqs last enabled at (2727): []=20 _raw_read_unlock_irqrestore+0x44/0xbc kernel/locking/spinlock.c:268=20 hardirqs last disabled at (2728): [] el1_dbg+0x24/0x80=20 arch/arm64/kernel/entry-common.c:511=20 softirqs last enabled at (2702): []=20 local_bh_enable+0x10/0x34 include/linux/bottom_half.h:32=20 softirqs last disabled at (2700): []=20 local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19=20 ---[ end trace 0000000000000000 ]---=20 ---=20 This report is generated by a bot. It may contain errors.=20 See https://goo.gl/tpsmEJ for more information about syzbot.=20 syzbot engineers can be reached at syzk...@googlegroups.com.=20 syzbot will keep track of this issue. See:=20 https://goo.gl/tpsmEJ#status for how to communicate with syzbot.=20 If the report is already addressed, let syzbot know by replying with:=20 #syz fix: exact-commit-title=20 If you want syzbot to run the reproducer, reply with:=20 #syz test: git://repo/address.git branch-or-commit-hash=20 If you attach or paste a git patch, syzbot will apply it before testing.=20 If you want to overwrite report's subsystems, reply with:=20 #syz set subsystems: new-subsystem=20 (See the list of subsystem names on the web dashboard)=20 If the report is a duplicate of another one, reply with:=20 #syz dup: exact-subject-of-another-report=20 If you want to undo deduplication, reply with:=20 #syz undup