From nobody Tue Oct 7 07:06:12 2025 Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) (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 C4D322E36E5 for ; Sun, 13 Jul 2025 00:41:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752367300; cv=none; b=OJGCitSr9e2Nd3TgI+alPim2VqBYdwYbuCT1JN4QvH/MqqyTfdyu4xIOP6usKqkziTPzZhbcfjygFGlaTgOnmV46m0mswUokZehsH7jMFRf4AQn1RPOrRpVmaAlKByIyKNrmk9BbKXX1sXS/lhGAAvwv+4GPuUPKREn1rsEptUc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752367300; c=relaxed/simple; bh=hzPKrFUDJvtn9idhpmuxlc0TnlFCK44j+Bn/8VFfTww=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=Lz4jW1Z2jZrIxJECCaUAhfN5bdrmDTWRU7CwB6qFPZlBI+yMNqXW+k5uqChLGEGf4OAMFjkeR90Jd4hScd3TV2+Ndn+Q5vAh/53SMZ8mPr8Z4fNSI7C3AbBZ/nuTkQymg+gZCVMLMPfoWDsNRUx6Zf/wL38D11EgQ6XPL/uoFCI= 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.72 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-io1-f72.google.com with SMTP id ca18e2360f4ac-86cc7cdb86fso346956239f.1 for ; Sat, 12 Jul 2025 17:41:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752367296; x=1752972096; 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=HqofCt2fMo1CyfbFBoNlZ2LavS6lU0R8lov3qrs3EcU=; b=TBS9jfivZ+Lpv4JS41UvWtxPi9qlPxPH0BU6U7hj7yvh5lPGbbqnnsOZVM4TxjUTCq ZVHKDOfYNjisDv1d6QOEt9oVOp53Z6IP1DXWpNB/9/m4WMSxU8gwY906tZ2SPxSzvz2c NIsaeTugy8W5JOPvmu4B77Fq+PI0t+yQoPhP3EcABEddkeda2vbxEeMGr3K+zBqSdFTg XM31Hrz0tjPg+j0X+LKJNChnsHlVn1Ad51zpd4a6Vmj6/ggo9Uuy5TRnLU+SbHbipqoD yAr/q9kpiJhDEY7pl1ER7FFwAQzP3UKtvAPG4fupoJJ0aui5PW1gWXzw4sKC2AodPNO3 WemA== X-Gm-Message-State: AOJu0Yw1xs5meRnHjUqur5PwC8JrJt1vbTiTPvEdDi9Q1TIss3bK4ttO 8zIiHdULzKXeawHHCtZH72SuofR40u+xEGQK0g3BXPT4A4iJKYR32lhTARJz7pXO2BMwExHt814 P0b1y5wbL4cZRivayKvFhIvDKE0PxOsV1OdBPWuBH9Er/Pdgx3rUtevqtRUQ= X-Google-Smtp-Source: AGHT+IEiRDasUG34CuNNpzQK7thckAvAl6aHZVpfn51JIipW0LhDevOjjj9WXoTFkLA7khHAul7HV+ytXyu/OpLIYxcnqBghFoql Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6602:160a:b0:867:6c90:4867 with SMTP id ca18e2360f4ac-87978fec056mr918208339f.14.1752367295875; Sat, 12 Jul 2025 17:41:35 -0700 (PDT) Date: Sat, 12 Jul 2025 17:41:35 -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: <687300bf.a70a0220.3b380f.0016.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=20 From: Arnav Kapoor Date: Sat, 13 Jul 2025 21:00: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. Reported-by: syzbot+1f6f096afda6f4f8f565@syzkaller.appspotmail.com Fixes: 0e5b9065dcf3 ("KVM: arm64: Inject SError exception into guest") Signed-off-by: Arnav Kapoor --- arch/arm64/kvm/guest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 2196979a24a3..cbe1e310f477 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -844,10 +844,10 @@ int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu, if (!cpus_have_final_cap(ARM64_HAS_RAS_EXTN)) return -EINVAL; =20 - 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); } --=20 2.43.0 On Sunday, 13 July 2025 at 06:07:03 UTC+5:30 syzbot wrote: Hello,=20 syzbot tried to test the proposed patch but the build/boot failed:=20 failed to apply patch:=20 checking file arch/arm64/kvm/guest.c=20 Hunk #1 FAILED at 844.=20 1 out of 1 hunk FAILED=20 Tested on:=20 commit: 15724a98 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 kernel config: https://syzkaller.appspot.com/x/.config?x=3D82bd3cd421993314=20 dashboard link: https://syzkaller.appspot.com/bug?extid=3D1f6f096afda6f4f8f= 565=20 compiler:=20 userspace arch: arm64=20 patch: https://syzkaller.appspot.com/x/patch.diff?x=3D10ebfe8c580000