From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D431C433F5 for ; Tue, 25 Jan 2022 15:16:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id E68E149EBD; Tue, 25 Jan 2022 10:16:02 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8RUUg2aC1xUd; Tue, 25 Jan 2022 10:16:01 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id BE09849E1B; Tue, 25 Jan 2022 10:16:01 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id B0A1249DE3 for ; Tue, 25 Jan 2022 10:16:00 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nFOsGMcJjNnb for ; Tue, 25 Jan 2022 10:15:59 -0500 (EST) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 893E5411D2 for ; Tue, 25 Jan 2022 10:15:59 -0500 (EST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 26CFAB8185E; Tue, 25 Jan 2022 15:15:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5364C340E0; Tue, 25 Jan 2022 15:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643123756; bh=gld+cOICDVSyR3eBycE7Kw4pbeGx/5O8Kju3l/BFsZc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=uxCMXUS9vU3rX/8c9OHaV7K9zy+vIlk9FYXci6vHqKNTHiqFFWa5VoQEPxjeSmo78 dVZK2zk2T8b97wcUmepHBWBZz9Z0YtsEbRF1hODLtXMlDNFe2pGycWZoBNY+6ebs9b uT18I/myxa1sQhLDgqtgZtjx5ofKpVmGDbq86OkbEUJdIMPB9QsAV4E9AXqg5es3Qt 9O+uvPMXRWMES2Z8cKYEeZQOSQ7HHZ+ujQDFUwLZnOk5Vr51p42emfZmN+rIK11EEJ UQ+UBvZ1roGlKILKO+1CeXAN3tpu2vKa53/41SWX9HD9V31UfvsB1eS7w4De7P55ji 4yY+q+2hMW/Eg== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nCNY2-002weW-Nr; Tue, 25 Jan 2022 15:15:54 +0000 Date: Tue, 25 Jan 2022 15:15:54 +0000 Message-ID: <87o83z7snp.wl-maz@kernel.org> From: Marc Zyngier To: Sean Christopherson Subject: Re: [RFC PATCH v3 01/11] KVM: Capture VM start In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: seanjc@google.com, reijiw@google.com, rananta@google.com, kvm@vger.kernel.org, pshier@google.com, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, pbonzini@redhat.com, will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, jmattson@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: kvm@vger.kernel.org, Catalin Marinas , Peter Shier , linux-kernel@vger.kernel.org, Paolo Bonzini , Will Deacon , kvmarm@lists.cs.columbia.edu, Linux ARM , Jim Mattson X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Wed, 19 Jan 2022 00:07:44 +0000, Sean Christopherson wrote: > > On Fri, Jan 14, 2022, Reiji Watanabe wrote: > > The restriction, with which KVM doesn't need to worry about the changes > > in the registers after KVM_RUN, could potentially protect or be useful > > to protect KVM and simplify future changes/maintenance of the KVM codes > > that consumes the values. > > That sort of protection is definitely welcome, the previously mentioned CPUID mess > on x86 would have benefit greatly by KVM being restrictive in the past. That said, > hooking KVM_RUN is likely the wrong way to go about implementing any restrictions. > Running a vCPU is where much of the vCPU's state is explicitly consumed, but it's > all too easy for KVM to implicity/indirectly consume state via a different ioctl(), > e.g. if there are side effects that are visible in other registers, than an update > can also be visible to userspace via KVM_{G,S}ET_{S,}REGS, at which point disallowing > modifying state after KVM_RUN but not after reading/writing regs is arbitrary and > inconsitent. > > If possible, preventing modification if kvm->created_vcpus > 0 is > ideal as it's a relatively common pattern in KVM, and provides a > clear boundary to userpace regarding what is/isn't allowed. No, that's way too late. The configuration is in general per-CPU, and I really don't want to expand the surface of the userspace API to allow all sort of magic trick depending on the nature of what you save/restore. The "first run" crap is already there. We have it on a per-CPU basis, and we need it at the VM level for other reasons (see the recent discussion about PMU filtering vs binding to a specific PMU implementation). M. -- Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm