Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3329457rwe; Mon, 29 Aug 2022 09:34:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR6wYtzOpYWVumxsZvzz8ACM/f/ZNTgyMsImaOpGIO6Rx2mr6ybK2Wwbq14GNpaZtYCqxIf7 X-Received: by 2002:a05:6402:496:b0:443:a5f5:d3b with SMTP id k22-20020a056402049600b00443a5f50d3bmr17847342edv.331.1661790850407; Mon, 29 Aug 2022 09:34:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661790850; cv=none; d=google.com; s=arc-20160816; b=PRRDdwBv8rAJa1k1heG9wu42KOcoCh3kXxQtK+8eapMQrTojq7pES2LoM8HKQD2iiW dXQx8FtlB19ORX4Uw2O4lRC2cGZcGwzDdjgxq2BuyFzqBm61g5VY+6iv7ATaXNSni1RW IvO0EFo/dYvtigbtWVsXp2JYGReBsmjPMiD3KJRxA80EYBw4su+nt6RgsGI+luZzqcYQ P1cGQCfSZlx0GHngm46lH+Gfv1gP4hsbXk0g/JK3kS0/NNH3+MHcCYatWPcwvS8CuSdA vYhcoY+uekImGjHzCbbKHXF5Yf9SwJ12C2fjKyqD/d0Y4fbYo0GAR/qwLob0GeNwupL5 pMcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=URd452JoMFM9JD7pYWX5aoZrRYft8Gac0hRTpx4CpB4=; b=USY+Y7f4bq8jvxXR7b9Um1LK2AE1k4s8eKKL7hTOQBZvUKXy2GcOtA4AuRFTsr3QYn NCfUvbdyzm4sgjTq8q77kFV93eTAkyXRELPqz6JjqRoi0JnIUZOlMytFP7kZU6AQh/3/ cNcrHUOIfq1pY8bOcVhJfzv/gM/CLstmUX9icXZlLkR4MDpzdmYTzLmTA4kSbpnm8y2p l/kyeOZmuHKocEFPxH8ZqMyEJZup2LYoszuAWk5uZFPL/AFJIf/7KsaHiRFPVmIj4D1C Pgkodga+irZDixjHSQkbQJt8uADg7arWFh6UdGuOrprzpRa9NysJcATcfWnXI8h4kA2t l60g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=cmAaq27a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go40-20020a1709070da800b0073d81e22d19si7575020ejc.544.2022.08.29.09.33.44; Mon, 29 Aug 2022 09:34:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=cmAaq27a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229583AbiH2QTv (ORCPT + 99 others); Mon, 29 Aug 2022 12:19:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbiH2QTs (ORCPT ); Mon, 29 Aug 2022 12:19:48 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89633D40; Mon, 29 Aug 2022 09:19:46 -0700 (PDT) Date: Mon, 29 Aug 2022 18:19:41 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1661789984; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=URd452JoMFM9JD7pYWX5aoZrRYft8Gac0hRTpx4CpB4=; b=cmAaq27a2rEDvaFF7eIf/c+iEhVwMjmtSQo0G1Xqa4rr5PmoDkzJisJPTaorWXIbYYuMsN +N8RcRi9Mq5LOv6cPDYQyYshMhIlPtfYGzLct3XwxIvDIbi8Tvjjnjp38np47QcYF+a9Up 7KTvlcfUB1wBgeGX6fRshWbeb0i2X2I= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Andrew Jones To: Sean Christopherson Cc: Paolo Bonzini , Marc Zyngier , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Nathan Chancellor , Nick Desaulniers , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Atish Patra , David Hildenbrand , Tom Rix , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, Colton Lewis , Peter Gonda Subject: Re: [PATCH v5 5/7] KVM: selftests: Make arm64's MMIO ucall multi-VM friendly Message-ID: <20220829161941.c5bd6azxv7jzpwq2@kamzik> References: <20220825232522.3997340-1-seanjc@google.com> <20220825232522.3997340-6-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220825232522.3997340-6-seanjc@google.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 25, 2022 at 11:25:20PM +0000, Sean Christopherson wrote: > Fix a mostly-theoretical bug where ARM's ucall MMIO setup could result in > different VMs stomping on each other by cloberring the global pointer. > > Fix the most obvious issue by saving the MMIO gpa into the VM. > > A more subtle bug is that creating VMs in parallel (on multiple tasks) > could result in a VM using the wrong address. Synchronizing a global to > a guest effectively snapshots the value on a per-VM basis, i.e. the > "global" is already prepped to work with multiple VMs, but setting the > global in the host is not thread-safe. To fix that bug, add > write_guest_global() to allow stuffing a VM's copy of a "global" without > modifying the host value. > > Signed-off-by: Sean Christopherson > --- > .../selftests/kvm/include/kvm_util_base.h | 15 +++++++++++++++ > .../testing/selftests/kvm/lib/aarch64/ucall.c | 19 ++++++++++++++----- > 2 files changed, 29 insertions(+), 5 deletions(-) > Reviewed-by: Andrew Jones