Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1153171rwr; Fri, 5 May 2023 09:49:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Nv6jhoXOcx0ijPi1qtJnZSINrd+Oe8N00ux5ZtpfrO8hNgSmlOjZNFRCVHeCWzh5KUS6t X-Received: by 2002:a17:90a:7782:b0:24e:55a8:bda with SMTP id v2-20020a17090a778200b0024e55a80bdamr1964583pjk.41.1683305372244; Fri, 05 May 2023 09:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683305372; cv=none; d=google.com; s=arc-20160816; b=VwfnB3eFgvWsuyBkqyunaCG7Dv2oiyksXc7pcH5B7FF1mjoP+XnsCDs2VNvuzTiWT3 sElrcJ+iME36e3MJfj5xafb3h99Qd0LX5nkiy7pY97y/x4WI/kGtfFAQCs5H7UEcIDMV /an1AiquuajMRilRSObUEZFsOqAiNaTf26enp+qbEn5K01M4Tl3EO79x2LycyLci6/6K R0o0p/HkM/oRKoVcBsBx1dDBOgfKzaQgMnVpM52fhagKekOg6EGc4+2yojV5maLJzOZU 0uwZIpmJiGVdKavUngIRZBGiMzf1+7weeH2QUXh5DOtt9LfRy6X97rgh21PYCqq5q0xA eoMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date:dkim-signature; bh=9+i6WgJAJzJlKXvdjrc4sB18Bds1WwkbYsWdLgSqVp4=; b=iBo4+oAxprGWX0fooKJBOvZacVGGvLlpaI49xDo85qlAGz1io66Nqwof9yp7kEHZZd jFoztUGvTRDMMDdhly/NB3khxvFrjAnWpRLL3PWd/z0pVhnhRFuN9j7a2saktaj8wpyh PQb7eIZf131+3vyIWDVm9zZ50NgFGN33u7ZVTrspMisbAiLr8npf1ThZtbKLJd4Xymee 5jYtyv/ha6QD84dMRiyhXtBDEanessnMhdqsgnoLutYnIbe4/cLFIW2uHkgqAOF34R9U /sa6RmZ8mjD21kjnhevroyOXM7R40R5BKeOhtjUVKF5JA/QASMDPqqeqFBKXPbbSgI2+ wekA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=5NLcQWof; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12-20020a170902c40c00b001a1cefdaa33si2225370plk.342.2023.05.05.09.49.16; Fri, 05 May 2023 09:49:32 -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=@google.com header.s=20221208 header.b=5NLcQWof; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231337AbjEEQo5 (ORCPT + 99 others); Fri, 5 May 2023 12:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230484AbjEEQoz (ORCPT ); Fri, 5 May 2023 12:44:55 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EBB715EE1 for ; Fri, 5 May 2023 09:44:54 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id 98e67ed59e1d1-24e33239357so1041245a91.1 for ; Fri, 05 May 2023 09:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683305094; x=1685897094; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=9+i6WgJAJzJlKXvdjrc4sB18Bds1WwkbYsWdLgSqVp4=; b=5NLcQWofuV/YkKQ6oScIEQc8lVhhA2L4HU7CAnLH03mX0Px3HVPbbRo2D6swL6bYVC DUB3fcT4XujkVxCNaKYJ+P/Z7sNnX421VReM55ms1qzD5WRQCvJ/Kix0mSSaYy6Vuguo DWnNHQWNURLtT+6bY0K/Qi8QSq5fb73IsidEyosi5bDvhPv4lQKLP/WCp19+1EjcQYkT 2ZZ09LoscjMPBSeU10UZCNvLYrLZpvQ7Vt2oUZW3pPlG97XC7fwgw982zXDkvUJKrQ1i ngUKTQDZ0x71ie0DU+LnkH+jsC1SnJHoK6gBPF+WpYtjUSRSNwRS6UiypPvCgognd0bl qZfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683305094; x=1685897094; h=content-transfer-encoding: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=9+i6WgJAJzJlKXvdjrc4sB18Bds1WwkbYsWdLgSqVp4=; b=anzK6lzCOnhJW35khHfE1l3bU13RWYsH4urCdO7SH9Zh8wCQliyV78tx10JVAZ3pRQ y//jwsWbf1mhjTyWKwxU8/ogKZK/0QLzOu9bn1q3FgyCeMVHVRy+0DsPK6gSzyN4OSS3 1ifLTYJBKuuar360EnVWOeq75rUajkJRMVbyQxbuQ7ksyTuuD3DbxBj20ZielmV3UDV/ sxn20SKztn47EPRnYW94/jrZrDZpcLmSUMY8GJqd2o3gE5ykGITSiqMpMgNVr8szdEm+ xvg7qYpdOTObQguFZx/SqLTmr+YQu814VlWZQELcch2rERGU8nS2i3ag6HOQSBfhYypd 0i7A== X-Gm-Message-State: AC+VfDzWI8Pdy/2gSEk3xkpGbg/4EsLxGySCf9bEooXdjT+UxpvybEVi 7cRKf/s2x/KZlf94U/zq7VPKppLHbog= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90a:ea0b:b0:24e:2787:405d with SMTP id w11-20020a17090aea0b00b0024e2787405dmr607921pjy.5.1683305093970; Fri, 05 May 2023 09:44:53 -0700 (PDT) Date: Fri, 5 May 2023 09:44:52 -0700 In-Reply-To: <20230505152046.6575-5-mic@digikod.net> Mime-Version: 1.0 References: <20230505152046.6575-1-mic@digikod.net> <20230505152046.6575-5-mic@digikod.net> Message-ID: Subject: Re: [PATCH v1 4/9] KVM: x86: Add new hypercall to set EPT permissions From: Sean Christopherson To: "=?iso-8859-1?Q?Micka=EBl_Sala=FCn?=" Cc: Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Ingo Molnar , Kees Cook , Paolo Bonzini , Thomas Gleixner , Vitaly Kuznetsov , Wanpeng Li , Alexander Graf , Forrest Yuan Yu , James Morris , John Andersen , Liran Alon , "Madhavan T . Venkataraman" , Marian Rotariu , "Mihai =?utf-8?B?RG9uyJt1?=" , "=?utf-8?B?TmljdciZb3IgQ8OuyJt1?=" , Rick Edgecombe , Thara Gopinath , Will Deacon , Zahra Tarkhani , "=?utf-8?Q?=C8=98tefan_=C8=98icleru?=" , dev@lists.cloudhypervisor.org, kvm@vger.kernel.org, linux-hardening@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, x86@kernel.org, xen-devel@lists.xenproject.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 Fri, May 05, 2023, Micka=EF=BF=BDl Sala=EF=BF=BDn wrote: > Add a new KVM_HC_LOCK_MEM_PAGE_RANGES hypercall that enables a guest to > set EPT permissions on a set of page ranges. IMO, manipulation of protections, both for memory (this patch) and CPU stat= e (control registers in the next patch) should come from userspace. I have n= o objection to KVM providing plumbing if necessary, but I think userspace nee= ds to to have full control over the actual state. One of the things that caused Intel's control register pinning series to st= all out was how to handle edge cases like kexec() and reboot. Deferring to use= rspace means the kernel doesn't need to define policy, e.g. when to unprotect memo= ry, and avoids questions like "should userspace be able to overwrite pinned con= trol registers". And like the confidential VM use case, keeping userspace in the loop is a b= ig beneifit, e.g. the guest can't circumvent protections by coercing userspace= into writing to protected memory .