From nobody Sun Feb 8 02:21:54 2026 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 DF681243387 for ; Fri, 9 Jan 2026 03:07:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767928024; cv=none; b=Tf5RSaSZnF/c/yJ0Iq+BVuFPipzPwfwnSjH8at4+atXPpnZHV5Gx0Y9S2Oi+ondS2CNeI64voejeyTdUPkDVw95/E/z+YO7KL70J/k4/hOUZWaM5dUby5qBkeMgyEhCCvOIpLceEGQR4yNSDQY2QJkZWd5M+it8JLcBQ9vU7iPA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767928024; c=relaxed/simple; bh=wrzQqcwVdCsiQ7G7vBjsiP4ekYsP46Tf3uSiaD+duHU=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=DP06nu3QvYvrf958CbkvssUOAmVItArQw803X1eiFcDHetg1dHsT9rfe5sutlJRfAD9H2Dh1w+Y8t1s0WP0ILml7E44G0gpTzAyHzt2/yVirFb67CZdYMgKTBqDk2oEsGpFvyvYJP2+Obhjaj9hq5QBiOQzX1o7nM4U5O8LGKtk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=sVDlQAwh; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sVDlQAwh" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-34aa6655510so4195313a91.1 for ; Thu, 08 Jan 2026 19:07:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767928021; x=1768532821; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:reply-to:from:to:cc :subject:date:message-id:reply-to; bh=8+5Tdd6kkAxxdHZ49XuLg04bl84lthaID8yMvU0opPM=; b=sVDlQAwh35BromRg772CBk2fjt/kDUvj34IqAPTVZUo414TbMTh7zHBx9OmJ0iHliG jEZght9kUXktOH49MC1aGzHXx7L0Od2e1MWHR2DR3xKZXSPRCzqfLZKwMwy9Q/geZFQk XWZtF+YdeAvZyZSUUzDhL/H2Ks8j4QDAQA6pnwWRWN7qpR0UbHeWzWTKY2GVw7glQo2A ZA75c1x8GxL1KVntvMK8He1l1fexEOyobIl84/+8UKUNcusQqcvtSiGBxwILXyPrXo2f y1nZxux9grjS5bqHmiHL50DutGhgNMqyQTgAHDSmMyiAdoCBv9KeaXXWKzWK3pEhIBui sFwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767928021; x=1768532821; h=cc:to:from:subject:message-id:mime-version:date:reply-to :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8+5Tdd6kkAxxdHZ49XuLg04bl84lthaID8yMvU0opPM=; b=wYI+VDO0bT+l+IRqk32pAnj8XBTxwBCpO9P+ErOaA5pOnBQikBjJuTI5ZeJUD6SoxB DzVyHZ7LkC9TaAE6NobMHr38QSOg97g5+89qEJopkPovlp6oJFbVsHVaMCq5PrI3823A MlnbQB1cEbrgPISseaB4UryeshDw9pJpU89r0LbyK4p0GqMuvR9maNrlAlPFrEGd/rqF ExxJQypLgjQCEleCJ1dtvOejqe57LGkloF8AG4lNBr403RtnrJScC2jNgFVqUcxnnip1 3M83lyDbBywhiN7DJcaTvPyBNemK1Haw3sO7GscTARlMuyzcsQ4ioij3Ceq2RiAPNaHr Mc0w== X-Forwarded-Encrypted: i=1; AJvYcCX+UQaGMaKYl+i3J+12uNJjVjiK2EwGLFL2kkOv4OjZsfUVKDQLpC8SFvqBumyUwezxNGIoga3n4kAst7o=@vger.kernel.org X-Gm-Message-State: AOJu0YzOXJv9ayKWPtF6iq4fzb16ojIcC8sFD+ndMGWvrI5pSUVlCis6 H/2ldgSTEf6wfLZKl3KhpTZpohuAraHpCrsILZV7ZVqqTYxE6xgkqV6k76Vsf9KqNcu02UDkjY8 2lRlpiQ== X-Google-Smtp-Source: AGHT+IHPpIP9QlEWt5YOGDuvZqwqeWpmXJCZ4IVvAKuLgyq8v3Yd6QPHHZMoJNTtqLxviNpNzzz1gUoVXQU= X-Received: from pjvj1.prod.google.com ([2002:a17:90a:dc81:b0:34c:84ee:67c4]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:2883:b0:340:be4d:a718 with SMTP id 98e67ed59e1d1-34f68b4e70emr8102737a91.7.1767928020685; Thu, 08 Jan 2026 19:07:00 -0800 (PST) Reply-To: Sean Christopherson Date: Thu, 8 Jan 2026 19:06:57 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.52.0.457.g6b5491de43-goog Message-ID: <20260109030657.994759-1-seanjc@google.com> Subject: [PATCH] KVM: x86: Ignore -EBUSY when checking nested events from vcpu_block() From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Alessandro Ratti , syzbot+1522459a74d26b0ac33a@syzkaller.appspotmail.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Ignore -EBUSY when checking nested events after exiting a blocking state while L2 is active, as exiting to userspace will generate a spurious userspace exit, usually with KVM_EXIT_UNKNOWN, and likely lead to the VM's demise. Continuing with the wakeup isn't perfect either, as *something* has gone sideways if a vCPU is awakened in L2 with an injected event (or worse, a nested run pending), but continuing on gives the VM a decent chance of surviving without any major side effects. As explained in the Fixes commits, it _should_ be impossible for a vCPU to be put into a blocking state with an already-injected event (exception, IRQ, or NMI). Unfortunately, userspace can stuff MP_STATE and/or injected events, and thus put the vCPU into what should be an impossible state. Don't bother trying to preserve the WARN, e.g. with an anti-syzkaller Kconfig, as WARNs can (hopefully) be added in paths where _KVM_ would be violating x86 architecture, e.g. by WARNing if KVM attempts to inject an exception or interrupt while the vCPU isn't running. Cc: Alessandro Ratti Cc: stable@vger.kernel.org Fixes: 26844fee6ade ("KVM: x86: never write to memory from kvm_vcpu_check_b= lock()") Fixes: 45405155d876 ("KVM: x86: WARN if a vCPU gets a valid wakeup that KVM= can't yet inject") Link: https://syzkaller.appspot.com/text?tag=3DReproC&x=3D10d4261a580000 Reported-by: syzbot+1522459a74d26b0ac33a@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/671bc7a7.050a0220.455e8.022a.GAE@google= .com Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index ff8812f3a129..4bf9be1e17a7 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11596,8 +11596,7 @@ static inline int vcpu_block(struct kvm_vcpu *vcpu) if (is_guest_mode(vcpu)) { int r =3D kvm_check_nested_events(vcpu); =20 - WARN_ON_ONCE(r =3D=3D -EBUSY); - if (r < 0) + if (r < 0 && r !=3D -EBUSY) return 0; } =20 base-commit: 9448598b22c50c8a5bb77a9103e2d49f134c9578 --=20 2.52.0.457.g6b5491de43-goog