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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02473C7618D for ; Thu, 16 Mar 2023 00:31:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233060AbjCPAbV (ORCPT ); Wed, 15 Mar 2023 20:31:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233082AbjCPAbP (ORCPT ); Wed, 15 Mar 2023 20:31:15 -0400 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31CCEA17E6 for ; Wed, 15 Mar 2023 17:31:13 -0700 (PDT) Received: by mail-pf1-x449.google.com with SMTP id i7-20020a626d07000000b005d29737db06so169614pfc.15 for ; Wed, 15 Mar 2023 17:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1678926672; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:from:to:cc:subject:date:message-id:reply-to; bh=hT7y2XaFexWW4GTLeQpLaRg79NNFfwA0Go2glRLgBd0=; b=Nz5kUB5UsktVLM+1ioYn0/f+EE3tG8bYDmBZ7k4J/Gt/p5gTfQtvXXnoIclpQPuDya iUSZv4Ya8c29iPtlOA7O8kWfsasypPc8z6XfRhbOcsmBwYKUvOolqz9fQyk7NgQiLh/7 c/HaSbFKMHr9gsoqPFgvukhunTri9uzxM+/T1bb2dlQR9ihIBftzfIgbbB2EA9ig0QfN QH/Qst7Frnk64y0MYkI8/9p+OMNZJnbfWHBkKL+LoqwoHnfU22JRu1wnbHr5/KauoW4g wseQ2RJb2qNMKAO2J1HN6p/Ws+7+zkBAtzloNtEG5key9qZ2BL1aJc7RLJD21ClZZS8U CQZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678926672; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hT7y2XaFexWW4GTLeQpLaRg79NNFfwA0Go2glRLgBd0=; b=6es86w9gu0AR2/pQ4lqoePclz1kP6kzPrYjR5I4haStFbwDNBB5KdsC0sGYI+vmM3x 4EZBNQ/3ncwhJc3NeYxa7ZvS28127pO4pwlP7T1aj5VPvPuXolXt3JNgs9+ayIO7n+oh oL/5hYPVDkKZbcmhR0JQDO4a9t379bzzAC4OgFnGHIxL9Vsdt37ST7MPCJwEopWMmPb0 POuxfAbT4unARsd0JaQS2FKwXH7bZpY8ZTvVIM4g4Hcscybk/CSZDAxKED6aP0wOB5vG L2Kro32jn2dGbbPXT4ZPzU6cmSPmWos2lHK/unJJHNFO9v/pv3Kkavz6cX4RBmgD6ucz CoIQ== X-Gm-Message-State: AO0yUKVtNbzksvl4yocde6ZuqbkjK7iYJS8EqBvMZJJfQEI7G/q29CmI m1MJV/kZBQcWyPtDlDnHvJMt0NfJam2zS09OCw== X-Google-Smtp-Source: AK7set8RzBYOsHbOBr2r5L/IBVJur+dXP5lqulE2m7qrJjHyB4MEFVa/vv90/0ZD7J2Luh92QLgQMrMQJM0g7dhFsw== X-Received: from ackerleytng-cloudtop.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1f5f]) (user=ackerleytng job=sendgmr) by 2002:a17:90a:ea89:b0:237:2516:f76a with SMTP id h9-20020a17090aea8900b002372516f76amr548955pjz.2.1678926672510; Wed, 15 Mar 2023 17:31:12 -0700 (PDT) Date: Thu, 16 Mar 2023 00:30:53 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.40.0.rc2.332.ga46443480c-goog Message-ID: Subject: [RFC PATCH 00/10] Additional selftests for restrictedmem From: Ackerley Tng To: kvm@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, qemu-devel@nongnu.org Cc: aarcange@redhat.com, ak@linux.intel.com, akpm@linux-foundation.org, arnd@arndb.de, bfields@fieldses.org, bp@alien8.de, chao.p.peng@linux.intel.com, corbet@lwn.net, dave.hansen@intel.com, david@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, hpa@zytor.com, hughd@google.com, jlayton@kernel.org, jmattson@google.com, joro@8bytes.org, jun.nakajima@intel.com, kirill.shutemov@linux.intel.com, linmiaohe@huawei.com, luto@kernel.org, mail@maciej.szmigiero.name, mhocko@suse.com, michael.roth@amd.com, mingo@redhat.com, naoya.horiguchi@nec.com, pbonzini@redhat.com, qperret@google.com, rppt@kernel.org, seanjc@google.com, shuah@kernel.org, steven.price@arm.com, tabba@google.com, tglx@linutronix.de, vannapurve@google.com, vbabka@suse.cz, vkuznets@redhat.com, wanpengli@tencent.com, wei.w.wang@intel.com, x86@kernel.org, yu.c.zhang@linux.intel.com, Ackerley Tng Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, This is a series containing additional selftests for restrictedmem, prepared to be used with the next iteration of the restrictedmem series after v10. restrictedmem=C2=A0v10 is available at https://lore.kernel.org/lkml/20221202061347.1070246-1-chao.p.peng@linux.int= el.com/T/. The tree can be found at https://github.com/googleprodkernel/linux-cc/tree/restrictedmem-additional-= selftests-rfc-v1/. Dependencies + The next iteration of the restrictedmem series + branch: https://github.com/chao-p/linux/commits/privmem-v11.4 + commit: https://github.com/chao-p/linux/tree/ddd2c92b268a2fdc6158f82a= 6169ad1a57f2a01d + Proposed fix to adjust VM's initial stack address to align with SysV ABI spec: https://lore.kernel.org/lkml/20230227180601.104318-1-ackerleytn= g@google.com/ Ackerley Tng (10): KVM: selftests: Test error message fixes for memfd_restricted selftests KVM: selftests: Test that ftruncate to non-page-aligned size on a restrictedmem fd should fail KVM: selftests: Test that VM private memory should not be readable from host KVM: selftests: Exercise restrictedmem allocation and truncation code after KVM invalidation code has been unbound KVM: selftests: Generalize private_mem_conversions_test for parallel execution KVM: selftests: Default private_mem_conversions_test to use 1 memslot for test data KVM: selftests: Add vm_userspace_mem_region_add_with_restrictedmem KVM: selftests: Default private_mem_conversions_test to use 1 restrictedmem file for test data KVM: selftests: Add tests around sharing a restrictedmem fd KVM: selftests: Test KVM exit behavior for private memory/access tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/include/kvm_util_base.h | 4 + tools/testing/selftests/kvm/lib/kvm_util.c | 46 ++- .../selftests/kvm/set_memory_region_test.c | 29 +- .../kvm/x86_64/private_mem_conversions_test.c | 295 +++++++++++++++--- .../kvm/x86_64/private_mem_kvm_exits_test.c | 124 ++++++++ tools/testing/selftests/vm/memfd_restricted.c | 9 +- 7 files changed, 455 insertions(+), 53 deletions(-) create mode 100644 tools/testing/selftests/kvm/x86_64/private_mem_kvm_exit= s_test.c -- 2.40.0.rc2.332.ga46443480c-goog