From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (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 0227232939D for ; Tue, 6 Jan 2026 01:18:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767662307; cv=none; b=SwS1p0gNYaF4+kNXa36TTBQznW8mS0o2LBj8CxJWKNSaxVurWHoINCjm9D8eeSm7qooi51ZIlxIUmyiyqj9bj/uKxC2gXReMlOdpsecW9vuy5kUL2Rcp1mZf244IV3zRvUXc31TMjp7HxBzTLGoAoAK1yJ2lz+f9xClt7N6Iq1E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767662307; c=relaxed/simple; bh=d5IlxFkfN09wI9xdAxsZH7A7xLpV8LkH9G9w1QVkSWc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=uVsvdxrSzAOlq7b/Sbr/rCyh2e+jSDGa3ZQGIodGrnYhmraCMPf57/7jMivsqoB+09pAPEhNHB3s7umlSZhi0hHl0uzX8VP3X7KbXmmUEPXiX8EVuyFTYI8tUqqEIn1p2A4YJLPaq6tgqG973tfbzGqk4SpIT83USK6ZrORsZCE= 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=s4ZgWj3o; arc=none smtp.client-ip=209.85.214.202 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="s4ZgWj3o" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2a0a8c465c1so14726075ad.1 for ; Mon, 05 Jan 2026 17:18:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767662305; x=1768267105; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=MoZ2DynlAQ5onpvyivPK6vUeSnjXP5L/1wR/DXHXUdM=; b=s4ZgWj3oHKbl08/PtN12LyvI3qvgD2/Off42rxFy1RXIshnDu5/suuZDBi/ZcB4o+X gZASPsiOFH4CYeiOnMdUMdO8Z71N1RYhEAbgNHwfmhpdZe3fMkgcgdDpjSLe9usVbMSx t8CSC5O/2XcEd7fkhLrEJrtSt2ir4mkskRPsKUYbslhUWfRIoxMc+us3rpQ4fG2uhwY1 ZOEO9iFiPzdJOeggahhh7U6OAksNsVtYpLvwOws6zI9boBNBfW8CbfUnbHGo7YjN/CVX R5fI9OQKj4KB7ALWhGN3GqmJ35mpYM+ZWTxDo8RjDw5foRtz1b8J/Tdd9f78iTkuUPNs sb6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767662305; x=1768267105; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MoZ2DynlAQ5onpvyivPK6vUeSnjXP5L/1wR/DXHXUdM=; b=kcZGc3zTq9FAzGnH79gHV1YJK1IwJZu78lX/nsoPeBVbHFtLk6e59+KoWp8eTsAko7 gEBZxENpj9zau1YBIbnjqSX5vP16e56dyLKeLoErHuB0xUCvWUJKEPP8tKVGpuzUvlME k+LVHPf9sE159V6f+WC3oO/61cvJPpqivcmz14PMfmKeei/mwvBpf3dAJyiUNQR/2oFo fHOv+xLiaTTUWiIlYzeFlJ2bH3P+udI/bQ5qZdoh+yzvq9br5iYgcL5f4suIUijMPNVK nJ9Sxx6AwFgO4wu5N72eMzKCQAPREWVU6ZBYwwcbJnFVvJO/zMdCkkxAnqTRvow8suA/ NAtg== X-Gm-Message-State: AOJu0YwTXjszC9yXkR1QF19MoSyfH1VPAzGdD7l/BdMzel98WVihIOvb x+f9o4GndjSdGkOcxUEa+xv/cpqtHb4zc41R0xq0g8rnOxVfDySInDnWjgHYbB16xNWSN4kwunt ubCWcgw== X-Google-Smtp-Source: AGHT+IHfRqhJfcx52UpRHQWejPVEL0xaYjN183Xb9LYnoZgPn6znNyRa2AbSZizadcT25F6+OJhZ/IZcKtI= X-Received: from pjb14.prod.google.com ([2002:a17:90b:2f0e:b0:340:d583:8694]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:3847:b0:2a0:d0ae:454d with SMTP id d9443c01a7336-2a3e39e58e9mr8362175ad.22.1767662305362; Mon, 05 Jan 2026 17:18:25 -0800 (PST) Date: Mon, 5 Jan 2026 17:18:23 -0800 In-Reply-To: <20260101090516.316883-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260101090516.316883-1-pbonzini@redhat.com> Message-ID: Subject: Re: [PATCH v2 0/4] x86, fpu/kvm: fix crash with AMX From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org Content-Type: text/plain; charset="us-ascii" On Thu, Jan 01, 2026, Paolo Bonzini wrote: > Fix a possible host panic, due to an unexpected #NM, when a KVM guest > is using AMX features. > > The guest's XFD value, which is stored in fpstate->xfd, is used for both > guest execution and host XSAVE operations. However, the guest-configured > XFD setting can disable features that were enabled when the guest executed > XSAVE, and this causes a #NM when executing XRSTOR on the guest FPU state. > > This can happen in two cases: due to a KVM_SET_XSAVE that includes a > disabled component, or if an interrupt causes XSAVE to be executed > before the call to fpu_update_guest_xfd(). > > The first patch fixes both cases, the rest is improvements to selftests > in order to cover this test and also verify that #NM faults are injected > corectly. > > v1 had extra patches to export higher-level functions for KVM in place > of switch_fpu_return() and fpregs_assert_state_consistent(). Those > were part of refactoring how KVM loaded guest state when KVM_RUN is > issued, but are not needed anymore with this v2 fix and I will submit > them separately. > > Tested on a Sapphire Rapids machine, reviews and acks are welcome so > that I can submit it to Linus via the KVM tree. Tested on EMR with with my simulated IRQ hack. Other than ongoing complaints about the prints in the selftest, LGTM :-)