Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp433838lqb; Tue, 4 Jun 2024 16:30:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWwHITFfDV4zGX7ax4BeNXYhB5zbFXoUWP0C1cjVaYo1u4ymPwB+RL71DgUP8heaT0ZWaWyw25dEYwMSg4eZg2bTWZTBlyE8gleFkAevQ== X-Google-Smtp-Source: AGHT+IEJG5OWLZZgZ8MzhJuGHKVAhX6lNZrAkrBQ1swZMfR/f7vv4xwKgoEd9DSUDfybUEadthqB X-Received: by 2002:a05:600c:46cd:b0:421:1fb1:fe00 with SMTP id 5b1f17b1804b1-421562d4a37mr8735565e9.17.1717543822775; Tue, 04 Jun 2024 16:30:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717543822; cv=pass; d=google.com; s=arc-20160816; b=tYA+91aIBIa+rYJekDUraIQwRy4heW9DhpR4rLoE+QDKMxM6Lf/dx6i84B334RcMyP Sq2qGATnfNEHgH7BeaoAGHhKsviFb1lbJYYRtPc3c06zOpWlm3vagbGadX7ovHNPkPCu W/c75NSiy6ZZiGKEnq9dlc5DM7fn7xIdSqjat3Mr7sGwEs+PEbe4Qs+y8hW8afy+ZP/D 48a0t96cUS09RDCHPML+f6gpFy+nijlJDhYfnP19xe+rr1Ax0Jek4nRHtrpgyHNCQBd0 p/RZ5D5zqncEBoyMNDM8BpGAOubUAZD43Z7CWaHLk1Yhfg/p59u7aJb1kviI8dNtYhoZ /hXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=Yn29SGEL/4hxpbDH7DFjKmYshmIBVrIAEi6P1l/UqBc=; fh=QprPIfPFq6V/l2B7j98mvQ6FPDvuVDQso7PWo2aBhJM=; b=wO9/UKzrndXcAdA7xfoAhnZ/V1YGgYRuK4prToVVzuO8JNFQAQqIYbl9ETTcwfeoO9 vyoNZaVPSFNl+us0KQuXSz8XRbOl/fzc1jc3AV2bEvmSBuJKTIfgCsDbUl+qIklwPvN7 0HwiHBLynhCas6d2i9zTA406sEsYIGcHTl34s4tk/Jx+7Nh3PSaw31FRmUCrnMsHq5Mu aHK/w9Dnch3VX9qWUEzU3T80jdagmGjC2KZCYvGG9TCqe/YJ9mp+LPPh6i8oEpMnR7AN cGDMT0BY54L2lEbn+B4KEau7PehQ4Aoah2Z7PZbUJWBJRwALZin4sKvK1PsI69r6vlAM g7DQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="sxg8Z/vR"; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-201546-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201546-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6900fd97afsi279370666b.372.2024.06.04.16.30.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 16:30:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201546-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="sxg8Z/vR"; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-201546-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201546-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7E0561F2337E for ; Tue, 4 Jun 2024 23:30:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A1C114E2F9; Tue, 4 Jun 2024 23:29:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sxg8Z/vR" 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 53B8514D6E1 for ; Tue, 4 Jun 2024 23:29:52 +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=1717543793; cv=none; b=XhpQUqFjDNlayaxshb+JGQWJDG8MosWqQerwQmACtMsy/7lt9aYdFrDoEtlyHuaHq8V1b+rjEzW6C7xIi/mttYZVxq1/GO2Zfjdc7YJ6PvoCRpR9OzWDZv5HaFBmbHfBDGnUzE2qOmLtvmAoFeWgRtA+VP5b8/dxoXmz6Wmcaqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717543793; c=relaxed/simple; bh=cMsCRivM5/rPaUXeSQ7yCaavw/L076BTyvOx6aLWSUs=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=o/arZWDCGExCXXOHxAVkqRdf4loRJqIElV77aqE9D2QUlButMka6BT346owqflgs2cK6Z7zfENa4+5RLKo85XSb4nc2ma3xuItTeBOdIhOsupYxr2tg/vw8PixxbBDQWs1CGa4B/nRNDukl48R8X36VFJHVJMGu+dpGSFkhDTXw= 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=sxg8Z/vR; 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 Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2c1ad1ee431so5608244a91.0 for ; Tue, 04 Jun 2024 16:29:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717543791; x=1718148591; 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=Yn29SGEL/4hxpbDH7DFjKmYshmIBVrIAEi6P1l/UqBc=; b=sxg8Z/vRPkXVGtuMRGNK02uuFb8oCbsfUX7usb6Y8fxFfDwCPbgkjXM/vtQa0xALs/ SPFTYnkuXCkCxxiwwbVy4Zk8nCCM/alSvjOMjvJHaEcKegxKi+YidlVGOlnKchNHaMK3 p3pASX3Czdet+nAARn2J1awvkrUj96Qh3JLMqcfoZZfkg8qT34y3OLQS9TtjBtMXv3fV A0sNhSovtHnUQSfhnX459tCBir5/v6rS0JEwVNp2GDaT96SfBZqiclqtP1xfKZZYgbx2 IHeDSvcoCNb3iaD+cUDfuoViMbJZhITgx5aV/M5h7XWrXEbqH/f71xigtLFqriki7ZlS dlkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717543791; x=1718148591; 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=Yn29SGEL/4hxpbDH7DFjKmYshmIBVrIAEi6P1l/UqBc=; b=hIZSAWGDbraqI4ty9MmQon2uLnFJNKZ1HqYCSXymcAX0OwBUooZYjyKYZyRXFAoCGi 8zL1FaprvUZ/wohnmKGtnzyjyQw199wTvafrBKWHO1dj86eW9fnLH7gpGsoYfbYpGfnE IabHJaEpHNYZpabFgkwct2s5myxJ+JBP8F2buCXWLbH3+oxLhgTAlpmke9g8bRLe+yUb hEYkpP7jVPTLao6knLPhSw+hUQfBEEQJQbtloIak69OPMziuRcAN6fP8Zw6Pr3f9Onfs qalB3W9pPDGQvju3uURRSq6i3S1qSRAgXUE6NZqcIwWqiVso0PIocFVGbzro7IMaod3T 63Xw== X-Forwarded-Encrypted: i=1; AJvYcCVUpJ7P0DmNgBPn6Cc9OqvivfC+1xOnQkT5nbDdR4z0+34CbTnlDRgp1ztq4I7ocZCPwzRqOSkUDVFU11uQOrlgVCm4C49+LYCWukGw X-Gm-Message-State: AOJu0YzeNkCqT70V8/9Av51zapoEd7qogLjAR/+u7ujfR5PXJOOd/ymw c4lglb5iEF5fUx0anZ+mQcW7qTof5uuWsKqQIOYKJv8am3SDScRID2WK0vRj52ZI607d7kVJ2Ta wMw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90a:de82:b0:2b2:b00b:a342 with SMTP id 98e67ed59e1d1-2c27db579d5mr6046a91.4.1717543791515; Tue, 04 Jun 2024 16:29:51 -0700 (PDT) Date: Tue, 4 Jun 2024 16:29:19 -0700 In-Reply-To: <20240510092353.2261824-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240510092353.2261824-1-leitao@debian.org> X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog Message-ID: <171754269008.2777502.9202264224544350112.b4-ty@google.com> Subject: Re: [PATCH v2] KVM: Fix a data race on last_boosted_vcpu in kvm_vcpu_on_spin() From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , Rik van Riel , Marcelo Tosatti , Avi Kivity , Breno Leitao Cc: rbc@meta.com, paulmck@kernel.org, stable@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Fri, 10 May 2024 02:23:52 -0700, Breno Leitao wrote: > Use {READ,WRITE}_ONCE() to access kvm->last_boosted_vcpu to ensure the > loads and stores are atomic. In the extremely unlikely scenario the > compiler tears the stores, it's theoretically possible for KVM to attempt > to get a vCPU using an out-of-bounds index, e.g. if the write is split > into multiple 8-bit stores, and is paired with a 32-bit load on a VM with > 257 vCPUs: > > [...] Applied to kvm-x86 fixes, thanks! [1/1] KVM: Fix a data race on last_boosted_vcpu in kvm_vcpu_on_spin() https://github.com/kvm-x86/linux/commit/2b0844082557 -- https://github.com/kvm-x86/linux/tree/next