Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4623380pxb; Tue, 25 Jan 2022 14:48:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0pl+UNKpnv6znBkkFop1YCQnsVKEhOrK12WbqBuHllRVfggRtUYPMI2Qqt+S5CwLrQZc/ X-Received: by 2002:a05:6402:3552:: with SMTP id f18mr1372000edd.289.1643150902344; Tue, 25 Jan 2022 14:48:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643150902; cv=none; d=google.com; s=arc-20160816; b=N0qH3vsJZaGRXa+SBRmNBScaRYwI8q2XxpTY0ndnDptR+KkHcEFIEgnFkWIRmY1ftu fo8FKDs5o0oiFUQNGRsuGWcQnaaEVyiAhPWUvdBqQQp1gWqC9zyfkKspTgr7LHfBy0RS nvif7agIL/eVgklBb8PP27uDrrjHvWw9TjbpqIxdrKvssn4Bz7qNv70jvMSuQLUB0v1J fDylwrjC+5/wesPuliJyZyWW8AKfaIvI8QYeAsJH+JDF3WtGYCQUVuVWXn1X7kv7WB1I Iu3zCzGewnSnu9yI3KEn1tUCbZisGSdE5k+grghRqxSkZj7e19bSPOD7WlHPnpJ/XZXy JIUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=PyvQLdG2xKLI+rMuqyow7UrAbws5jI0idTeAMiLwtGQ=; b=AmG1hwTQFZZJyxsePgcyKeZPm5+baQqThiK2quxBba/C94QeJ1Wg2gDLfpLZGKkAbR j90GhCGfG1/hOrL6BymZXjP2/M4nKYG4F10SlZ+qlUBPyrB/oOclCmaSxTLr/2SVf8Vy wG2o/SHHUj6Ivo2ZRPqI0LW2vEChnKoRww6uRBaN8LjMdVs5dOVCoAOSUQSP8B6mxPZH 9Bn6neauO2LmCK9qxK8kst80b0x5h3yuLSajvZzUhwMBAIn9/SUdXRY1RyzP/7GlvmRG CJ8ExavRUmCflZ1lRw5U9HpJAF+9Ybx/44PmQiMvjAAy07zI+xUF8j7HvX7Zu8I5KOTW AvIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vAftbCY6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 9si10764901ejd.50.2022.01.25.14.47.58; Tue, 25 Jan 2022 14:48:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vAftbCY6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581848AbiAYPNj (ORCPT + 99 others); Tue, 25 Jan 2022 10:13:39 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48054 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1581574AbiAYPLD (ORCPT ); Tue, 25 Jan 2022 10:11:03 -0500 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 33B14B81817; Tue, 25 Jan 2022 15:10:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB4B6C340E5; Tue, 25 Jan 2022 15:10:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643123454; bh=827Zl6UTbu4+DODgqO5pwb2rOj9GCDpTQYVElhmcxEk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=vAftbCY6wfyApG6ImaV7i4/RB+857+ZVJG5aasCxCyYUaBgWyju/37RZVSeoZNQm0 ePQJq1yfPtHz4E8LAG23pqp6Qv/305+5RSMdyf0B5jQBw6hD6ICgWZpFk6i+NnNza+ Z/RdHWNh35bj5WVSklD+twb6YCCMMatGVd6+iKjvbkl4BStJa2nGmLEUXJ6d0Jz/AO JCejWJ3Ycz3eIX85LP9y0t5BNE58/3caA4QzIW98rCKZ14mE/rYjPl2YI8wxPUKGOf 0eaE+/Qf7d1W8U//CIG4h4EhNiaximmfy8drzLYznmu22dubxrKEpTWOXMR3jlijiO v7xGW9oF4LMzA== 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 1nCNTA-002wXr-LC; Tue, 25 Jan 2022 15:10:52 +0000 Date: Tue, 25 Jan 2022 15:10:52 +0000 Message-ID: <87pmof7sw3.wl-maz@kernel.org> From: Marc Zyngier To: Sean Christopherson Cc: Raghavendra Rao Ananta , Jim Mattson , kvm@vger.kernel.org, Will Deacon , Peter Shier , linux-kernel@vger.kernel.org, Catalin Marinas , Paolo Bonzini , kvmarm@lists.cs.columbia.edu, Linux ARM Subject: Re: [RFC PATCH v3 01/11] KVM: Capture VM start In-Reply-To: References: <20220104194918.373612-1-rananta@google.com> <20220104194918.373612-2-rananta@google.com> 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") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: seanjc@google.com, rananta@google.com, jmattson@google.com, kvm@vger.kernel.org, will@kernel.org, pshier@google.com, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, pbonzini@redhat.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's probably time I jump on this thread On Thu, 13 Jan 2022 17:21:19 +0000, Sean Christopherson wrote: > > On Wed, Jan 12, 2022, Raghavendra Rao Ananta wrote: > > On Tue, Jan 11, 2022 at 11:16 AM Jim Mattson wrote: > > > Perhaps it would help if you explained *why* you are doing this. It > > > sounds like you are either trying to protect against a malicious > > > userspace, or you are trying to keep userspace from doing something > > > stupid. In general, kvm only enforces constraints that are necessary > > > to protect the host. If that's what you're doing, I don't understand > > > why live migration doesn't provide an end-run around your protections. > > It's mainly to safeguard the guests. With respect to migration, KVM > > and the userspace are collectively playing a role here. It's up to the > > userspace to ensure that the registers are configured the same across > > migrations and KVM ensures that the userspace doesn't modify the > > registers after KVM_RUN so that they don't see features turned OFF/ON > > during execution. I'm not sure if it falls into the definition of > > protecting the host. Do you see a value in adding this extra > > protection from KVM? > > Short answer: probably not? Well, I beg to defer. > There is precedent for disallowing userspace from doing stupid > things, but that's either for KVM's protection (as Jim pointed out), > or because KVM can't honor the change, e.g. x86 is currently in the > process of disallowing most CPUID changes after KVM_RUN because KVM > itself consumes the CPUID information and KVM doesn't support > updating some of it's own internal state (because removing features > like GB hugepage support is nonsensical and would require a large > pile of complicated, messy code). We provide quite a lot of CPU emulation based on the feature registers exposed to the guest. Allowing userspace to change this stuff once the guest is running is a massive attack vector. > Restricing CPUID changes does offer some "protection" to the guest, but that's > not the goal. E.g. KVM won't detect CPUID misconfiguration in the migration > case, and trying to do so is a fool's errand. > > If restricting updates in the arm64 is necessary to ensure KVM provides sane > behavior, then it could be justified. But if it's purely a sanity check on > behalf of the guest, then it's not justified. No. This is about preventing userspace from tripping the kernel into doing things it really shouldn't by flipping bits of configuration that should be set in stone. M. -- Without deviation from the norm, progress is not possible.