From patchwork Thu Aug 29 21:43:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Xu X-Patchwork-Id: 13783933 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C801DCA0EC4 for ; Thu, 29 Aug 2024 21:44:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 41ED56B007B; Thu, 29 Aug 2024 17:44:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CDEA6B0082; Thu, 29 Aug 2024 17:44:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26E266B0083; Thu, 29 Aug 2024 17:44:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 093476B007B for ; Thu, 29 Aug 2024 17:44:06 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 8EDE680A91 for ; Thu, 29 Aug 2024 21:44:05 +0000 (UTC) X-FDA: 82506611250.05.2AA10A4 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf07.hostedemail.com (Postfix) with ESMTP id C5C7840006 for ; Thu, 29 Aug 2024 21:44:03 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=HwKm5fSi; spf=pass (imf07.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.216.53 as permitted sender) smtp.mailfrom=jeffxu@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724967755; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=IK5nX6Fz7aZSj3TONXgJWUNXXUeXSM9VDMyRB+JVgZA=; b=M+m/oamM6fzrmGmG8FCBh95AnOCUFjDWHLwvcjjfZT3Vu3nDG2X6PDolhSTKYcqqtUpei4 VBjsyQLWeEK0bfY07ASbzOOa3xT32kdA0zUETSdKMlBSnaHKy48OaxvQ6EfI5ehK18f4W+ PPWx5QhjXlpjr/2LZHMlyzIcKEwQi/A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724967755; a=rsa-sha256; cv=none; b=eT4SEZZD4gRZQ4MiCr/H/sAHgVOp4Sj5wl53PwddQK5lNSNFFnfS3+7BvlImkS7layE+rT oUoqArlRt5owr1rr/n0//0r6LTvIIVbD5w/6NgmnFiffmcZ8cZrnwo0It4fPiWwru7NdFt 1IEM83TEwVHu0o9mF6q6xKWMnaNCoRI= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=HwKm5fSi; spf=pass (imf07.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.216.53 as permitted sender) smtp.mailfrom=jeffxu@chromium.org; dmarc=pass (policy=none) header.from=chromium.org Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2d3ed48c748so181465a91.3 for ; Thu, 29 Aug 2024 14:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1724967842; x=1725572642; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IK5nX6Fz7aZSj3TONXgJWUNXXUeXSM9VDMyRB+JVgZA=; b=HwKm5fSiuHkEoOzZ7tSE5aXnYq2vOoL/NUahYQnjneiGiBlUy05qdFzqV7ga1lIMCG KuvB/wG7PAv94w+5qzaU7FmegJjeyG+kOlaOd3CnW+0LxziGY236js7MDjfHfa1N1tZN VJqbciowlI5cWzPTy8agn2pbX5sB2wBbqsoGw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724967842; x=1725572642; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IK5nX6Fz7aZSj3TONXgJWUNXXUeXSM9VDMyRB+JVgZA=; b=AOpqnORzgWvAJJS4w1ZgAYW97Z4E3mXJJ1ZYhfatHnj0SkyKw1kXxSmCDX0D4xKPz6 EFGmounrKd5OCDxOyM3edWREN0oA/c6dKWo+q5sEnoHUbLPnxPFI3EBsZ1Fx4tPrkn0n OvjZRU1XfKONFUua8p1+zGRHeeo8afgXAZ35SqLRxCRQN8K/fhOMhYpvprMOySauOtrK 8PTANzjKEAbWZdftmwGyIz0/u/AvwfjZgSAlznK/AggD5YOlDABe0ZkqCVyRhPJH2CWp rSIORnz4k0JGswSLe0VKLOK/OAhRHbfGzkpBpnvoXl4cugJl/wjHq2iFuQNOs+fx/9EX yBIA== X-Forwarded-Encrypted: i=1; AJvYcCU+6v6LP/5TsXhS/wGRLGjdSMmezAx3lwiFwm6ghYmWFzFemp3XR7rl0hDc4tcQplq0viFbpm9xRw==@kvack.org X-Gm-Message-State: AOJu0YzGF75jy72xbbR73XCrwo+FY9IMan4RE+7TadpSpLiDr+EOJQyj +RmFcAKzvRKR+PJIpf6gQ5sHhYhvwamr/btqtpOgAqCflnYkeQJ1oQ34C+wHEw== X-Google-Smtp-Source: AGHT+IGFvjpKVKwU+AAy50ZE59B8TjM2zpkvqC2OVhuQeRtuultPa+ORe7Ydhsh/c2eWukZ+bzk+sg== X-Received: by 2002:a05:6a20:6a27:b0:1c4:dba6:9eff with SMTP id adf61e73a8af0-1ccee3a8b83mr193225637.1.1724967842061; Thu, 29 Aug 2024 14:44:02 -0700 (PDT) Received: from localhost (150.12.83.34.bc.googleusercontent.com. [34.83.12.150]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-715e55a94casm1592892b3a.70.2024.08.29.14.44.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Aug 2024 14:44:01 -0700 (PDT) From: jeffxu@chromium.org To: akpm@linux-foundation.org Cc: linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, pedro.falcato@gmail.com, willy@infradead.org, lorenzo.stoakes@oracle.com, broonie@kernel.org, vbabka@suse.cz, Liam.Howlett@oracle.com, rientjes@google.com, keescook@chromium.org, Jeff Xu Subject: [PATCH v2 0/4] Increase mseal test coverage Date: Thu, 29 Aug 2024 21:43:48 +0000 Message-ID: <20240829214352.963001-1-jeffxu@chromium.org> X-Mailer: git-send-email 2.46.0.469.g59c65b2a67-goog MIME-Version: 1.0 X-Rspamd-Queue-Id: C5C7840006 X-Stat-Signature: m4nhcts4w36kue7pzdp7eozt5sw1pfrg X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1724967843-134517 X-HE-Meta: U2FsdGVkX19tLM3Maz13nKs4KJoP30bKjHQrZWLhVqva34kU/2sYFHDpHyPv7LRo9VEek1gGhHsQ9w/02U/sk3EQDXwr0OH5vpjqAF2DXoHZx/DFRCxPsKFd4UrpCAlhV/Fu1T8X+fz+hFJPbAVTey3zpty0bYhxt4OE1Le0sMDP2gWKBXJw2zkCF8zah0TmDQ0nvr+Zb5c/Eti0WQOEdkiFRDF7gPv4OPWUa7v4B7vwFXHqed7XJZ+KxTOfqHRnPOWv1rSFh8J5mtoIhJ75f9Btgzyp2ueqkCas7I5abya+LbFNw9RKh4BCis3CeqyDzOZYvR9mfMoaCI+HpaGoz9Dy2Ei8POKd48AntGgeblx3cWGSXN1w7DunWE44TeYZlz09nZJccoMUIjRqNU1wGHeh9VC0GOn3ByzMB3qvkMdbLuN1CDBqfHr2Ju/kdKIVQCT5s9xrEgWmx0AfjTj+7gtosQqgnW76yRTR2UcEXdp4uilmYCyINPA6wrP5hniiWUJRglbFkmzZZrLGXrZgu8u6cDER44khtTXul1ygnbA5C6mK4IxDhSfIRv/rVj7StH7mhv+xX97VqyKlK9rIz+Qw49IAp58X6/PNgKy1UGfQ7ZnrEk3iBw7Eb6w8ncnd5hFkQzBNsfrHN6VNl6MZatPCfz5SaTS/CmGRUOxkV3oX2fFC2z56TpADUoaYh2sLQ7ANfxeJBdnV3c+LCXgE0fDTnihY75xp8f3pUGiP6O2DvqezYi4OrsArS5W8ShVhj8NbfqOwO/YC6xkYqzFqn+XetyWnTRUt0QcmWpQrQopNG1g5cx4YKRt1ZLNhhVXF96uw3MYYdnjqz4xJhuYgXAzt0chdvmjc2YC/2zGcACim687pTkua/tBXrTd0ejvlmZRIkyPfU2DeUoD0BZmk4oBdJxFUtt/iJEY2bTXgozcJg0Xnc5iZ+yeO9WXwxMnQ20K/1DuCXZulVVDppCt 1Faq1OfF QU5rTiHOihfbyEsvHyK5xNsCL9f1cGGxUb0AT0eyL1IKdxsc5I59sEhguK43DL2c0SMGO9xWAZgVCGm9fU5zyfi5Df4PffVs/zcgPukk1wiUJSL1Kk/DrnahPaxVRdw8juNfTxpJPYbwAX+lGqk7piu7aY0jhL/Qm8AiNhcLaNvksyw1s2Arb2NTfkj5Y6KXl8KA0wgoLk8yPO/gEPu8EPf7GCcRSeHhujFA1U2JumWGtcWJyinDkKH9rh08hTk7lQHln7lzhWahbWWmxiHBWACJiuTJjLGjzgbUwjw4OHn3sqXU729SRGL9ol16uDgMXQVBw1Ykbewx3lXmMTYAfxQt87zoRwdbwlaKXYnNZx/AssTTX8RrH9bScX1KgUwt1xNG+RJuA4/qJhpoLO2zsTc49Sw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Jeff Xu This series increase the test coverage of mseal_test by: Add check for vma_size, prot, and error code for existing tests. Add more testcases for madvise, munmap, mmap and mremap to cover sealing in different scenarios. The increase test coverage hopefully help to prevent future regression. It doesn't change any existing mm api's semantics, i.e. it will pass on linux main and 6.10 branch. Note: in order to pass this test in mm-unstable, mm-unstable must have Liam's fix on mmap [1] [1] https://lore.kernel.org/linux-kselftest/vyllxuh5xbqmaoyl2mselebij5ox7cseekjcvl5gmzoxxwd2he@hxi4mpjanxzt/#t History: V2: - remove the mmap fix (Liam R. Howlett will fix it separately) - Add cover letter (Lorenzo Stoakes) - split the testcase for ease of review (Mark Brown) V1: - https://lore.kernel.org/linux-kselftest/20240828225522.684774-1-jeffxu@chromium.org/ Jeff Xu (4): selftests/mm: mseal_test, add vma size check selftests/mm: mseal_test add sealed madvise type selftests/mm: mseal_test add more tests for mmap selftests/mm: mseal_test add more tests for mremap tools/testing/selftests/mm/mseal_test.c | 829 ++++++++++++++++++++++-- 1 file changed, 762 insertions(+), 67 deletions(-)