From patchwork Tue Jun 18 02:24:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13701688 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2077.outbound.protection.outlook.com [40.107.243.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CBE58480; Tue, 18 Jun 2024 02:24:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718677473; cv=fail; b=iuwcNWi6ur7eaVzvLo+ppwhsnO+mJMme8pHP6qBNqQcDXUwSD7CkQAIN0TYs09fdcbJ/wj8xbkgVZR/mL4NfKC0PZlFjemdIyhB/QOJR3gTFqRYvS3lX1yxJBoOmVv36lyoGv2JH2oYguYm1uPQEuxLIRlq03s51T9MqqKnxw2I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718677473; c=relaxed/simple; bh=3kKU3Iv2MQSLs9RBBYp5JmIGopyG1qeTf40HgZdb4Wk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=kLjQvOjj0uIQ/lk/q3El6D06/cedtfwieqn8QnH3rD8amZYSbf9xIMYXtBFYw8HMEPNHVGBYa23ftHlQIz4XhpWIpbpsGNizr+NvcGxk7/lqH4VBJXxdVrLKKXjIUzsp1dB4EfIrwiC8DGAYISSpr/2AOGFYap7zlczCdXMIBaw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=E43is4V6; arc=fail smtp.client-ip=40.107.243.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="E43is4V6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jTaN8WEoWmx/e73Udx40q88mLJrC2XbtkY3drhV5281X3bam2JWlHOHA7oeExtB0kQBKhP0wLbqETLtCsJSCLWvAFyyRNPA3PPPkA7CpxkLgt/AWWwWCxNKeWYmEKgkN2jK22h5kGkTUYRZR0vYzyBMICImpACe0JDcEQwNMDFcnss0NkCFgU06PmPj9rQ09U7zMs7crYctq1ozSfF674Wi7nK/3BRfLjOxOTAxHkrYVrDKDBL1W8steQy2HstiNWf4pWW0zGXqXUQH0LdjUxLZnjL2RMtlyrQmkTpPEcWzn2BRWVG27eAPk/Vzx1h8JpZz6vjMJTdGDVJAK0LlrbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R8HvqjHRkzHLq+KJUf8MEmS7IpTqRMglnhAc5buWyAE=; b=SP0XQWUiOQ0bF3QxDtwycZ1aKXTA9RTYWetwElW5opJ4nDk92tNU8X8WVk563HppjOZL2R5CNniCXWZtPNQiTqUOxLreDP3qn0dhlZubETKURuonAGalm0Xa9WZkgVv3cuAHrnrmJpamNDPjZRU1o6dW2DOPNLI69Y1ZHgBECjzvpxU8rGiQToJtljIgwCziZiAqVBEhjD+Y5sqgLycwkKLC2NmNN9fCcyV68p66d+eL9EmCb8m+XeWkioswnResOTvhzIK7E17dLkJcPNqGIpA7CG/k4T5TEI6BoBNtAoIVES2tvHdLFUq+FSMbGJ9y2+s1ZXuThSe6RJefdB+fOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R8HvqjHRkzHLq+KJUf8MEmS7IpTqRMglnhAc5buWyAE=; b=E43is4V6/fxnwUDD172fzM6HD2rfXP0UyPYecifbxslEa9QhKa9pJQrOTUzTjGeR+C/lSin8tDLblGOcz9/3YqjUB9lB8rYLZSTtHnMJLAySxLrzIWV35xwpkl2+za3i+uBh4WloAMSq2eEPi8YouRJMXsPAFcFxx10aP717XHTgALQ5y8eKGfGWt9lUVZzgLuljgOhl9rudM8Gwqcx+IkdCZI5L31vAR5SOLS0ue3WozYOLUO/6LSGvj/HUIys2NZ203UClrxQYh4QC4Cqa5UdfMECjaD8lFXSg3CL7t24/1gHRQaSwBMTD2w6XJ5nPEfPZviYvx1TTnocunEzFDw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by SA3PR12MB8047.namprd12.prod.outlook.com (2603:10b6:806:31b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Tue, 18 Jun 2024 02:24:25 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7677.030; Tue, 18 Jun 2024 02:24:25 +0000 From: John Hubbard To: Andrew Morton , Jeff Xu , Shuah Khan Cc: Andrei Vagin , Axel Rasmussen , Christian Brauner , David Hildenbrand , Kees Cook , Kent Overstreet , "Liam R . Howlett" , Muhammad Usama Anjum , Peter Xu , Rich Felker , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, LKML , John Hubbard Subject: [PATCH v3 1/6] selftests/mm: mseal, self_elf: fix missing __NR_mseal Date: Mon, 17 Jun 2024 19:24:17 -0700 Message-ID: <20240618022422.804305-2-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240618022422.804305-1-jhubbard@nvidia.com> References: <20240618022422.804305-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: BY5PR17CA0019.namprd17.prod.outlook.com (2603:10b6:a03:1b8::32) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|SA3PR12MB8047:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a0e7556-e47c-4d52-283e-08dc8f3dc579 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|366013|1800799021; X-Microsoft-Antispam-Message-Info: GAkBOa5I7P5d+Lb6nzdje4PjhN4b+ZnA8ohQzn7dUQUiTY16XPeZH3vjI9qUfk7H5+nG5l588bKMXiqBbi/B7CaDShB3Td9D5SMLcOvvUF0bbGOQPzqn+Zmz1Hx9CfP+NO/fM+o50IMTtQA7IBf9rvNzSQja0Bf2ntNeTAMMFtxr8477WQl72W5nEqoUnNQAfJUxyUHf5uC+Eu2pcXnLc2urF1ORsVQ+iBFfTc4p0058N09RXMzIEZdBqznrIAjYSU8+ziPyTU4NQJfITonP8fWPreasJeYiHei7di4L6noVJaQC/RP/V8EXfxneptycHAi5DalXAuNwGyA6u/PMq05ZAzZu+MIP0yfQXUMnvJH0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d12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(7416011)(376011)(366013)(1800799021);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w5IkvCOckEC9NzwXJudFZwCYK0MovhTN7Z86fUGJL25SGv9BRNbs9EoepPC14Z3F4qvRAqLej/FOs/Q5ElmqZgMGX9jg7hHhJ9Jl7gCUhW6JfzRUXfO/9t+OEsI3IWMtfRWyO/5oyfdheUiAycbfTjGkRhLOQ27/vBOorloVV/uJ8Cs4mDT5DyAd55jyxKco71OvCd++vTUirCXMjI3G8gkVWwoE/dETIvje1XGRZBOviZmBrmeJqgCP//eZlFX5eXHwZLfpnWwFR8KpYyrCuiSTT1gtl/pYZrmq+VU+OXOsfaG1SUFJ79dOosuWbwlc2aJ6dybn/LN2dphN6nG9hfu5PASicFyXmahfhJXA8RYvbozNdXuNSeaVKbRXBiTHiVJtxpn28/CMAXq1JSJXx0jg0R6kpWpIQ3uNr/bSL2j3oSNVWiDiY5SYrVIoyezvVCs4xovKNAbHpytffXz6Zl0vW9QT1pltzN/ryLbO2tnU/JqJZMW5W5CKU2aNPE2ss2rW35eqDvLp0iBzwN86k5TiALRm4kZCPLhEM8ib4VkNDQFFV8EdkPdNlr7bl9jV1nu/o6MsDms7gaUeFE2A3IRYEXFPEApunf2y1SD8W0FGfiLX3IlurjUeTuvi9CSLuM6zk4F4jUFfvRzQHUeSROMr/Uf4CxaLJZUan0nKWuMg7RiLx7Dt2iwTPmBNHNXruUS/XnA3fjF1XbvtRaD1p8yoUWIreKFi8KA6WYfZosyYEQF2r5zaJhUB0patLSSHkMChaWVJ+JmJUiJMfxB2VbTOFDqHYffffFQnLRZyzAEzGOlPwmlr8ep/4SGIAJewDjfjmh3ChgxDkyEklDk5FdOqjMKMhhGSuYMSPqhqU74koTcvA0p1mEzoZEFDHtFjDYaBlEEt+VHF5e67jjbIIcRK5KSTnfxPvOrjCX0zgVJHR1zqceF4Wid4e0Ft1Zl5srbfmMquwvuXD8EuFvNhCuD+f+bLIlLZWsOrynnyywX8lwl0zYddV0sTpNm+I2EtUs7QYnONDmHPcTxmkZboi/imionhEh4q+mivgKZT4YeOOcFng/GokZ2ahuSsa/b1zD7iLP3GgndnD26xNn1UKQ8CK0uSkFuxFLf5l6p/qA+eUnWhlfcLaqnCOWOFHnno0nKyFBXXVh86ruqA6oG5t2zKFJUbrW0T8eiMbvJitlOJmhRj5k289uCwL4hv7JsMpC5kvQS2eZ82y3G/dWcfOjg7kDCVH6CvSce6ovRV7ZDmbfUssIRwtDIplcJs54om2sySX4LrJkkL322bks4pkp3Iw/OjZzjEMPXNAZdMHH1+Bo/c/pVnirLL5g5XVJrpc+9v8Ybf4LDizLqFYZkt3esa6y0bu30lGT+a0fuRNZAARplPssiTFQbmi7xEAyI/POCGjapJK/f9SitJu7AhY2Y9QZJ9oV7PVXSCSDczMuCyEuVI2vVCq1NToLtp8S4QAatK8//NJRYXs/wnwafdJ+kfZNY34W66NehEjgGpeMc9iza7mgpS6guZ8ixZgiF/jyokyzQctbHDcP33A8c4G5baG71yJWIKtLWhiLdaC0gxZpomOKfZpolit3/RVWPl X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a0e7556-e47c-4d52-283e-08dc8f3dc579 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 02:24:24.9774 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UFWfrOO+sRi4bMjpfbLz6mt5M+lj4d44gCdhBZ5T8ZjZvsjoAHdKCvjx/+glUc8evydDY/FExAsaZN29+YPL7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8047 The selftests/mm build isn't exactly "broken", according to the current documentation, which still claims that one must run "make headers", before building the kselftests. However, according to the new plan to get rid of that requirement [1], they are future-broken: attempting to build selftests/mm *without* first running "make headers" will fail due to not finding __NR_mseal. Therefore, include asm-generic/unistd.h, which has all of the system call numbers that are needed, abstracted across the various CPU arches. [1] commit e076eaca5906 ("selftests: break the dependency upon local header files") Fixes: 4926c7a52de7 ("selftest mm/mseal memory sealing") Cc: Jeff Xu Cc: David Hildenbrand Signed-off-by: John Hubbard Signed-off-by: John Hubbard Acked-by: David Hildenbrand --- tools/testing/selftests/mm/mseal_test.c | 2 +- tools/testing/selftests/mm/seal_elf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/mm/mseal_test.c b/tools/testing/selftests/mm/mseal_test.c index 41998cf1dcf5..58c888529f42 100644 --- a/tools/testing/selftests/mm/mseal_test.c +++ b/tools/testing/selftests/mm/mseal_test.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/testing/selftests/mm/seal_elf.c b/tools/testing/selftests/mm/seal_elf.c index f2babec79bb6..27bf2f84231d 100644 --- a/tools/testing/selftests/mm/seal_elf.c +++ b/tools/testing/selftests/mm/seal_elf.c @@ -2,7 +2,7 @@ #define _GNU_SOURCE #include #include -#include +#include #include #include #include From patchwork Tue Jun 18 02:24:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13701690 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2077.outbound.protection.outlook.com [40.107.243.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2BF41AACB; Tue, 18 Jun 2024 02:24:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718677475; cv=fail; b=ScYNMSri8/CWc5Zy4EgwVD0tqHFDBSszoTCX6ItwV9Nx8IdS168Wg8o0eX63DxF/130YgEqelnRBlc8oT1Iz52isQUy0yexY7hG4xfdtJGr1M5tJ+dMvb3mpKAZ37G8rOB0cEwu271CIbkvsjtBCWffd9yBk3kBoCXmcvZMCNMw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718677475; c=relaxed/simple; bh=Q9yVaYxP8sXzx0RKf1BLOgepyfp91n2T58njt7eot+E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=s2gFm2O/5sTBa/aPJIBocSKclHUvL8kFVP4ZzT/eWuBE5kkhqnQ7ylk9BoLu1jFGlvQnEUWNV8cxQ9L8OHdbgkxI3QwoWkJ+7QmdUWlKQaMOsm5NpjTSLLKNovimDHJhhB3DbfEhjwO1NQ15Zq0JK5ZQx6f8Tax6oQkYGyhdiu0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=R9dQgSVt; arc=fail smtp.client-ip=40.107.243.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="R9dQgSVt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bAh4RBpjOajOqryWUlJe0lQ571wKD2l9BV+/z9YG42/lwZdHC4hxG4+0ROVCSS6cPGBmh3HEB+BVaiSFqpXRuSiwT8cf9Kvgy7PvqV+Cn0uqtAvS3SkE2dKQ6Jnh1H/P9EUvukXbgSnCvci9LDVMwuHpRaAr2G9FTnrlziwjMD2ktPxbg/HXzTvNb8hoJTOOEY8JgsAkfXcDQ4uu938VPbS7Y6FP6VkREz4hDTNdJ6dmZJOu3H6abTzV3JAqu+vQfWWrUZv4XQPtVTZysy1bg3XmGo+r/yj4BnN4LHxOU1cyu5ePcT5vkPqXzPKNezzl0nR3qOKOYDnCcyTa6X6MJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lND8relr0oO4VJNIro7up2xxQynbvMNqIHPRAUyXI4A=; b=DgVuwnH2KY9QBm+a8kltOL89WMYCektTMrwyQ4Wvl8Qa/pLyWjdLPnzc+FQo1A5pgOPddbHxkwAzgBt7ssu6gSKohtnV/USzFBDtvCxrnaywqrDN62u2WQhRhDSt68Vs1TPsQaPwEgJue3y05lYSqZ3K76924LvpObkh9IucqgwrXatsPbGDj2zHDVvCbKv4OXDwOMf0qOgItpvzGy2mAZGu4Bo0UeNKfobhJZQgYtBsUcrPEsmrrEIzecmdBDR37ePLug/8QtifWo4IGLRWO1fP/zXNTU/uDvjN8goZ8+fJ+E/X5QrG9bcDYuannk4zo9XDWmYqmAKKqJYcx+CUDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lND8relr0oO4VJNIro7up2xxQynbvMNqIHPRAUyXI4A=; b=R9dQgSVtakbqUZJvgOFzVbj5nDb7vCpkXkyYnJGoRKdgnaQhY1Gk8LR5aUvzRU5ON1Cm8z1lm4YJwtzJ5pkGkJVDnxej0kwS13GTIApa6+h0LynIOqEgvpeYD9NUGw/s1RJ/D51RzVoMAyuyjKSKfGzH3nIaFYAbyU12dSTDjicf3u5dveQAo2A/2dlQHoKnGI0UvDVkYuGeDMWRF5hVdz+lI5EH9/LcyOg090RM5TRpJhm/T9qV3c9H3r22fb++yA1Y0m5yswkTasaHrzxXYDm8K2rvqaDE6O8AeMONG4YOAsblfKD0OD4JCGpwJBU2eXmvbNCT0SfIH0FbE/io/Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by SA3PR12MB8047.namprd12.prod.outlook.com (2603:10b6:806:31b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Tue, 18 Jun 2024 02:24:25 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7677.030; Tue, 18 Jun 2024 02:24:25 +0000 From: John Hubbard To: Andrew Morton , Jeff Xu , Shuah Khan Cc: Andrei Vagin , Axel Rasmussen , Christian Brauner , David Hildenbrand , Kees Cook , Kent Overstreet , "Liam R . Howlett" , Muhammad Usama Anjum , Peter Xu , Rich Felker , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, LKML , John Hubbard Subject: [PATCH v3 2/6] selftests/mm: mseal, self_elf: factor out test macros and other duplicated items Date: Mon, 17 Jun 2024 19:24:18 -0700 Message-ID: <20240618022422.804305-3-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240618022422.804305-1-jhubbard@nvidia.com> References: <20240618022422.804305-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: BYAPR07CA0065.namprd07.prod.outlook.com (2603:10b6:a03:60::42) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|SA3PR12MB8047:EE_ X-MS-Office365-Filtering-Correlation-Id: c4fbb068-b541-45e3-185d-08dc8f3dc5ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|366013|1800799021; X-Microsoft-Antispam-Message-Info: rH5oz+bsGRghn1K6KkaFGKr+PSRDtkMlIsKctaViJq/3ZjyMTwgNqaifHn78FLf9MgvqR82rc+C0KVosK3jwm2aWR8zNX9xibSOchPaJpw4/KmUFyJDlqaBfZEs2PcCck9a6Hex59ypfhZ5SnPR7g0vR06v/Oo7c8yjfBm2pIyNcxEBS8FggwabrdexZJPjn9SlvrCuxWlb5UdL0ZiScr04A5FqAmJCH6fJnEzVB54bim7Hey5bkb/WYZ2fpNZhcZAb/+Ht7Tg0MJIMYcmM3bwG+Ufd3lJL8a4DINxzDZmG40HtjC7TcIb8QqAnVxg6x21XlrBWtqmZtqY7o13al9K0az4VBaEmEh+nnHcBlefjIsndgO5Cz3m0R7+dZGTKEpX8019AO3nQwZ3glIHi10ESe4SZhJRv3aRHqpHbleH3pkFecw8BNGG0M7WA54dCi3mW3nis+IMs3mKjKAUyEWtipVhw2XUkX3BZvI+zRHz0nzBjerkaIKAyoaP9ccvwiVg+Z6yrFXlP4rZ74E1ZOg3ckYmBuQJUPLLaEaeB88Hs43L1utxvsoMGc4oFfAmyeMm2e9rgeLpT118/WgFzqCzyDLJQP9X8NCvTky1xdIIv74IwTYlcG12/WC+rNcSWVr3G8B/5sqbs6GSZqLXTQE7RvG5lFJOxCwmxlXKbLpIzu0ew89fv9D3rakdRKuKF+ngkvSI6ub1eCU0LCseYyKsIYYIgXARqIKG+47bbkayjlj9lhr3ptQZKCctT9GQCBxA6wkPXHJG2C4tbeBLYtCnZ1ymXU3hZqZOZ0nOvhtUHxtA1gn8lep5UY7xQJQzjCnPRTjwReY36vY4z5TFuRiBE7V3LK/xVuJNz5srHgrVk7IFvg8742q95bcW/wtq/FEoZLv6Wl7LAphiQ0oIREbMCDB5ItuyO6Q91zu0x4yWyjJc77SI2rv9lW92qIOGD1w66peb/FMUoRSPoe2ziyL5UIJHtMykWqfYKj8vU4kr0dFS5q6WkG0ryj8o1NUt06wvdunwE7xO1x14khQ/DujkDGGouCsYCmE7bKL+rmLAK5+u0+kGLbzNQrs4u1sbBXowuUnqy0q1S/uTQ7RhZKMGgpx+eLbum3xQ/0BhwgGGf17LsrOLuFv9hHety01Dvh1QCquL8g8UNWxymQMC8BDWpePw4p08JlQbts5sMVxIwraKnIouGB8c53ss/qdKI6obi7M2m95K+XmWXfmv6pfSb7J20gDY2NipaC+Csc+s6oSCZ8pEkh1ks5ZIr8V9lbiCBHefJY6QHEE+KCD4KHbEUOIkCuX8byqLz9WcFoQ3JIYU+/L0wdEmAymcxTIHjB X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB4130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(7416011)(376011)(366013)(1800799021);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HPiPbLStyQDMFAXkQXxwHFi8L6+PZ0bBu7vdN2IoOR3YeDSxDGpE2Xyf/7ubybBL+i6hkdWm8UI2jActJDdWnT6FkBM8WdJn4cXG1QO2h9iBeKitOM300ObzlQr+XsdLNMM8NushrIpNjBqv81wi4gzJ92SsDGZ9pKSpB37F0yw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cFwX/H3w1cc2sg4/Iid4nnQFTwfa7dlE3yySqe4cQ4lGbBgId1fJFgmfk3kL6q4FgJl+A+LGPlLOdltD+b875cR7TkuPKbrLaxJDBtsx1rImNkElcDLa+ezmjxyYu6lwMRFXXYDy2wxY42dwKwdyafRJTMuG44FyuYn/Rlnpml91dcvySSi9y66lo8p7wyFMo2UGHUy88ozQOQbeepUJi6MhpMDP0qRe/gPtBPM97K2HHuZaeNDE9rz12EB51OdWL/3+nzvK4OrJQgCye2kD21A6uBau4n6hKxBI04Zn6TDzcFL24Y50AqBZ08++/orL6S6dKWgOrzZH6F0vOmJJC7pVDNt9ph X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4fbb068-b541-45e3-185d-08dc8f3dc5ee X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 02:24:25.6826 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Hpid2NyCGtmihWlbSOO23pTZsVkOMeeIavtt9jPRtUzZCYa6M42QnqcHL/z3FAxBMK5lxlXdJmqt6LONPOwcAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8047 Clean up and move some copy-pasted items into a new mseal_helpers.h. 1. The test macros can be made safer and simpler, by observing that they are invariably called when about to return. This means that the macros do not need an intrusive label to goto; they can simply return. 2. PKEY* items. We cannot, unfortunately use pkey-helpers.h. The best we can do is to factor out these few items into mseal_helpers.h. 3. These tests still need their own definition of u64, so also move that to the header file. Cc: Jeff Xu Acked-by: David Hildenbrand Signed-off-by: John Hubbard --- tools/testing/selftests/mm/mseal_helpers.h | 41 ++++++++++++++++++ tools/testing/selftests/mm/mseal_test.c | 49 +--------------------- tools/testing/selftests/mm/seal_elf.c | 33 +-------------- 3 files changed, 43 insertions(+), 80 deletions(-) create mode 100644 tools/testing/selftests/mm/mseal_helpers.h diff --git a/tools/testing/selftests/mm/mseal_helpers.h b/tools/testing/selftests/mm/mseal_helpers.h new file mode 100644 index 000000000000..108d3fd0becb --- /dev/null +++ b/tools/testing/selftests/mm/mseal_helpers.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#define FAIL_TEST_IF_FALSE(test_passed) \ + do { \ + if (!(test_passed)) { \ + ksft_test_result_fail("%s: line:%d\n", \ + __func__, __LINE__); \ + return; \ + } \ + } while (0) + +#define SKIP_TEST_IF_FALSE(test_passed) \ + do { \ + if (!(test_passed)) { \ + ksft_test_result_skip("%s: line:%d\n", \ + __func__, __LINE__); \ + return; \ + } \ + } while (0) + +#define TEST_END_CHECK() ksft_test_result_pass("%s\n", __func__) + +#ifndef PKEY_DISABLE_ACCESS +#define PKEY_DISABLE_ACCESS 0x1 +#endif + +#ifndef PKEY_DISABLE_WRITE +#define PKEY_DISABLE_WRITE 0x2 +#endif + +#ifndef PKEY_BITS_PER_PKEY +#define PKEY_BITS_PER_PKEY 2 +#endif + +#ifndef PKEY_MASK +#define PKEY_MASK (PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE) +#endif + +#ifndef u64 +#define u64 unsigned long long +#endif diff --git a/tools/testing/selftests/mm/mseal_test.c b/tools/testing/selftests/mm/mseal_test.c index 58c888529f42..d4d6ae42f502 100644 --- a/tools/testing/selftests/mm/mseal_test.c +++ b/tools/testing/selftests/mm/mseal_test.c @@ -17,54 +17,7 @@ #include #include #include - -/* - * need those definition for manually build using gcc. - * gcc -I ../../../../usr/include -DDEBUG -O3 -DDEBUG -O3 mseal_test.c -o mseal_test - */ -#ifndef PKEY_DISABLE_ACCESS -# define PKEY_DISABLE_ACCESS 0x1 -#endif - -#ifndef PKEY_DISABLE_WRITE -# define PKEY_DISABLE_WRITE 0x2 -#endif - -#ifndef PKEY_BITS_PER_PKEY -#define PKEY_BITS_PER_PKEY 2 -#endif - -#ifndef PKEY_MASK -#define PKEY_MASK (PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE) -#endif - -#define FAIL_TEST_IF_FALSE(c) do {\ - if (!(c)) {\ - ksft_test_result_fail("%s, line:%d\n", __func__, __LINE__);\ - goto test_end;\ - } \ - } \ - while (0) - -#define SKIP_TEST_IF_FALSE(c) do {\ - if (!(c)) {\ - ksft_test_result_skip("%s, line:%d\n", __func__, __LINE__);\ - goto test_end;\ - } \ - } \ - while (0) - - -#define TEST_END_CHECK() {\ - ksft_test_result_pass("%s\n", __func__);\ - return;\ -test_end:\ - return;\ -} - -#ifndef u64 -#define u64 unsigned long long -#endif +#include "mseal_helpers.h" static unsigned long get_vma_size(void *addr, int *prot) { diff --git a/tools/testing/selftests/mm/seal_elf.c b/tools/testing/selftests/mm/seal_elf.c index 27bf2f84231d..45c73213775b 100644 --- a/tools/testing/selftests/mm/seal_elf.c +++ b/tools/testing/selftests/mm/seal_elf.c @@ -16,38 +16,7 @@ #include #include #include - -/* - * need those definition for manually build using gcc. - * gcc -I ../../../../usr/include -DDEBUG -O3 -DDEBUG -O3 seal_elf.c -o seal_elf - */ -#define FAIL_TEST_IF_FALSE(c) do {\ - if (!(c)) {\ - ksft_test_result_fail("%s, line:%d\n", __func__, __LINE__);\ - goto test_end;\ - } \ - } \ - while (0) - -#define SKIP_TEST_IF_FALSE(c) do {\ - if (!(c)) {\ - ksft_test_result_skip("%s, line:%d\n", __func__, __LINE__);\ - goto test_end;\ - } \ - } \ - while (0) - - -#define TEST_END_CHECK() {\ - ksft_test_result_pass("%s\n", __func__);\ - return;\ -test_end:\ - return;\ -} - -#ifndef u64 -#define u64 unsigned long long -#endif +#include "mseal_helpers.h" /* * define sys_xyx to call syscall directly. From patchwork Tue Jun 18 02:24:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13701691 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2079.outbound.protection.outlook.com [40.107.243.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06B9F1B94F; Tue, 18 Jun 2024 02:24:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718677476; cv=fail; b=jPoOhLqSVMv8BYFdTV9Aw0ZLmf4dIFb7WYioaIyCw2rodyKdiajao4SI2vkbUVQXwwMEnbLW3WetVkkRub9LRjJM3C5Pvpw3PbgdSloFD4/H+XTQb7FPLna9VBttlKMRfuhcyohra/SnasmNiRDWZxpiNYGXFIzT8Z3wwCjy6O0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718677476; c=relaxed/simple; bh=FZrf+gNZtLWOihnJW5hsoQWtglHIcoCDdxtWhY7bF3c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=ax0o3x7eNIqX9fekot4XLCBw3PI+jGSo6GPF63msuTZ1gOt/GPvYYRDhd1a4d5g4b5xRkkh0Do9h0bYW0zK1qlRa6c6KXe641WRn3oqXD9JoZxJga28Vu3Ly6PHtSiI9iHMk99hV1lmA3Mcx+Rzf+4xd7JJZTSKXQutnN/jOR9I= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=I3IM5Y5i; arc=fail smtp.client-ip=40.107.243.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="I3IM5Y5i" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zlqm0xIOD2EYl0sRt/nU3s0B2YDUJhaSLSTUNGXqiBeAHzK8ddb00uuN9+4FBa6J9B1FgG5zs8zCmJhpgZz+jOLDffQkk/jBfwvdEDzJKFyfz9VGJV//9A+GBjjYWhUDH7eqMZPacAv+90NQBGygkroj1Lf68ZewSUSJmU8FJ0zYwUEpepxohjtRNiQM/X3XZdELoiTTstxoIHp7lJA9+CbSbjj0D/toHemlWIMUeQCLFcqpR9K61wmV+521N8g9YjJz6ydWbb26fzJXIbA3eg3XM4Gj54ZHJf0HPyOr1eyJ9GOwAnWPQOc98lSEBnQKjCMPfO+WGRwSHRUrfPDNRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OHCQG7BggPiMHbTnE22zLbGUpD7QcsjBk3b5b+WODUM=; b=RbjhgOfOjIX3jvI9/d1N5pfy2/aU/klZfxeBeALbsGN6Q5O/USkws60yefx8j0lM0USMn2PXGjfmF5k9uLuBD5ckmf1SMJYYX2BlspENJ/n4LI3ewFjfP0aotNx6oImN87K29V2LNSNlZcqpTuktdW26oh9J8ixmZaQ138dXTogf/OzllBDDXGF0rWd35/durWXzFZ2gkaH/5SeSJ8W3H/TzuLd+S5QFwco5fAPen3DFDuJBrJfcL4V6VuRyRVgeRNHDc+CI27Ke8sSWprwSQkJaVF/XKT87c1lDaR1fVnEE1QOLwA5RmVzYYULW+zSjAcNsUuMqCEQ3xd1A4rKcCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OHCQG7BggPiMHbTnE22zLbGUpD7QcsjBk3b5b+WODUM=; b=I3IM5Y5imljOvPsj0Hgha5jWWebsQfclfXF+sqVInZMdQoqcUdjgWMe8MgvyTnqPBEWlwen7kTMlLJWvG8t5iLSUAueIORnd8ER3tvMmZxD+S/T+dT/HP6KYupEp/LMcDc4IW6RjWYl3QgVhxA/7e5Ej1aDZrOC9COVyWlA+6WiZ6aMlQaKkv0SJ7CmIozHLfQfy7ysRI2y+vlQiYETAfDHODtF7hRRYFLap8YMwyavO8OY3H8ezo5vyClmLAWKnav2o8d0fcFBB0TIw8Cbe2q2GKRknlKWufglQ1cl6I02vFb8d+GsRhb8oLUo3oDkPvRhAtD3iXF0NmSMfio92LA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by SA3PR12MB8047.namprd12.prod.outlook.com (2603:10b6:806:31b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Tue, 18 Jun 2024 02:24:26 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7677.030; Tue, 18 Jun 2024 02:24:26 +0000 From: John Hubbard To: Andrew Morton , Jeff Xu , Shuah Khan Cc: Andrei Vagin , Axel Rasmussen , Christian Brauner , David Hildenbrand , Kees Cook , Kent Overstreet , "Liam R . Howlett" , Muhammad Usama Anjum , Peter Xu , Rich Felker , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, LKML , John Hubbard Subject: [PATCH v3 3/6] selftests/mm: mseal, self_elf: rename TEST_END_CHECK to REPORT_TEST_PASS Date: Mon, 17 Jun 2024 19:24:19 -0700 Message-ID: <20240618022422.804305-4-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240618022422.804305-1-jhubbard@nvidia.com> References: <20240618022422.804305-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: SJ0PR13CA0227.namprd13.prod.outlook.com (2603:10b6:a03:2c1::22) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|SA3PR12MB8047:EE_ X-MS-Office365-Filtering-Correlation-Id: 27699c89-858d-4ad2-e2d9-08dc8f3dc65d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|366013|1800799021; X-Microsoft-Antispam-Message-Info: 7+LjVT+lIYYP5u8X3wfF0ZmDdqU5zdxzr/WCYaIq1PXlYzGNjnbJzhLYfelvGXQYdpTqbr67WaCP7Uj1EOOPSW8CwIFW6vcvMvusBbSWME1scNXp2rW04To3ghGX47I/4XiHo1P4KTp8V0ffy2fAqqK3hRmaR3urqERFAlRVD/pDvMTZMkX7wrQamUf+39m8LtoEqyZQXFApSXtL6KtYbz9pBqRwcREs6b5YpoIlYGuO25tYSxfoigrSDdcmM7c67pnR9Wc9Uaq/WnTjs17JixO6o9NzvUs5u2qdXASIXCMzXLSvspn7qFat2JrD3nWusa9zml3yJBJgZ6KYR9z7fHHdvA0/QTyrJRoHDVsft2iaznr0s0y0vkPombHHGSrli6ec/105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230037)(7416011)(376011)(366013)(1800799021);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3Bi+m7dPlk+TTZxtOGngp9Dm0n0kQABKyzDxoFdFjH5RTRN+byTBDV76WlpuAH4nobKzQSDEsb4czcDZb5AqzeYhGrOtG5MFv8AOjYHrK32sFmkH1dM7Di4OruIZqyAE1WNCbgTVJ+Ef30pbItSjxG8apzFX4zYgKwKBs7sKFxX954z4rzO3AJY38OsCzM25bQsVMB79M1Cu6/erjDt6EWa87pGzniskkEFuNQv5QFpDZQayOP7rk+mbftOlusNpsa6FC1jdBiBZsgqnV1gkKjQ1Iv/QDjrzZUTu1h+Hd4kdFus/63PWg1gJPuU8aGPf3nkoeAPpzoD5K678wutkkUZ/oBCU32WmUhybBmQt69sMlFIhbhgQIQOCh/2/Hin8Y1EMnPTmSX5sU7ZMKUWjqW8Q9BevfoTShZm6mab1zt70uURso2oMOruAY55wBw02TR3o0tHuziOmeTv5i+XwlcZfBvP9UJl36RGvTuLTghcQ3b9oxHypuSFSfsQ/1aLjwXGwHSPlCYf9mHiJKZdNGQPQYFktNY8LzZTIyBRSVvuOFusr4Arxg0egXnL3GuahVH3vm9AuFABV3mf16i1HxPCnP5nUY5geToUg1ZDwTVlhoQkdFHEDL89Q7z4Gbc+1oAGgHl/x+2P8G6oQMag8Lz5yHqTWd8UBYklvSJUF5gyOCVcVz80dOOmDZMfCmUDl5sZQ9LGz6A7KMFGXzoctu5RbqBNFlio4y+7UGhbbf0tRXmynvzVUdG1i/5hNnUKC46UaBg2GHRZvzHu161daSe/GQ41+X/bVIWSRgVX5EfBnsedr9ytfZcRI1XaRNXT8AECsqZEyJIs+YsakQ+G88t8OwssIWOTQgkEUKN0lg3cWAQdxbQe+2WeYdV2lgWQHO1r6RXqvXkrd4m2ovKr+Y5Cf4Tuuh0qO15Ytd71lINK83px13iC2STnASx3JOgbDoa7ww9L9gUYyVm9iAOjdbQlBEjCRse4JLCQ+5lJlikcqxug8yamaLO2bzGZ16xJYbY+71Ol9d27QqllGAuAS6Zp/vESzBDWJVwH1+U7cxvEnlLhrmKY0qjvM29IdbkPLQn2rfGE9rYdfkDsQ46KrY8SCsgDnZhZHjwFgB/8T3AM3ZU0vXkji2burDqg9xQ5poUhHSq1j2Moc9HDheDy7Ltjwvm5/I0ytmuQza1VUIWORrjogTeLbrqR0l17Oi/KdOzhhlRYBlDS/A2IYw1v78lddfSEUdEfrHAiR164PVKsGDYH51xd9ynuEm0GUAlmXmAi18swqP+X12I404C6f0AiCmamPAkaov0K4OjgdWMrY9nU/nqIHGRUJi9B4/3WL4WvlHd1ipe62zWQJzuMP3iAVHNxv1XkxCcyNzHzFmwVQv9ccRSdYkBAF2t8XLTsj+8itQQabnIBoXP/mkdDvcIBo+/flaMmeDDPjq4GzOZVD6LQXAzmsO9FYaMikhNCFOOAwJ6W5cSgJeFdemso/oKj6JTxzFb5JOiTKUf/3AF9K5rcXrYD2NDiNCXia+jgvPa5B1JxmoV1ZL6gIglsXlUqrk34f2AR/of4+7wuHUuZxSh7jidXH+95G0tiZlSvo X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27699c89-858d-4ad2-e2d9-08dc8f3dc65d X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 02:24:26.4244 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RCbjcwiVbr99K7SL1c2jNWoGanYTIU66nuiumfkAxGQEmmqUAc8bUnelHr9xKryUPveO5WX7xZWPAxmmlpeaLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8047 Now that the test macros are factored out into their final location, and simplified, it's time to rename TEST_END_CHECK to something that represents its new functionality: REPORT_TEST_PASS. Acked-by: David Hildenbrand Reviewed-by: Jeff Xu Tested-by: Jeff Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/mseal_helpers.h | 2 +- tools/testing/selftests/mm/mseal_test.c | 92 +++++++++++----------- tools/testing/selftests/mm/seal_elf.c | 2 +- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/tools/testing/selftests/mm/mseal_helpers.h b/tools/testing/selftests/mm/mseal_helpers.h index 108d3fd0becb..0cfce31c76d2 100644 --- a/tools/testing/selftests/mm/mseal_helpers.h +++ b/tools/testing/selftests/mm/mseal_helpers.h @@ -18,7 +18,7 @@ } \ } while (0) -#define TEST_END_CHECK() ksft_test_result_pass("%s\n", __func__) +#define REPORT_TEST_PASS() ksft_test_result_pass("%s\n", __func__) #ifndef PKEY_DISABLE_ACCESS #define PKEY_DISABLE_ACCESS 0x1 diff --git a/tools/testing/selftests/mm/mseal_test.c b/tools/testing/selftests/mm/mseal_test.c index d4d6ae42f502..a818f010de47 100644 --- a/tools/testing/selftests/mm/mseal_test.c +++ b/tools/testing/selftests/mm/mseal_test.c @@ -240,7 +240,7 @@ static void test_seal_addseal(void) ret = sys_mseal(ptr, size); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_unmapped_start(void) @@ -268,7 +268,7 @@ static void test_seal_unmapped_start(void) ret = sys_mseal(ptr + 2 * page_size, 2 * page_size); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_unmapped_middle(void) @@ -300,7 +300,7 @@ static void test_seal_unmapped_middle(void) ret = sys_mseal(ptr + 3 * page_size, page_size); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_unmapped_end(void) @@ -329,7 +329,7 @@ static void test_seal_unmapped_end(void) ret = sys_mseal(ptr, 2 * page_size); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_multiple_vmas(void) @@ -360,7 +360,7 @@ static void test_seal_multiple_vmas(void) ret = sys_mseal(ptr, size); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_split_start(void) @@ -385,7 +385,7 @@ static void test_seal_split_start(void) ret = sys_mseal(ptr + page_size, 3 * page_size); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_split_end(void) @@ -410,7 +410,7 @@ static void test_seal_split_end(void) ret = sys_mseal(ptr, 3 * page_size); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_invalid_input(void) @@ -445,7 +445,7 @@ static void test_seal_invalid_input(void) ret = sys_mseal(ptr - page_size, 5 * page_size); FAIL_TEST_IF_FALSE(ret < 0); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_zero_length(void) @@ -469,7 +469,7 @@ static void test_seal_zero_length(void) ret = sys_mprotect(ptr, size, PROT_READ | PROT_WRITE); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_zero_address(void) @@ -495,7 +495,7 @@ static void test_seal_zero_address(void) ret = sys_mprotect(ptr, size, PROT_READ | PROT_WRITE); FAIL_TEST_IF_FALSE(ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_twice(void) @@ -515,7 +515,7 @@ static void test_seal_twice(void) ret = sys_mseal(ptr, size); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mprotect(bool seal) @@ -539,7 +539,7 @@ static void test_seal_mprotect(bool seal) else FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_start_mprotect(bool seal) @@ -569,7 +569,7 @@ static void test_seal_start_mprotect(bool seal) PROT_READ | PROT_WRITE); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_end_mprotect(bool seal) @@ -599,7 +599,7 @@ static void test_seal_end_mprotect(bool seal) else FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mprotect_unalign_len(bool seal) @@ -628,7 +628,7 @@ static void test_seal_mprotect_unalign_len(bool seal) PROT_READ | PROT_WRITE); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mprotect_unalign_len_variant_2(bool seal) @@ -656,7 +656,7 @@ static void test_seal_mprotect_unalign_len_variant_2(bool seal) PROT_READ | PROT_WRITE); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mprotect_two_vma(bool seal) @@ -691,7 +691,7 @@ static void test_seal_mprotect_two_vma(bool seal) else FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mprotect_two_vma_with_split(bool seal) @@ -738,7 +738,7 @@ static void test_seal_mprotect_two_vma_with_split(bool seal) PROT_READ | PROT_WRITE); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mprotect_partial_mprotect(bool seal) @@ -764,7 +764,7 @@ static void test_seal_mprotect_partial_mprotect(bool seal) else FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mprotect_two_vma_with_gap(bool seal) @@ -807,7 +807,7 @@ static void test_seal_mprotect_two_vma_with_gap(bool seal) ret = sys_mprotect(ptr + 3 * page_size, page_size, PROT_READ); FAIL_TEST_IF_FALSE(ret == 0); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mprotect_split(bool seal) @@ -844,7 +844,7 @@ static void test_seal_mprotect_split(bool seal) else FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mprotect_merge(bool seal) @@ -878,7 +878,7 @@ static void test_seal_mprotect_merge(bool seal) ret = sys_mprotect(ptr + 2 * page_size, 2 * page_size, PROT_READ); FAIL_TEST_IF_FALSE(ret == 0); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_munmap(bool seal) @@ -903,7 +903,7 @@ static void test_seal_munmap(bool seal) else FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } /* @@ -943,7 +943,7 @@ static void test_seal_munmap_two_vma(bool seal) else FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } /* @@ -981,7 +981,7 @@ static void test_seal_munmap_vma_with_gap(bool seal) ret = sys_munmap(ptr, size); FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_munmap_start_freed(bool seal) @@ -1021,7 +1021,7 @@ static void test_munmap_start_freed(bool seal) FAIL_TEST_IF_FALSE(size == 0); } - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_munmap_end_freed(bool seal) @@ -1051,7 +1051,7 @@ static void test_munmap_end_freed(bool seal) else FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_munmap_middle_freed(bool seal) @@ -1095,7 +1095,7 @@ static void test_munmap_middle_freed(bool seal) FAIL_TEST_IF_FALSE(size == 0); } - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mremap_shrink(bool seal) @@ -1124,7 +1124,7 @@ static void test_seal_mremap_shrink(bool seal) } - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mremap_expand(bool seal) @@ -1156,7 +1156,7 @@ static void test_seal_mremap_expand(bool seal) } - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mremap_move(bool seal) @@ -1189,7 +1189,7 @@ static void test_seal_mremap_move(bool seal) } - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mmap_overwrite_prot(bool seal) @@ -1217,7 +1217,7 @@ static void test_seal_mmap_overwrite_prot(bool seal) } else FAIL_TEST_IF_FALSE(ret2 == ptr); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mmap_expand(bool seal) @@ -1248,7 +1248,7 @@ static void test_seal_mmap_expand(bool seal) } else FAIL_TEST_IF_FALSE(ret2 == ptr); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mmap_shrink(bool seal) @@ -1276,7 +1276,7 @@ static void test_seal_mmap_shrink(bool seal) } else FAIL_TEST_IF_FALSE(ret2 == ptr); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mremap_shrink_fixed(bool seal) @@ -1307,7 +1307,7 @@ static void test_seal_mremap_shrink_fixed(bool seal) } else FAIL_TEST_IF_FALSE(ret2 == newAddr); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mremap_expand_fixed(bool seal) @@ -1338,7 +1338,7 @@ static void test_seal_mremap_expand_fixed(bool seal) } else FAIL_TEST_IF_FALSE(ret2 == newAddr); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mremap_move_fixed(bool seal) @@ -1368,7 +1368,7 @@ static void test_seal_mremap_move_fixed(bool seal) } else FAIL_TEST_IF_FALSE(ret2 == newAddr); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mremap_move_fixed_zero(bool seal) @@ -1400,7 +1400,7 @@ static void test_seal_mremap_move_fixed_zero(bool seal) } - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mremap_move_dontunmap(bool seal) @@ -1429,7 +1429,7 @@ static void test_seal_mremap_move_dontunmap(bool seal) } - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_mremap_move_dontunmap_anyaddr(bool seal) @@ -1463,7 +1463,7 @@ static void test_seal_mremap_move_dontunmap_anyaddr(bool seal) } - TEST_END_CHECK(); + REPORT_TEST_PASS(); } @@ -1556,7 +1556,7 @@ static void test_seal_merge_and_split(void) FAIL_TEST_IF_FALSE(size == 22 * page_size); FAIL_TEST_IF_FALSE(prot == 0x4); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_discard_ro_anon_on_rw(bool seal) @@ -1585,7 +1585,7 @@ static void test_seal_discard_ro_anon_on_rw(bool seal) else FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_discard_ro_anon_on_pkey(bool seal) @@ -1632,7 +1632,7 @@ static void test_seal_discard_ro_anon_on_pkey(bool seal) else FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_discard_ro_anon_on_filebacked(bool seal) @@ -1669,7 +1669,7 @@ static void test_seal_discard_ro_anon_on_filebacked(bool seal) FAIL_TEST_IF_FALSE(!ret); close(fd); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_discard_ro_anon_on_shared(bool seal) @@ -1698,7 +1698,7 @@ static void test_seal_discard_ro_anon_on_shared(bool seal) else FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } static void test_seal_discard_ro_anon(bool seal) @@ -1728,7 +1728,7 @@ static void test_seal_discard_ro_anon(bool seal) else FAIL_TEST_IF_FALSE(!ret); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } int main(int argc, char **argv) diff --git a/tools/testing/selftests/mm/seal_elf.c b/tools/testing/selftests/mm/seal_elf.c index 45c73213775b..7aa1366063e4 100644 --- a/tools/testing/selftests/mm/seal_elf.c +++ b/tools/testing/selftests/mm/seal_elf.c @@ -127,7 +127,7 @@ static void test_seal_elf(void) FAIL_TEST_IF_FALSE(ret < 0); ksft_print_msg("somestr is sealed, mprotect is rejected\n"); - TEST_END_CHECK(); + REPORT_TEST_PASS(); } int main(int argc, char **argv) From patchwork Tue Jun 18 02:24:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13701692 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2077.outbound.protection.outlook.com [40.107.243.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE1B51CD2D; Tue, 18 Jun 2024 02:24:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718677477; cv=fail; b=oSnKOZDzpTOyPTW/znLdc9sZFFvW/0pTFDUe7bU3FGqAriKfmBIdPUuqpcCrrjmp1tsd5W9kNQC88N1j78lIDZ1psRUuNeOk0WreP4BYU6IVuUX41YsYCzdIGltOOpjCRnwAiH/3vnOgKd0Q2K6kue/3n5o/R6693FFcuN74mPw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718677477; c=relaxed/simple; bh=yoWAqqL3HUASUs927z0sLL7goDrs5qAjE2F5KFLgcLc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=WO34fDmDiR34A4407ZNVsXrxPQluJNQ16AlhnPg86iGZYQ+RxApOjurQ1d0T1nFbc/lTZVNSRK0mP+WTH9tEn4n8eMZ/thpeqKrFxQE0KMMGLhCv0wNrL2RK0hRkL/nHXLl1XK4ARMnMEwuns+ZJm0PVrSkqrkmjm452ISAE4lg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=sBPxiyfS; arc=fail smtp.client-ip=40.107.243.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="sBPxiyfS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bo5Q1aGjvsVVc6NUf75oZmYIHuOxw45ml384XOkzeK6lWA6uORr2ggnGLU3W6JJdHD88Da+qnRfe315BWgTjoUWJS6+Ur2X0afa3XbBTdBivrcxKKB8YfvUnpcHjLmvhVHgkH1yeUh/nTfsCbXLR/tkmfIVCVrpVXvE6X/espE4IBVw2VPz4OBRtyQgWsdLg7sU3ADD5v/T5ClfjnoG1iyYis5pj5VWFulqy5eGm9fGuBWRp7GQvOZ7R3OcYYQ6wOWI0OFg2hCKtQT7joeHXUUCPzwtd4w5hdm7FS13QpEOpak0C3nI+Y5Q/8iVAHAzjn8aH05O6ckRXsI/vFggQIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T+DMGwe7FqnmQLeYIMLXk1zg5zgGZ88xewuLNyoQlPg=; b=KXMQcoBqZYiaLaiaxzvYWoc1PSy20ezsvnaWdP4tYJCForibbgJ2Sot5dCwUZ5PKh+ZKKUCYwQrWvSpTwFAvjAahAPFSZ1gylz4MVmfDXPbhjexUjk9xyuLHoPB13yfmbpJmgRjn3kUFpa9z/C+ji51eBmZdJ1Ut1+Km3U7BigqU7HLSG657QNL5SlYddF6nHxHKvspodfNWU9pcYiVrqqQYRsz0NTNog3OidKgcz+kO5dHtOkbEbi276nBupaEwS8bIPQbaU5DS5lW3Y5Dtt64Sk8WdfZJ4Hh9MbTAUsv1oRmkTd1Z1E3OIhQ5lKzA2KQ/V4yZ06gAk19CKChrTxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T+DMGwe7FqnmQLeYIMLXk1zg5zgGZ88xewuLNyoQlPg=; b=sBPxiyfS4+YLllcltooLStjBbsOIivPwul4gA05FieE91itkUXGZwH/Lpww1TzM15X8WKdjAypjHmr/60pP5MWcK3kbrAP5JuSDqQdpiY1qL3tLUyteo8lbn+WqnLfrxa6bcQ49wphG2LnYZgvr25KNqgVJlFhFVUxn7kFq/wLyWaT6x3XyckpnmnWUiy1aJieqOUNsqkHelv1SFJifhwKCfZd5S3IdktVKufuF0Pj5uEsdQSBE+hvtrd30eZL8+4har/SBtnXzg1Xuq+4y0BCcXi2/pJ9rkiVKbvIq7cSG8Zna/RhF/yfpFCoJdG9Q+P7jte0h0FTVdsTZZ+LQ/VQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by SA3PR12MB8047.namprd12.prod.outlook.com (2603:10b6:806:31b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Tue, 18 Jun 2024 02:24:27 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7677.030; Tue, 18 Jun 2024 02:24:27 +0000 From: John Hubbard To: Andrew Morton , Jeff Xu , Shuah Khan Cc: Andrei Vagin , Axel Rasmussen , Christian Brauner , David Hildenbrand , Kees Cook , Kent Overstreet , "Liam R . Howlett" , Muhammad Usama Anjum , Peter Xu , Rich Felker , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, LKML , John Hubbard Subject: [PATCH v3 4/6] selftests/mm: fix vm_util.c build failures: add snapshot of fs.h Date: Mon, 17 Jun 2024 19:24:20 -0700 Message-ID: <20240618022422.804305-5-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240618022422.804305-1-jhubbard@nvidia.com> References: <20240618022422.804305-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: BYAPR08CA0011.namprd08.prod.outlook.com (2603:10b6:a03:100::24) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|SA3PR12MB8047:EE_ X-MS-Office365-Filtering-Correlation-Id: 69c13d91-e30a-4126-b616-08dc8f3dc6d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|366013|1800799021; X-Microsoft-Antispam-Message-Info: TIsYiZWkbba8o4fd19caLSSp3CUd+vNXYeviMrQo7zWspVSfiTc7FPkqQUONFLK0DrPSLJPQcPbr37nmmXoDcPOoKPMJlX6LqzOvXHk6OYvNil4Kbhk/IMvNXJ29Gd0cVJKn8smcdpBMDPK8vyyvyqoRNyZipL9JKI6SPoFfr9hQ53p3hUR7bisz4/Cl/GszX0yno2quTsB9xc1KB9mATFUA/dYe/GKVladDqCYpCAKnte8wVvviJ7ELtiZyn/lbsE72NH/iquNKBSHsx0sW4JaSYzcxvkWCygTqdmCRLRHHB1yoH7RVMsfaGISAj752AZLzV/4Zdh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:BY5PR12MB4130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(7416011)(376011)(366013)(1800799021);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rho6j8UWGU4QiVcRk7qoWLAIDkYKfYQbU9kRblD7J0W8xeVkkaFXvdAps7pTFYcSrDLZYRNkAin34AyFolBrzOpLvKmVqijI8L46TyXqwMLySz3AUwey9vVWlfKMS0sBeshjwMNfKXBMFmAGF2faxjpCfafszppYEEKM9/W17PFBFed2qU4DHVUaGJyRQZjjmx7GxOek/kl/DpmZKZDx6+lZuF7crzs8t6yIp6qJd0ODG8evKJC1N/Uk9YWXX64HQskIbNGiAcn2RimXOLWbnl6M35GyrF+UmYzOSV9qke/cEj527YhUB7b1HWFYQS64QfEHHh1Xwj8nVjyDux+r7LDQJ10RiCJkGZ5OgpmVn/TJksYetq8XdQxPcW+Z7FoSQ7YmP28nKOr/77MFeGg01wlq1otQrfNECgkonjfJ5U95AswqAtvH2Fhh2+T2U4ugVwABm4eyC3UffFbPBqwEqzxsAhs4v2QEnBlXZU4iAXxUpuuSJgVfmIuxerEXvwsDlnSg013q5j5hTfEvcqOqXmEta9oGVHkY8DILEhal8O3O/lPIUcKPG5loQMxCq7BUjjySPVF3cBVHitYe5gRbSmsgbgmh2l0LbKUKPy8KKbd6/TkD4DbszcLhHyBMRxQrDR8pfC4sjKzA/BhdqpkprFF6Z6e2Luqr01bcxBNGN2f8QqDSCd8O/mSAw7N1mPdVDvVIRvWaQ6ZWVdVW8pSsC2k7eP1B73LhVZ+4Dav6Kr/hdrzQe5EfVjEewpsBQma9DJVCtcTYtEqtGS1mIJnU+JF64Ofe3H/MamURF4VGogEDvgfy3mwYmzx7HDXCfJ/d7btfiGMhXQ36+TlZKvhNbW3AXasy2G224NoyBM540KKQdxC1CsZCcVppNL9RWI6AD+SNDo9bKUqiKu3N1hTNKJOtMvhsQrvggCIQUX+nUbmE0ubiJGw8lq1IZt6GolDV5eUei5R2oEuNChOpoi1VeLPB4isUwEqmcgToD/4kQQyik45fVyVpgmcG8Q0t2yduh3jOsMjV9vni+dyTHu0HR2O4znS0qGa5ozJStnY0TfN9qrAwflplln7/bApRg8Q6cui+tMzFCaltiz87QpSUozZ3xZkGpFpMXhKBCrTI+2uMcLt4V2Gu74CoLV3KNAytnWME/yv8JUJ8c+BhFdHsjrWrguIY1bSMrvpBmkOp73jPDu3wscnn1v/NcokULCzVlNlECdfTKhMwXw/9VNu4rIvLzs3tN8maiSqhNoalJuuK2DGa/Tmp52A/qEmXclWWPNmnhgVj2qvi74jCG7lwQyg+58NX5k9yKHoigFVKIYtK16YHIuOFkQdTX0h/wJ5muvanvY2Kc3y5uXYnWcAfRJuhEEbqgn9Pp0P856Hg1hF9IpbKHQ1S5XuOA2u49cOvkBGHgpoISRbbCi5Mc6I2PMGWgh5g99FZFqzBh57biKeDaz7+h9uS8OZdru18yi643k+UXOOYNbh7PjYhQUTyutNLUsf/f7YDznhsKfzoKqgyGrUKNs6YrkktC3bnZCA0AY61HyC5FauAGokKmOMgA86SZpFqoZ/gM0QgvNfPPwOeSdEcQtgcvx8mP5/FsdQ+ X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69c13d91-e30a-4126-b616-08dc8f3dc6d0 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 02:24:27.2789 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iKHQsZD44KAe5NvsxSiaffJ02M8XEPXl9IheGRmN6WbOwMZsJTMBWMWGT9GL6lgDLzUwwXKw7mY1yEo+cAok+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8047 On Ubuntu 23.04, on a clean git tree, the selftests/mm build fails due 10 or 20 missing items, all of which are found in fs.h, which is created via "make headers". However, as per [1], the idea is to stop requiring "make headers", and instead, take a snapshot of the files and check them in. Here are a few of the build errors: vm_util.c:34:21: error: variable has incomplete type 'struct pm_scan_arg' struct pm_scan_arg arg; ... vm_util.c:45:28: error: use of undeclared identifier 'PAGE_IS_WPALLOWED' ... vm_util.c:55:21: error: variable has incomplete type 'struct page_region' ... vm_util.c:105:20: error: use of undeclared identifier 'PAGE_IS_SOFT_DIRTY' To fix this, add fs.h, taken from a snapshot of ./usr/include/linux/fs.h after running "make headers". [1] commit e076eaca5906 ("selftests: break the dependency upon local header files") Acked-by: David Hildenbrand Signed-off-by: John Hubbard --- tools/include/uapi/linux/fs.h | 392 ++++++++++++++++++++++++++++++++++ 1 file changed, 392 insertions(+) create mode 100644 tools/include/uapi/linux/fs.h diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h new file mode 100644 index 000000000000..ca9d754bae04 --- /dev/null +++ b/tools/include/uapi/linux/fs.h @@ -0,0 +1,392 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_FS_H +#define _LINUX_FS_H + +/* + * This file has definitions for some important file table structures + * and constants and structures used by various generic file system + * ioctl's. Please do not make any changes in this file before + * sending patches for review to linux-fsdevel@vger.kernel.org and + * linux-api@vger.kernel.org. + */ + +#include +#include +#include +#include + +/* Use of MS_* flags within the kernel is restricted to core mount(2) code. */ +#include + +/* + * It's silly to have NR_OPEN bigger than NR_FILE, but you can change + * the file limit at runtime and only root can increase the per-process + * nr_file rlimit, so it's safe to set up a ridiculously high absolute + * upper limit on files-per-process. + * + * Some programs (notably those using select()) may have to be + * recompiled to take full advantage of the new limits.. + */ + +/* Fixed constants first: */ +#undef NR_OPEN +#define INR_OPEN_CUR 1024 /* Initial setting for nfile rlimits */ +#define INR_OPEN_MAX 4096 /* Hard limit for nfile rlimits */ + +#define BLOCK_SIZE_BITS 10 +#define BLOCK_SIZE (1< X-Patchwork-Id: 13701693 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2079.outbound.protection.outlook.com [40.107.243.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2304F1D69E; Tue, 18 Jun 2024 02:24:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718677478; cv=fail; b=K7Sn2oe4I7y1GwMeewjQi0PXyykxMDJvev8Dg4ZrgenOubeA96iQPVh08QQg3Tp9gMml4PPVGGfQyAoqdT8/okHbTPgTdx5plf/XmQ4ZBVI3UNhZKMFJVkEUJ839+RTtrFZBQHx5Bof1mhGvIZEfBhBxYRP+Wf1NK/dbGz2i6QE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718677478; c=relaxed/simple; bh=r25R3DLw42bRvjPfM3GMuKdb4gojkuS9PIw/UC3TZNg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=h91uFnlHtvsXfKmnIfjLoBby97hI6e/2S0hqBVzfkennZAWfixqGqfn1LsTJaPYsOg1BArMDxLoVR4HSp7RWeDYv7YxNGEN+hwE+6cGVV6EB9z6TApbxqXr48dqxERYLKxQI2GKU0OjXIa5Gc4XTBSeqV24w0otBDjJ3A2JV96k= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=AhlobOrt; arc=fail smtp.client-ip=40.107.243.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="AhlobOrt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fDrr9S0oRn+91wwIiq294ubX+avDQOwls+aSZdoS97GzRNg46cCyV7onvTF3JhgIg7ufoT+GudPUF3pS+ptq6HogrkSzWNHdtpnBizG/YJSjf3lefg2WLQnhvD2wyYYzkTqmvTDq9Y4FO7rPXCjn4rLkBVG6t4ui+4tqhymhNNMPQy2G6Q/6LVUe5ZMGh3QMcnJ1QIM0xiSmgr5F2/1JKhaAuYDpAMaKEBvL5dwbLpMeK0f23E96rvwucf194xJTFlEBExmQhdKT6SoNz6WN3Fwq/Bm/3MtoygXW95B4ryyveeY1O9BtPd96eQ0km3nfPo7kdAQxKbPEUyxQqQdi5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4WrJZsMOp+aqB2aUs9lp8RMTT8HkgthjIv6hrWU1MrU=; b=KNTx82HyDraD0RMqW7QMOty/gSPsOuM6ZSk2jMBUpOZ+UOe3yVJLNTB4UuyX+KwI+wr9E4aK0xGW3cE6zFLWRJNp0bNhfSVs140eHXcIBSbMr+zajhnm5DGUEH07K4/IjbWZeV+6QH/+zfGQhmUCYABy4wocoSO8Y6jlHc/EJ/5+DGeoCBrHjtYL6gM9RxECTUNf6gOmWpE9bzPqNl9A1ebpUTJ2x325CF9mvWya4RD2CpSI/gyUyeRFbs1H33TaaQRQ2Did+oyhWBZl1xtC4QejVW64bfEDeG3n/4mPZNPWDBLyUm4boklrkcXu0sasCRvB3LV6is+MAUzQDkmeTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4WrJZsMOp+aqB2aUs9lp8RMTT8HkgthjIv6hrWU1MrU=; b=AhlobOrtlM0TA3PddqACMmosnzhlwwIGhiqqeuZShqeDlxap11Q3xqG+z7m+3aZbWWfdJEsqTczxmDh3q2fc52AfKsxEI02KTDN9S3gg0pZBf8UT59M7ygUst+XR/WKYAiH4DPRURMVicKY+h3zRQB73t/6fpw+chmw8eXHGDIsCo2bJqpubhA7J1MkhPWn4oXTbkT/SlSvzuAVhwBri8foRaEqXA1FSRPAWZLF+konjIPvQx26nEPvElKStrOvxvFO9VubflNKMmQSP+tfO7UsYIt1AtAJZTI+1yPOeNkP0FB16GF8lDpA6AmUSYGi4m7DI3T94cH0Xb5yiB6YHlA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by SA3PR12MB8047.namprd12.prod.outlook.com (2603:10b6:806:31b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Tue, 18 Jun 2024 02:24:28 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7677.030; Tue, 18 Jun 2024 02:24:28 +0000 From: John Hubbard To: Andrew Morton , Jeff Xu , Shuah Khan Cc: Andrei Vagin , Axel Rasmussen , Christian Brauner , David Hildenbrand , Kees Cook , Kent Overstreet , "Liam R . Howlett" , Muhammad Usama Anjum , Peter Xu , Rich Felker , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, LKML , John Hubbard Subject: [PATCH v3 5/6] selftests/mm: kvm, mdwe fixes to avoid requiring "make headers" Date: Mon, 17 Jun 2024 19:24:21 -0700 Message-ID: <20240618022422.804305-6-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240618022422.804305-1-jhubbard@nvidia.com> References: <20240618022422.804305-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: BYAPR08CA0031.namprd08.prod.outlook.com (2603:10b6:a03:100::44) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|SA3PR12MB8047:EE_ X-MS-Office365-Filtering-Correlation-Id: 097689c9-3b85-48c6-9f82-08dc8f3dc77c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|366013|1800799021; X-Microsoft-Antispam-Message-Info: brUIShgwJo/KYRpEuOBq71ayEfuUiXSwAaxjf0u1g4ZOmGJ+gFbPt+mREJvZX6uFq6AUSGTM9skJcgVEvBVXQUmzCdG/hPDMmee/Q28EYa2d+fTebgk+ttozsHdD05cLXV+7jfwNYKUTs1kxx7Wh9drjb2Qtz8Aq3TH80EjQeMjS0hZ8uwbHGP90G5C2eso+3Si7J7tR8BSr2zwgu73MF7ThCHtTzQdbc9mSc0ymRlEUv8kWwbaU6iPKxo4BfDLcxD7f43xN4KT/McRkAlxXaAkEPWmgUwZaGwpoixTEZm7zysiNxiAnj+5z/p+QS0qbtMsRYC+TcIQ1/ZPR1rDimY2nPrs3ksXu0kHcD0moojMh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Ohd4+C0PWOTq4WVtiEGpCaZT4NYhUsBSC6xAZjPXVylKR6mNa5vmVCpa29TDzGPum1/0RqHKJUnA9xJNOU55GukvWvCHFhuwwE0REbZoLvCTKMLqOnj/NZ0aXJORDdo7Tz++ASMkdXrmvem3otSRS78T0y+9mx/6mADQJvmTkGUMFIBJka/ofUhW6Eeu1Tut7A2BMvzEeAQYZnV4w4uCSdlUhB7SrgU2UaYyGlG8V593cx9aAuErDKelYyYJDHXnUjdjAgdK58JulX565adPcJ+MSm+1PKCCs80CA6hUy8U7g7TvBUR5Ji/jYVqyW9ANUFVTfn8wItuduEyjLt0clc2hyIcYg7tZ0v1Ysy+1+6TXvuJjq6zs5ygnfeloQEbt9EDM3Q01WHZX2O1kklC0pqkhPudfiGzGVJg8rcFeKQeqJvIEh+2Y8vqfnjYDwQ3IRyjJXhzFwUINRRL5KoVRAB9KfMf7qmDyLyN94dmZKYbo8kfrVgphKHemtxBwG80ym8mLJsNWqzaUAzVK/AWJ2Q3du3LUrRH1vmRiHK0V9q9yP/i4mOnTRkQcNtzrlDj8bypitUg+8XlA4VdKgK/xLZQCgi3Dj/l6WdWEIrAklaVub8wbav+QEHVub/S/xAT1GpNMH++6E/YKWDgqXDqgzux X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 097689c9-3b85-48c6-9f82-08dc8f3dc77c X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 02:24:28.3026 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wSCeEj0YnJgUbH+ry1AHGvrcB2a0QvboOKXJy96oXAJtjm67FQtyq0MnvyCTcntKe1uuuzKtXJqPXqyiQO8Xig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8047 On Ubuntu 23.04, the kvm and mdwe selftests/mm build fails due to missing a few items that are found in prctl.h. Here is an excerpt of the build failures: ksm_tests.c:252:13: error: use of undeclared identifier 'PR_SET_MEMORY_MERGE' ... mdwe_test.c:26:18: error: use of undeclared identifier 'PR_SET_MDWE' mdwe_test.c:38:18: error: use of undeclared identifier 'PR_GET_MDWE' Fix these errors by adding a new tools/include/uapi/linux/prctl.h . This file was created by running "make headers", and then copying a snapshot over from ./usr/include/linux/prctl.h, as per the approach we settled on in [1]. [1] commit e076eaca5906 ("selftests: break the dependency upon local header files") Cc: David Hildenbrand Signed-off-by: John Hubbard Acked-by: David Hildenbrand --- tools/include/uapi/linux/prctl.h | 331 +++++++++++++++++++++++++++++++ 1 file changed, 331 insertions(+) create mode 100644 tools/include/uapi/linux/prctl.h diff --git a/tools/include/uapi/linux/prctl.h b/tools/include/uapi/linux/prctl.h new file mode 100644 index 000000000000..35791791a879 --- /dev/null +++ b/tools/include/uapi/linux/prctl.h @@ -0,0 +1,331 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_PRCTL_H +#define _LINUX_PRCTL_H + +#include + +/* Values to pass as first argument to prctl() */ + +#define PR_SET_PDEATHSIG 1 /* Second arg is a signal */ +#define PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */ + +/* Get/set current->mm->dumpable */ +#define PR_GET_DUMPABLE 3 +#define PR_SET_DUMPABLE 4 + +/* Get/set unaligned access control bits (if meaningful) */ +#define PR_GET_UNALIGN 5 +#define PR_SET_UNALIGN 6 +# define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */ +# define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */ + +/* Get/set whether or not to drop capabilities on setuid() away from + * uid 0 (as per security/commoncap.c) */ +#define PR_GET_KEEPCAPS 7 +#define PR_SET_KEEPCAPS 8 + +/* Get/set floating-point emulation control bits (if meaningful) */ +#define PR_GET_FPEMU 9 +#define PR_SET_FPEMU 10 +# define PR_FPEMU_NOPRINT 1 /* silently emulate fp operations accesses */ +# define PR_FPEMU_SIGFPE 2 /* don't emulate fp operations, send SIGFPE instead */ + +/* Get/set floating-point exception mode (if meaningful) */ +#define PR_GET_FPEXC 11 +#define PR_SET_FPEXC 12 +# define PR_FP_EXC_SW_ENABLE 0x80 /* Use FPEXC for FP exception enables */ +# define PR_FP_EXC_DIV 0x010000 /* floating point divide by zero */ +# define PR_FP_EXC_OVF 0x020000 /* floating point overflow */ +# define PR_FP_EXC_UND 0x040000 /* floating point underflow */ +# define PR_FP_EXC_RES 0x080000 /* floating point inexact result */ +# define PR_FP_EXC_INV 0x100000 /* floating point invalid operation */ +# define PR_FP_EXC_DISABLED 0 /* FP exceptions disabled */ +# define PR_FP_EXC_NONRECOV 1 /* async non-recoverable exc. mode */ +# define PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */ +# define PR_FP_EXC_PRECISE 3 /* precise exception mode */ + +/* Get/set whether we use statistical process timing or accurate timestamp + * based process timing */ +#define PR_GET_TIMING 13 +#define PR_SET_TIMING 14 +# define PR_TIMING_STATISTICAL 0 /* Normal, traditional, + statistical process timing */ +# define PR_TIMING_TIMESTAMP 1 /* Accurate timestamp based + process timing */ + +#define PR_SET_NAME 15 /* Set process name */ +#define PR_GET_NAME 16 /* Get process name */ + +/* Get/set process endian */ +#define PR_GET_ENDIAN 19 +#define PR_SET_ENDIAN 20 +# define PR_ENDIAN_BIG 0 +# define PR_ENDIAN_LITTLE 1 /* True little endian mode */ +# define PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */ + +/* Get/set process seccomp mode */ +#define PR_GET_SECCOMP 21 +#define PR_SET_SECCOMP 22 + +/* Get/set the capability bounding set (as per security/commoncap.c) */ +#define PR_CAPBSET_READ 23 +#define PR_CAPBSET_DROP 24 + +/* Get/set the process' ability to use the timestamp counter instruction */ +#define PR_GET_TSC 25 +#define PR_SET_TSC 26 +# define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */ +# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */ + +/* Get/set securebits (as per security/commoncap.c) */ +#define PR_GET_SECUREBITS 27 +#define PR_SET_SECUREBITS 28 + +/* + * Get/set the timerslack as used by poll/select/nanosleep + * A value of 0 means "use default" + */ +#define PR_SET_TIMERSLACK 29 +#define PR_GET_TIMERSLACK 30 + +#define PR_TASK_PERF_EVENTS_DISABLE 31 +#define PR_TASK_PERF_EVENTS_ENABLE 32 + +/* + * Set early/late kill mode for hwpoison memory corruption. + * This influences when the process gets killed on a memory corruption. + */ +#define PR_MCE_KILL 33 +# define PR_MCE_KILL_CLEAR 0 +# define PR_MCE_KILL_SET 1 + +# define PR_MCE_KILL_LATE 0 +# define PR_MCE_KILL_EARLY 1 +# define PR_MCE_KILL_DEFAULT 2 + +#define PR_MCE_KILL_GET 34 + +/* + * Tune up process memory map specifics. + */ +#define PR_SET_MM 35 +# define PR_SET_MM_START_CODE 1 +# define PR_SET_MM_END_CODE 2 +# define PR_SET_MM_START_DATA 3 +# define PR_SET_MM_END_DATA 4 +# define PR_SET_MM_START_STACK 5 +# define PR_SET_MM_START_BRK 6 +# define PR_SET_MM_BRK 7 +# define PR_SET_MM_ARG_START 8 +# define PR_SET_MM_ARG_END 9 +# define PR_SET_MM_ENV_START 10 +# define PR_SET_MM_ENV_END 11 +# define PR_SET_MM_AUXV 12 +# define PR_SET_MM_EXE_FILE 13 +# define PR_SET_MM_MAP 14 +# define PR_SET_MM_MAP_SIZE 15 + +/* + * This structure provides new memory descriptor + * map which mostly modifies /proc/pid/stat[m] + * output for a task. This mostly done in a + * sake of checkpoint/restore functionality. + */ +struct prctl_mm_map { + __u64 start_code; /* code section bounds */ + __u64 end_code; + __u64 start_data; /* data section bounds */ + __u64 end_data; + __u64 start_brk; /* heap for brk() syscall */ + __u64 brk; + __u64 start_stack; /* stack starts at */ + __u64 arg_start; /* command line arguments bounds */ + __u64 arg_end; + __u64 env_start; /* environment variables bounds */ + __u64 env_end; + __u64 *auxv; /* auxiliary vector */ + __u32 auxv_size; /* vector size */ + __u32 exe_fd; /* /proc/$pid/exe link file */ +}; + +/* + * Set specific pid that is allowed to ptrace the current task. + * A value of 0 mean "no process". + */ +#define PR_SET_PTRACER 0x59616d61 +# define PR_SET_PTRACER_ANY ((unsigned long)-1) + +#define PR_SET_CHILD_SUBREAPER 36 +#define PR_GET_CHILD_SUBREAPER 37 + +/* + * If no_new_privs is set, then operations that grant new privileges (i.e. + * execve) will either fail or not grant them. This affects suid/sgid, + * file capabilities, and LSMs. + * + * Operations that merely manipulate or drop existing privileges (setresuid, + * capset, etc.) will still work. Drop those privileges if you want them gone. + * + * Changing LSM security domain is considered a new privilege. So, for example, + * asking selinux for a specific new context (e.g. with runcon) will result + * in execve returning -EPERM. + * + * See Documentation/userspace-api/no_new_privs.rst for more details. + */ +#define PR_SET_NO_NEW_PRIVS 38 +#define PR_GET_NO_NEW_PRIVS 39 + +#define PR_GET_TID_ADDRESS 40 + +#define PR_SET_THP_DISABLE 41 +#define PR_GET_THP_DISABLE 42 + +/* + * No longer implemented, but left here to ensure the numbers stay reserved: + */ +#define PR_MPX_ENABLE_MANAGEMENT 43 +#define PR_MPX_DISABLE_MANAGEMENT 44 + +#define PR_SET_FP_MODE 45 +#define PR_GET_FP_MODE 46 +# define PR_FP_MODE_FR (1 << 0) /* 64b FP registers */ +# define PR_FP_MODE_FRE (1 << 1) /* 32b compatibility */ + +/* Control the ambient capability set */ +#define PR_CAP_AMBIENT 47 +# define PR_CAP_AMBIENT_IS_SET 1 +# define PR_CAP_AMBIENT_RAISE 2 +# define PR_CAP_AMBIENT_LOWER 3 +# define PR_CAP_AMBIENT_CLEAR_ALL 4 + +/* arm64 Scalable Vector Extension controls */ +/* Flag values must be kept in sync with ptrace NT_ARM_SVE interface */ +#define PR_SVE_SET_VL 50 /* set task vector length */ +# define PR_SVE_SET_VL_ONEXEC (1 << 18) /* defer effect until exec */ +#define PR_SVE_GET_VL 51 /* get task vector length */ +/* Bits common to PR_SVE_SET_VL and PR_SVE_GET_VL */ +# define PR_SVE_VL_LEN_MASK 0xffff +# define PR_SVE_VL_INHERIT (1 << 17) /* inherit across exec */ + +/* Per task speculation control */ +#define PR_GET_SPECULATION_CTRL 52 +#define PR_SET_SPECULATION_CTRL 53 +/* Speculation control variants */ +# define PR_SPEC_STORE_BYPASS 0 +# define PR_SPEC_INDIRECT_BRANCH 1 +# define PR_SPEC_L1D_FLUSH 2 +/* Return and control values for PR_SET/GET_SPECULATION_CTRL */ +# define PR_SPEC_NOT_AFFECTED 0 +# define PR_SPEC_PRCTL (1UL << 0) +# define PR_SPEC_ENABLE (1UL << 1) +# define PR_SPEC_DISABLE (1UL << 2) +# define PR_SPEC_FORCE_DISABLE (1UL << 3) +# define PR_SPEC_DISABLE_NOEXEC (1UL << 4) + +/* Reset arm64 pointer authentication keys */ +#define PR_PAC_RESET_KEYS 54 +# define PR_PAC_APIAKEY (1UL << 0) +# define PR_PAC_APIBKEY (1UL << 1) +# define PR_PAC_APDAKEY (1UL << 2) +# define PR_PAC_APDBKEY (1UL << 3) +# define PR_PAC_APGAKEY (1UL << 4) + +/* Tagged user address controls for arm64 */ +#define PR_SET_TAGGED_ADDR_CTRL 55 +#define PR_GET_TAGGED_ADDR_CTRL 56 +# define PR_TAGGED_ADDR_ENABLE (1UL << 0) +/* MTE tag check fault modes */ +# define PR_MTE_TCF_NONE 0UL +# define PR_MTE_TCF_SYNC (1UL << 1) +# define PR_MTE_TCF_ASYNC (1UL << 2) +# define PR_MTE_TCF_MASK (PR_MTE_TCF_SYNC | PR_MTE_TCF_ASYNC) +/* MTE tag inclusion mask */ +# define PR_MTE_TAG_SHIFT 3 +# define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT) +/* Unused; kept only for source compatibility */ +# define PR_MTE_TCF_SHIFT 1 + +/* Control reclaim behavior when allocating memory */ +#define PR_SET_IO_FLUSHER 57 +#define PR_GET_IO_FLUSHER 58 + +/* Dispatch syscalls to a userspace handler */ +#define PR_SET_SYSCALL_USER_DISPATCH 59 +# define PR_SYS_DISPATCH_OFF 0 +# define PR_SYS_DISPATCH_ON 1 +/* The control values for the user space selector when dispatch is enabled */ +# define SYSCALL_DISPATCH_FILTER_ALLOW 0 +# define SYSCALL_DISPATCH_FILTER_BLOCK 1 + +/* Set/get enabled arm64 pointer authentication keys */ +#define PR_PAC_SET_ENABLED_KEYS 60 +#define PR_PAC_GET_ENABLED_KEYS 61 + +/* Request the scheduler to share a core */ +#define PR_SCHED_CORE 62 +# define PR_SCHED_CORE_GET 0 +# define PR_SCHED_CORE_CREATE 1 /* create unique core_sched cookie */ +# define PR_SCHED_CORE_SHARE_TO 2 /* push core_sched cookie to pid */ +# define PR_SCHED_CORE_SHARE_FROM 3 /* pull core_sched cookie to pid */ +# define PR_SCHED_CORE_MAX 4 +# define PR_SCHED_CORE_SCOPE_THREAD 0 +# define PR_SCHED_CORE_SCOPE_THREAD_GROUP 1 +# define PR_SCHED_CORE_SCOPE_PROCESS_GROUP 2 + +/* arm64 Scalable Matrix Extension controls */ +/* Flag values must be in sync with SVE versions */ +#define PR_SME_SET_VL 63 /* set task vector length */ +# define PR_SME_SET_VL_ONEXEC (1 << 18) /* defer effect until exec */ +#define PR_SME_GET_VL 64 /* get task vector length */ +/* Bits common to PR_SME_SET_VL and PR_SME_GET_VL */ +# define PR_SME_VL_LEN_MASK 0xffff +# define PR_SME_VL_INHERIT (1 << 17) /* inherit across exec */ + +/* Memory deny write / execute */ +#define PR_SET_MDWE 65 +# define PR_MDWE_REFUSE_EXEC_GAIN (1UL << 0) +# define PR_MDWE_NO_INHERIT (1UL << 1) + +#define PR_GET_MDWE 66 + +#define PR_SET_VMA 0x53564d41 +# define PR_SET_VMA_ANON_NAME 0 + +#define PR_GET_AUXV 0x41555856 + +#define PR_SET_MEMORY_MERGE 67 +#define PR_GET_MEMORY_MERGE 68 + +#define PR_RISCV_V_SET_CONTROL 69 +#define PR_RISCV_V_GET_CONTROL 70 +# define PR_RISCV_V_VSTATE_CTRL_DEFAULT 0 +# define PR_RISCV_V_VSTATE_CTRL_OFF 1 +# define PR_RISCV_V_VSTATE_CTRL_ON 2 +# define PR_RISCV_V_VSTATE_CTRL_INHERIT (1 << 4) +# define PR_RISCV_V_VSTATE_CTRL_CUR_MASK 0x3 +# define PR_RISCV_V_VSTATE_CTRL_NEXT_MASK 0xc +# define PR_RISCV_V_VSTATE_CTRL_MASK 0x1f + +#define PR_RISCV_SET_ICACHE_FLUSH_CTX 71 +# define PR_RISCV_CTX_SW_FENCEI_ON 0 +# define PR_RISCV_CTX_SW_FENCEI_OFF 1 +# define PR_RISCV_SCOPE_PER_PROCESS 0 +# define PR_RISCV_SCOPE_PER_THREAD 1 + +/* PowerPC Dynamic Execution Control Register (DEXCR) controls */ +#define PR_PPC_GET_DEXCR 72 +#define PR_PPC_SET_DEXCR 73 +/* DEXCR aspect to act on */ +# define PR_PPC_DEXCR_SBHE 0 /* Speculative branch hint enable */ +# define PR_PPC_DEXCR_IBRTPD 1 /* Indirect branch recurrent target prediction disable */ +# define PR_PPC_DEXCR_SRAPD 2 /* Subroutine return address prediction disable */ +# define PR_PPC_DEXCR_NPHIE 3 /* Non-privileged hash instruction enable */ +/* Action to apply / return */ +# define PR_PPC_DEXCR_CTRL_EDITABLE 0x1 /* Aspect can be modified with PR_PPC_SET_DEXCR */ +# define PR_PPC_DEXCR_CTRL_SET 0x2 /* Set the aspect for this process */ +# define PR_PPC_DEXCR_CTRL_CLEAR 0x4 /* Clear the aspect for this process */ +# define PR_PPC_DEXCR_CTRL_SET_ONEXEC 0x8 /* Set the aspect on exec */ +# define PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC 0x10 /* Clear the aspect on exec */ +# define PR_PPC_DEXCR_CTRL_MASK 0x1f + +#endif /* _LINUX_PRCTL_H */ From patchwork Tue Jun 18 02:24:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13701694 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2077.outbound.protection.outlook.com [40.107.243.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FA501865C; Tue, 18 Jun 2024 02:24:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718677479; cv=fail; b=G+aXGb9g8W4+914qsuutJrfNuetMGHMcZz8B+d+w+R2o1J91hB29OG69p7Oe0ztpEG6s80VwcPJmR2zD6+feiAy458HuDq833X/Qtc1bR1ECsyT242pYPQciMggKlkP/uK+5vNfcw45rWQZ6UM0M0R+ZTLRRXDcOo+MLsU9HmPo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718677479; c=relaxed/simple; bh=q+9YpcAlaI3uXyh3nuYNyDBif9Xmi86C6G1DTXRjHVI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=HcV6IXh1WiVXXXcwvKYV70x2uH6FeY5hkdU5DmAf68m7KGVygW0EYDwpoTMsFIM6AzQIHiNWQRkSb1Ne0ENJyU8XHhiHH6Jib5xJIGMDSa6Eh+g+fAD4SwlRBv+1d2L7w70o8e7Kege65x95atOJ6OOwvEYyGn7KamqvfYlqsSA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=unfU/2B7; arc=fail smtp.client-ip=40.107.243.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="unfU/2B7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gE5V3gwtPkzAJYHK5OTIxJ3ahRQlx7B/vzOjqFsg/FXwrQT0mQPYyJu/vbsUPzz8TfwncEpkC8VuGBNymFwlYiedC56g+N38M5UC52dNker09l2g/BXNhp/GOLGXFN6Cr0fche1FZQv3dqWGJe9kxTK9Wh3Yw02oFS5WLm4Jg4SxApknRAmlnGUvE1JI/2ayZncPwiCbPfJj4zQjIBPo1qE7Ei8w1uWLq8x76bW1rZI569N1U9ssKfsPsrbaCqHNVBFQezVU9HQjknR6jZpd1JZs+XiVx10ymVREA2Bm+AgaVHSx/3o0jdKMw+NadMvyrKkwYoY3jcUkhVtN8yzQRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NF9Ze1k6wBxs36mbUWWURPDYNQVjIyEe/phljaLt/7o=; b=Nde/Fe+3hXJcEej4TLKpRGfzq06fMhbD1Imo0T4YijB6M0+Vo/NtFGZOmYaDXPLGsAFlxmmEYR7I8wIrTRyqwGdiReetkVX8ci6sUsRkq0IcSJog2heeWygAOEuV3SVgv/Eza35enBIzp5DzYw23LoD4NSXu6LAGRIdOP26ziBHXPCRYZnZ+ISlWfqInbCSysrQlNePkdRuygUWu56n945mJb9+7aPQkBxOx5U63ftFXr2HeTESIIKEq2gHTtvsgVD1dqB1WSJzOuE/NG0392usueDbYXTDHj2m8sodKJrGa/ovdeMztkrFlBkLZPLkqm0divtWmqOG1Rk/PYzl75g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NF9Ze1k6wBxs36mbUWWURPDYNQVjIyEe/phljaLt/7o=; b=unfU/2B7Mm9333WD/1JP64ahV+Il/GbQ0ZVRE1yMvN5vXdIRmWeY43STPfBtCAtXUOVo6aMyb/d9S3W0VDb0/iAi6MrNvK+nStAMm6Qo1OYTaGfvKYeChkdBusdYqLsyeYuARIshADhibm7EVHfGhRnV0XJQhEDGT0FP+YlmO0MYWuRXwMOBR6nubV3RnO+OYmifIUaFLgbhpGoUE96DHmiIUhTQUjW8gjPrlTV3gRWS2syuhnCEdLjuv92lTyJ+c0fyz3EbQVB6x2PoNn7MtvELsDpuCp5YGmolaEkNNh3tZ/AzT8t+p2uCqMdIfrsgtOnkCGSCm6Ys2wA6ouHrnA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by SA3PR12MB8047.namprd12.prod.outlook.com (2603:10b6:806:31b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Tue, 18 Jun 2024 02:24:29 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7677.030; Tue, 18 Jun 2024 02:24:29 +0000 From: John Hubbard To: Andrew Morton , Jeff Xu , Shuah Khan Cc: Andrei Vagin , Axel Rasmussen , Christian Brauner , David Hildenbrand , Kees Cook , Kent Overstreet , "Liam R . Howlett" , Muhammad Usama Anjum , Peter Xu , Rich Felker , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, LKML , John Hubbard Subject: [PATCH v3 6/6] selftests/mm: remove local __NR_* definitions Date: Mon, 17 Jun 2024 19:24:22 -0700 Message-ID: <20240618022422.804305-7-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240618022422.804305-1-jhubbard@nvidia.com> References: <20240618022422.804305-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: BYAPR07CA0063.namprd07.prod.outlook.com (2603:10b6:a03:60::40) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|SA3PR12MB8047:EE_ X-MS-Office365-Filtering-Correlation-Id: 25746475-ecc1-478d-b6f2-08dc8f3dc814 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|366013|1800799021; X-Microsoft-Antispam-Message-Info: gTfik7Fd8UcEX7bUPyF7gBwS4/ub/5SxjMQEizGMvN/NB10qPmN9uoYIWOaNj+eegs4PAqRtwxkN4W3nsM+7e1NRiigciM3hGMvb4KC/6dU/bK8tO1v2sD31xiNDItv1LG0EQC5KWlroofPAyTZMlGkf2RoI0nsw4KxwXn3FdGQwiC2z0yt4FtwNaZP9TEKpaHgTnrYXnU/2yGR8EKootjP5JnGzBCj1n+QL35+evFkCA5dCoMUerO1J5lco4nsviaQUDEEeuqtgUPSNsOV0fldGDLOQduWrOUj2ku7Af0l6yMWWMubgWE9m2OGbtDrbbmbzwCFHIdkqV1oozsnqpC8cRadZ2BYQdeqaXZf86MbNO8YdyjgO3IErlBHo2SIbkND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:NONE;SFS:(13230037)(7416011)(376011)(366013)(1800799021);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: M+83bU0V89Wll6783m/V5ceVo/6LGobBEwaYcRDve+nh+/e3GDx/JJq9LaI+CaAeKES9nFTeB14zoUhf2yJvZokV5sv6OVlGNwicypUZiilyjkmJP9PVxk6LrvdLUNbAOchL2AMkhJ9ejMWiok7nXQ7JmNb/NOvUJb9TstfrgrzNg6VvYpuI2EgXgtUTnl4u9kYzJHiucbqzHKbCdVyRRX/0i73NoJdUDIam81CVQfJpG+LBA4Z5iUMjWFLPud0LLP9JhXOdEavZfEuVTldWtzC2f8iOTzDUqWqYysU8LJ21sOcPCQNTN20KfWBAezhTDS6x62gW5lgzg+VsILXVnYmQvOm1wCKbCbjr1Swom5SBt3h221eLMUDgrPmZ+5kp5XZ8ffEOEpTViFtamqkp22apnFLcWTblVWgyKsyJx0GNOuX57dk8brDVwPqmFwCQXPr7zxWS9lEYG77kJmHlPexOEP03X2NSSam6iSx0h/wEhNHVkqpNQNp/zAyBgBSS3FxH4QN77UDkmsa/deSlph2U6Xxl6/YS9Uwcc98vm0BId+N+IeoRyLEyTMHvTBLhuWHXTvz4BXXHBmbk95TU9+byl/ev/W24euqk5LZHTDBlWJwVWQzMEMU0R+pfiZTAyKKlKR5sSxlbNza8DeyWhmfTIP3owbOMVjqaE/Lhltptoi8l3rTFMqd7kgbMRemm3SWHCo20pDjW9WLGynBivdAlO7Y+SHMRIznWHY++P8CMhuOET0EFa72U3rTxGKkA1dS+rkDBVJdMTigWJk6zHZtBrUYEg0OG+YW5MRhW04keAYve56sA+EOsYGJq1GQVVURGii/kqXyZNC9rS3WucZ3xY71aTGhFfVZt+R8jIfCACT7COXi2iJmgJ2ySWb48viZberBu4R6NqlVNWiAoC6fOXSjtsu30HrISegVbzwC4D+7kcS1vcp7LsK9jFVqjGZU99mbL3ewgI/O8bRZ9rYnEpp1at6ZB4rOYt/qujw+Vg6t+0y6gjeEKyULQp50rBjAyQABfxi80c8hF16WzXI41ugommQ4byv3YEC0w1jG0SzjOcWWObGXnPtlOdYDGEpab90bY4sIxvqHUUaFiJt1FlHr2ZXPJBWGRv/VPMw4NpunjOWAwbiEO/nomfxLIxNgXAqq1n6stBO2XRmAcNs+KB3NFEN7PHOMSCNoHCkHYbbcod6Mj4S3x58vzmWLFwSws7dERAOU3sMd+m4+e0u8cIXsFkn0e+VW9Mf2GkujCtgOxiOQAxf9r1BZV8KVpiQS8xx3l+XLvpWVcy1pSN4i3eOirBFfgip/cVifGO7Sf9MQ7ZdaxOOGcbqFueyu11FbRChapsT1t2i3NP+AxRmR5WbZQ6CdKlH4eG3CQI9Wxk8TGsuL7z/1mmJLr2vD8aH2VhU8//sHi/uZYAbDLdlTIPylqsZ9x9DQ6OdY/wfiiFxAdhc0FFmWNAW7TkmhEKIKIfc86L97Cx7TQWXH0kJQe/X/DY2s9COpvKuK+kLRByxFUYPyipP2fdiPcQgeN+2Z26OWtz7R0rAAT1rjUBmN8dyjZmzldOGIx5MHNP6/fG+frB7XypdFkOj0SDwIp X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25746475-ecc1-478d-b6f2-08dc8f3dc814 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 02:24:29.3173 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ndPuPpq2Dx+robDDNs4oio40yWwg+c8qBZodoVSpGfwv7UKe7aeybFYG7PIDxMmN7avo30rbznTFLL2Ax8Lr6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8047 This continues the work on getting the selftests to build without requiring people to first run "make headers" [1]. Now that the system call numbers are in the correct, checked-in locations in the kernel tree (./tools/include/uapi/asm/unistd*.h), make sure that the mm selftests include that file (indirectly). Doing so provides guaranteed definitions at build time, so remove all of the checks for "ifdef __NR_xxx" in the mm selftests, because they will always be true (defined). [1] commit e076eaca5906 ("selftests: break the dependency upon local header files") Acked-by: David Hildenbrand Cc: Jeff Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/hugepage-mremap.c | 2 +- .../testing/selftests/mm/ksm_functional_tests.c | 8 +------- tools/testing/selftests/mm/memfd_secret.c | 14 +------------- tools/testing/selftests/mm/mkdirty.c | 8 +------- tools/testing/selftests/mm/mlock2.h | 1 + tools/testing/selftests/mm/pagemap_ioctl.c | 2 +- tools/testing/selftests/mm/protection_keys.c | 2 +- tools/testing/selftests/mm/uffd-common.c | 4 ---- tools/testing/selftests/mm/uffd-stress.c | 16 +--------------- tools/testing/selftests/mm/uffd-unit-tests.c | 14 +------------- 10 files changed, 9 insertions(+), 62 deletions(-) diff --git a/tools/testing/selftests/mm/hugepage-mremap.c b/tools/testing/selftests/mm/hugepage-mremap.c index c463d1c09c9b..ada9156cc497 100644 --- a/tools/testing/selftests/mm/hugepage-mremap.c +++ b/tools/testing/selftests/mm/hugepage-mremap.c @@ -15,7 +15,7 @@ #define _GNU_SOURCE #include #include -#include +#include #include #include #include /* Definition of O_* constants */ diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c index 37de82da9be7..5cbf3f783d6c 100644 --- a/tools/testing/selftests/mm/ksm_functional_tests.c +++ b/tools/testing/selftests/mm/ksm_functional_tests.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -369,7 +369,6 @@ static void test_unmerge_discarded(void) munmap(map, size); } -#ifdef __NR_userfaultfd static void test_unmerge_uffd_wp(void) { struct uffdio_writeprotect uffd_writeprotect; @@ -430,7 +429,6 @@ static void test_unmerge_uffd_wp(void) unmap: munmap(map, size); } -#endif /* Verify that KSM can be enabled / queried with prctl. */ static void test_prctl(void) @@ -665,9 +663,7 @@ int main(int argc, char **argv) exit(test_child_ksm()); } -#ifdef __NR_userfaultfd tests++; -#endif ksft_print_header(); ksft_set_plan(tests); @@ -694,9 +690,7 @@ int main(int argc, char **argv) test_unmerge(); test_unmerge_zero_pages(); test_unmerge_discarded(); -#ifdef __NR_userfaultfd test_unmerge_uffd_wp(); -#endif test_prot_none(); diff --git a/tools/testing/selftests/mm/memfd_secret.c b/tools/testing/selftests/mm/memfd_secret.c index 9a0597310a76..74c911aa3aea 100644 --- a/tools/testing/selftests/mm/memfd_secret.c +++ b/tools/testing/selftests/mm/memfd_secret.c @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include #include @@ -28,8 +28,6 @@ #define pass(fmt, ...) ksft_test_result_pass(fmt, ##__VA_ARGS__) #define skip(fmt, ...) ksft_test_result_skip(fmt, ##__VA_ARGS__) -#ifdef __NR_memfd_secret - #define PATTERN 0x55 static const int prot = PROT_READ | PROT_WRITE; @@ -334,13 +332,3 @@ int main(int argc, char *argv[]) ksft_finished(); } - -#else /* __NR_memfd_secret */ - -int main(int argc, char *argv[]) -{ - printf("skip: skipping memfd_secret test (missing __NR_memfd_secret)\n"); - return KSFT_SKIP; -} - -#endif /* __NR_memfd_secret */ diff --git a/tools/testing/selftests/mm/mkdirty.c b/tools/testing/selftests/mm/mkdirty.c index b8a7efe9204e..1db134063c38 100644 --- a/tools/testing/selftests/mm/mkdirty.c +++ b/tools/testing/selftests/mm/mkdirty.c @@ -9,7 +9,7 @@ */ #include #include -#include +#include #include #include #include @@ -265,7 +265,6 @@ static void test_pte_mapped_thp(void) munmap(mmap_mem, mmap_size); } -#ifdef __NR_userfaultfd static void test_uffdio_copy(void) { struct uffdio_register uffdio_register; @@ -322,7 +321,6 @@ static void test_uffdio_copy(void) munmap(dst, pagesize); free(src); } -#endif /* __NR_userfaultfd */ int main(void) { @@ -335,9 +333,7 @@ int main(void) thpsize / 1024); tests += 3; } -#ifdef __NR_userfaultfd tests += 1; -#endif /* __NR_userfaultfd */ ksft_print_header(); ksft_set_plan(tests); @@ -367,9 +363,7 @@ int main(void) if (thpsize) test_pte_mapped_thp(); /* Placing a fresh page via userfaultfd may set the PTE dirty. */ -#ifdef __NR_userfaultfd test_uffdio_copy(); -#endif /* __NR_userfaultfd */ err = ksft_get_fail_cnt(); if (err) diff --git a/tools/testing/selftests/mm/mlock2.h b/tools/testing/selftests/mm/mlock2.h index 4417eaa5cfb7..1e5731bab499 100644 --- a/tools/testing/selftests/mm/mlock2.h +++ b/tools/testing/selftests/mm/mlock2.h @@ -3,6 +3,7 @@ #include #include #include +#include static int mlock2_(void *start, size_t len, int flags) { diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/selftests/mm/pagemap_ioctl.c index 2d785aca72a5..0e18f2ca8d93 100644 --- a/tools/testing/selftests/mm/pagemap_ioctl.c +++ b/tools/testing/selftests/mm/pagemap_ioctl.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/testing/selftests/mm/protection_keys.c b/tools/testing/selftests/mm/protection_keys.c index 48dc151f8fca..eaa6d1fc5328 100644 --- a/tools/testing/selftests/mm/protection_keys.c +++ b/tools/testing/selftests/mm/protection_keys.c @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include diff --git a/tools/testing/selftests/mm/uffd-common.c b/tools/testing/selftests/mm/uffd-common.c index 7ad6ba660c7d..717539eddf98 100644 --- a/tools/testing/selftests/mm/uffd-common.c +++ b/tools/testing/selftests/mm/uffd-common.c @@ -673,11 +673,7 @@ int uffd_open_dev(unsigned int flags) int uffd_open_sys(unsigned int flags) { -#ifdef __NR_userfaultfd return syscall(__NR_userfaultfd, flags); -#else - return -1; -#endif } int uffd_open(unsigned int flags) diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c index f78bab0f3d45..0abb9af0fc7f 100644 --- a/tools/testing/selftests/mm/uffd-stress.c +++ b/tools/testing/selftests/mm/uffd-stress.c @@ -33,11 +33,9 @@ * pthread_mutex_lock will also verify the atomicity of the memory * transfer (UFFDIO_COPY). */ - +#include #include "uffd-common.h" -#ifdef __NR_userfaultfd - #define BOUNCE_RANDOM (1<<0) #define BOUNCE_RACINGFAULTS (1<<1) #define BOUNCE_VERIFY (1<<2) @@ -466,15 +464,3 @@ int main(int argc, char **argv) nr_pages, nr_pages_per_cpu); return userfaultfd_stress(); } - -#else /* __NR_userfaultfd */ - -#warning "missing __NR_userfaultfd definition" - -int main(void) -{ - printf("skip: Skipping userfaultfd test (missing __NR_userfaultfd)\n"); - return KSFT_SKIP; -} - -#endif /* __NR_userfaultfd */ diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c index 21ec23206ab4..b3d21eed203d 100644 --- a/tools/testing/selftests/mm/uffd-unit-tests.c +++ b/tools/testing/selftests/mm/uffd-unit-tests.c @@ -5,12 +5,11 @@ * Copyright (C) 2015-2023 Red Hat, Inc. */ +#include #include "uffd-common.h" #include "../../../../mm/gup_test.h" -#ifdef __NR_userfaultfd - /* The unit test doesn't need a large or random size, make it 32MB for now */ #define UFFD_TEST_MEM_SIZE (32UL << 20) @@ -1554,14 +1553,3 @@ int main(int argc, char *argv[]) return ksft_get_fail_cnt() ? KSFT_FAIL : KSFT_PASS; } -#else /* __NR_userfaultfd */ - -#warning "missing __NR_userfaultfd definition" - -int main(void) -{ - printf("Skipping %s (missing __NR_userfaultfd)\n", __file__); - return KSFT_SKIP; -} - -#endif /* __NR_userfaultfd */