Message ID | 20240801090117.3841080-8-tabba@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9CE2C3DA4A for <linux-mm@archiver.kernel.org>; Thu, 1 Aug 2024 09:01:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 72A576B009E; Thu, 1 Aug 2024 05:01:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6DD2B6B00A0; Thu, 1 Aug 2024 05:01:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 507796B00A1; Thu, 1 Aug 2024 05:01:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 30C176B009E for <linux-mm@kvack.org>; Thu, 1 Aug 2024 05:01:41 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id CCCD9A093E for <linux-mm@kvack.org>; Thu, 1 Aug 2024 09:01:40 +0000 (UTC) X-FDA: 82403083560.25.4506319 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf15.hostedemail.com (Postfix) with ESMTP id D767CA003D for <linux-mm@kvack.org>; Thu, 1 Aug 2024 09:01:38 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=R5ji9+2N; spf=pass (imf15.hostedemail.com: domain of 38U6rZgUKCHgpWXXWckkcha.Ykihejqt-iigrWYg.knc@flex--tabba.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=38U6rZgUKCHgpWXXWckkcha.Ykihejqt-iigrWYg.knc@flex--tabba.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722502870; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VYgP8TsqpjmhLiOepZBWnEDyKrGoYglq1ochGe+g9ag=; b=JPPYauxjf2UX0Al8FtaSn14FUG2vJ0cuUz9c3Z3XZvCMISBWZZsZTl51NknsT68wL2hFGc b9WgCko5GDE0w+6MIIQ+/exW5VWRWCsSPgnm4VrzZIWvhNWGKxx8AybMFnlkI0rAur6WtR UPJBLGydil+rkxq8wm5BugdfK60aa08= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=R5ji9+2N; spf=pass (imf15.hostedemail.com: domain of 38U6rZgUKCHgpWXXWckkcha.Ykihejqt-iigrWYg.knc@flex--tabba.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=38U6rZgUKCHgpWXXWckkcha.Ykihejqt-iigrWYg.knc@flex--tabba.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722502870; a=rsa-sha256; cv=none; b=KWxQwPOWUzvpSzplkYWcIeUNeWz5uU8UorQs3Cv2sXCHmSbnWAaZfDUVLq8812ttxWJRx+ 44CdSo3XkXc4+ZTGITtOCPbq4C0OeuAZK/ZZh186jiCuqloQGhAYB3kVkP9rSuI/WTjOwn S78dhOHr0m8uFA2SgBJTahYqi8lVuBI= Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-65b985bb059so125081087b3.2 for <linux-mm@kvack.org>; Thu, 01 Aug 2024 02:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722502898; x=1723107698; darn=kvack.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=VYgP8TsqpjmhLiOepZBWnEDyKrGoYglq1ochGe+g9ag=; b=R5ji9+2N4zpRHBHa+rsLWWi8cILA0EOGRUKqsxk9+MMAFOnJwK2UjVwdaumC49edAr tPCaHQl03JUyHWI+MjHVQu5hyTV5PuP/GCGftTOkiBjFAHQOq5g/ZCNYM/wBcaqusT8d /Dbm3U9E2eCi1rfvziZ6uJLy1Bc3Pk1R4JCjhf+dy5XtyOel90aqiagfFVnHuoYEHu/Z Q8A1AptUDx0xP4jSmfHHlMEP8CRkfeyup0oeHFBFbLRu89MaRX7xctN7oK0djY/y6pkx CU85+qWSuJBG+MYc5LOmGlNA0CSsGpoI+ztP7KLP3mxulHEWxSa0x1X0pKBbiUtSwJv8 Rm0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722502898; x=1723107698; 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=VYgP8TsqpjmhLiOepZBWnEDyKrGoYglq1ochGe+g9ag=; b=lPsY3fugjnQvUqz7f4wnpSNpDtgTTrHdC8bfiCUXp5fjTPwCLLKjbjDUPIm56yCo2p X0EsEd22b9Cs8cSDezJAP1yYn3KfH5gWJMJyH1erW1oUOgLCCg28OkQAv+4jTKZuth9Y 9MT493MWE6aq6Xe/ObFkUl9mXxUJNuSjmZZXQJqDoUbu6PSeiYKm3/nCo7LXr77Axmig 8Sp5kFCk06+rJuTezwLT0ZgdTCfJh1ZtuCtvimQ5y7SvQeReZHRsjvVrJ75g/0IthF4v NoGGX7mWjjIY1n9CeXuy/fn87aASWGMzO+1OyVceScVAI/TJu0M7TNQ0kYha84AafXCu NhTg== X-Forwarded-Encrypted: i=1; AJvYcCUnfjYJiDDYrSTWbj1eWoLtvidnb1bxVB1q/9dxJFhj+TRFMVReDsisCDUjX9956E91cC3qMpgp5qeCc/19155Wg3Y= X-Gm-Message-State: AOJu0YzaLwWK1EGlBRANWYBb4XKL/Xj5dJmbVk9n56IywmF5c58epkS1 pxRJaLms8z3LKKaJ36uNzTjXWIVBGDtZ5HmhYIEsayUGp6lvfblwrJKLbk/NT27qojdr7TxkMA= = X-Google-Smtp-Source: AGHT+IFYiAm/ZMOGWhUa/K3MvrLtTZnEUf3NdBQXNfdF1a3J1k2aDdCJIpsdZ+5mVOdSrR6hCD4FF6rWww== X-Received: from fuad.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1613]) (user=tabba job=sendgmr) by 2002:a05:6902:1107:b0:e03:6556:9fb5 with SMTP id 3f1490d57ef6-e0bcd3e5b26mr6126276.11.1722502897790; Thu, 01 Aug 2024 02:01:37 -0700 (PDT) Date: Thu, 1 Aug 2024 10:01:14 +0100 In-Reply-To: <20240801090117.3841080-1-tabba@google.com> Mime-Version: 1.0 References: <20240801090117.3841080-1-tabba@google.com> X-Mailer: git-send-email 2.46.0.rc1.232.g9752f9e123-goog Message-ID: <20240801090117.3841080-8-tabba@google.com> Subject: [RFC PATCH v2 07/10] KVM: arm64: Do not allow changes to private memory slots From: Fuad Tabba <tabba@google.com> To: kvm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mm@kvack.org Cc: pbonzini@redhat.com, chenhuacai@kernel.org, mpe@ellerman.id.au, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, seanjc@google.com, viro@zeniv.linux.org.uk, brauner@kernel.org, willy@infradead.org, akpm@linux-foundation.org, xiaoyao.li@intel.com, yilun.xu@intel.com, chao.p.peng@linux.intel.com, jarkko@kernel.org, amoorthy@google.com, dmatlack@google.com, yu.c.zhang@linux.intel.com, isaku.yamahata@intel.com, mic@digikod.net, vbabka@suse.cz, vannapurve@google.com, ackerleytng@google.com, mail@maciej.szmigiero.name, david@redhat.com, michael.roth@amd.com, wei.w.wang@intel.com, liam.merwick@oracle.com, isaku.yamahata@gmail.com, kirill.shutemov@linux.intel.com, suzuki.poulose@arm.com, steven.price@arm.com, quic_eberman@quicinc.com, quic_mnalajal@quicinc.com, quic_tsoni@quicinc.com, quic_svaddagi@quicinc.com, quic_cvanscha@quicinc.com, quic_pderrin@quicinc.com, quic_pheragu@quicinc.com, catalin.marinas@arm.com, james.morse@arm.com, yuzenghui@huawei.com, oliver.upton@linux.dev, maz@kernel.org, will@kernel.org, qperret@google.com, keirf@google.com, roypat@amazon.co.uk, shuah@kernel.org, hch@infradead.org, jgg@nvidia.com, rientjes@google.com, jhubbard@nvidia.com, fvdl@google.com, hughd@google.com, tabba@google.com Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: D767CA003D X-Stat-Signature: canqzdayq8gpdkq58tresx6tfhqye5w4 X-HE-Tag: 1722502898-170398 X-HE-Meta: U2FsdGVkX1+1ZTVvjKo/1xO1PuJ/WzPZsnxrQdwLouqIwQ5qYKokwWB7cHOeiXSpbWj/FhbhmmPTmWrzLeejPL/09QSXh6HGcr+j25DrfWyn8TlQCHDhORafXWVrpLwgujOA3OGWqnl6d8NnRgC1M5XAWoVxTXAmc9FNOI0Mxqvtxg1UaSNolgIW5jkKiJYA/f1NwALCtTyGJ9X22MEMFlGYwOq5qajDSYFB0h7hjAtJkidsr+PLysFu0fDrtm7SaNYy1qlQN2zTAIifGfcw58QEQNzAcIyyJGfSKI4KCDwCd8ctjYcC0exuqQgstRuqxTDkHEg1McTOTUcjF5wOIxmvBViz9C+pcihFvQAOdvDfsQTJe+J9v4gO5l+VLHIDt2ovfScCKRsgtx06Kg8pPEMLIr8O+EvDJRKRl+jtALcrBFZq9uSN6x7zcX+T3cH0xq22cb6dmzqrBI129yohZftrHTMs3UVhVsZopUVcN0sfgzu2mx+s4H+O/ANvY1WYlPC/6bybowCRXrMqMTLAUBLiWJfwXkD1oI25BYaDVqdpWTumJzFtLMvh1xnLNBfTuvJzGvQLHxcItkRWNYnrEb+qySavwBk0VTgbIa1p9jDFfouAaeWMz195jXkijqg1tU+WYuE5c9crohU8+tCBX2Hamu7CCN7iD7zKFyBnGNplBW4l+DDynW5i+0Hn3PlA4WmuUNFncIOIBJSA5eSDyyiSiht0P8kdf42kCVlIyYdyuP8WR3jWeE7rmqLtEOQVYh7YJHHezWBD83475hO+M7DYLK+nOYcg8elYtus+0lqFFDBO2A1fnh0M00ccT+EYxpR5XHa/5auGd2hhtBOGV3UDKF9kfuWuNepPejoImTtSACI9g3BYJ2s1hpv9aOap5jClg0JpP8jaH1N8pSUxsPkauKt0laQV1ep1oxCA++SYL2fsTiOkALbCgrR0CnUKruJFmdkrOX64v0WnFeg wClqDxWY LVEdZgBTN54rgVpdVvj6er2Tv7OrZ1728eL7FJNbTEoTQgnVVbA9PTaqfhnyA/5tk11rR1GN8V12iJMyPKHF2j1c0uaI7/Gy7XqAmAIRuGZr7WeyjYPWTEVP/7mzNLjry8frrsKcPhbeIBUKmDIswe5nQhTzE2plXnUJMS9+3d5k64ZHlVT9MevFPg1znuhgtSTDma7AMWzWnfsWfsPezkoJG9+mNLAFE+UqEfq0ZcalXZzztg5D4kyABDhkNv2acguNMhK4iZPn6QMIW0U2V8dSdR8bg8ih0vpSKGMYTN3gbGbbvBLUurB9t1I4cW4qPQxBk8ovcmiGrqeo7KBOwQa1jeF9NR091v6PR/oAwoGm7nKnK8tz4rvWPVxiXeAyBpTjwSW4LPQ26P6pVmz/JEk0kdEr2UEHu1yuGOxGTe7RJNY5llG6q67jKpx7QwLBObTtjZvY/hSmdOjPRgd4/cVAl+nbAtwOW3PxGmhfF+x0PADisLVyjoZirbWNURckaFzAapgswygrACviuaSQDf5k1whmbQ9mlWWbRjlZmYh9IpebYmMKRRdg/dt4QpTIiRDsJP/sc3F1LDes= X-Bogosity: Ham, tests=bogofilter, spamicity=0.004420, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
KVM: Restricted mapping of guest_memfd at the host and pKVM/arm64 support
|
expand
|
diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index e632e10ea395..b1fc636fb670 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1970,6 +1970,10 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, change != KVM_MR_FLAGS_ONLY) return 0; + if ((change == KVM_MR_MOVE || change == KVM_MR_FLAGS_ONLY) && + ((kvm_slot_can_be_private(old)) || (kvm_slot_can_be_private(new)))) + return -EPERM; + /* * Prevent userspace from creating a memory region outside of the IPA * space addressable by the KVM guest IPA space.
Handling changes to private memory slots can be difficult, since it would probably require some cooperation from the hypervisor and/or the guest. Do not allow such changes for now. Signed-off-by: Fuad Tabba <tabba@google.com> --- arch/arm64/kvm/mmu.c | 4 ++++ 1 file changed, 4 insertions(+)