From patchwork Mon Dec 9 09:47:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Khrustalev X-Patchwork-Id: 13899161 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 56220E77173 for ; Mon, 9 Dec 2024 09:48:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E18B36B03F5; Mon, 9 Dec 2024 04:48:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DC8AC8D0029; Mon, 9 Dec 2024 04:48:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CDFBD6B03F8; Mon, 9 Dec 2024 04:48:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B060C6B03F5 for ; Mon, 9 Dec 2024 04:48:02 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 66023AD6B9 for ; Mon, 9 Dec 2024 09:48:02 +0000 (UTC) X-FDA: 82874943606.25.C3C54A6 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf24.hostedemail.com (Postfix) with ESMTP id 2E40D180007 for ; Mon, 9 Dec 2024 09:47:58 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf24.hostedemail.com: domain of yury.khrustalev@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=yury.khrustalev@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733737661; a=rsa-sha256; cv=none; b=SdudSeyDMB/5fiRf9mp7zcsDPkuOpDp8j+rKctIH8keNH+UvA7/XuAG5trfLfCp6aEQfOG /qQx5DJ/2H/z4PUeHOBGQfOr1UmjyrC3IqqIcSWI7ZKCaslrujQpr+cjiZILAYmpQGxokN kE9yfeMMMvq2AOCyk7jiRtmDPGpYQcQ= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf24.hostedemail.com: domain of yury.khrustalev@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=yury.khrustalev@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733737661; 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:in-reply-to:references:references; bh=NoSyfg0H2xdXV8bVJGF6NwXUo5Fiq0F8nFCklb+ts3Y=; b=WcETE6SmMxxclGES8u1YfN+zaLeVWY4k7I8IG4Y8pLBsEQtNOcIxZpK4WyXMpmcS8cu+yz aneEwDu/sLs6r6pMOFBrETde3sUcmFQmTCyzbJbYos3c54hMuviUCZWQlU9eyEEqREjpo/ YMHsnostheSW2Pdifmiv/3T77jU/VZY= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1C580175D; Mon, 9 Dec 2024 01:48:28 -0800 (PST) Received: from udebian.localdomain (unknown [10.1.35.36]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E97E13F720; Mon, 9 Dec 2024 01:47:57 -0800 (PST) From: Yury Khrustalev To: linux-arch@vger.kernel.org Cc: Arnd Bergmann , Kevin Brodsky , Joey Gouly , Dave Hansen , Sandipan Das , Michael Ellerman , Catalin Marinas , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, nd@arm.com, Yury Khrustalev Subject: [RESEND v4 3/3] selftests/powerpc: Use PKEY_UNRESTRICTED macro Date: Mon, 9 Dec 2024 09:47:19 +0000 Message-Id: <20241209094719.2431126-4-yury.khrustalev@arm.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241209094719.2431126-1-yury.khrustalev@arm.com> References: <20241209094719.2431126-1-yury.khrustalev@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2E40D180007 X-Stat-Signature: 1wxobstdknygbwrsuym3zcmes3pusa3j X-Rspam-User: X-HE-Tag: 1733737678-755592 X-HE-Meta: U2FsdGVkX18lDby0MeGpjnVfginFEVWKbTZ38WmGwImijmm/tJ6cXyzOAKkC+tSJ7vheotggj3HIqh8UNUk3xUnhkpHuTxKcknQhOhULKyd7YvGveH7B8usF0UzbJfINwb2yDtxY9G/aXON8JLojmRURTGfzD2/cGVr1Aha1xWFXbbpS/D2F0VUV+sAIArbO5YVLmxgrTHTOE/IdwkTgUIhutSslcm7n99+fMJwgvHqbcnqUgumvrlHcOFFRZMzUlVgkbJ1tSpfGoxBS2E9PsjHLEQY2QWLa8EbjNrMd/E6oAiJebDkhFopBS0QvlRcwIkZtSPedcAGzbuktBhsvKL5lYxSvzzG+K0Z859FYZ7mh5w5rpSp80cUKjV9Haj8GK0+G9pqyPo/M3kl754x4ksOBKAqwaFiJycDF+ZQcih0T0ntdfIw3KH95FxHfKaxgvp8oCL9aZAW1ANKyBDyonTPdQb09vELZ8waykj5MP8qyOpgNoeDjlqndMwqH3pzlj4NhcjtKXzzpQdmiaTHQEf+SJhR+7yaT1L9WzH4QdYFHm9V1Atuf3/pWP5nChpF8wVAKxBzksQckcovG17JYLfHNCxrLu5MSFZY+0Jq4sYyPRfvdLgTRqO7csWu3ej2+NP03A1uzg6HJHYHHjYmcFe3zPNUU5S4SgNefUgtjpTWe//cX1dn2XvQnWwE7SxvCFqXQjhCzuxpxINU0ySqJ6YsEUAqnAv3gP4NYTXVqrf1tI19plFgKx1tBZk/SDO5iqeznYY5U77P3a7Mgu0xBk+QGg00v0lyEMKr3Ri9vB39FN1kBnEHMjnfMWEQrDZhPZoWi8e2LWJAOuY4peQB+LFqqZdpKChhoWi756hXUbpWjA+pcdFp6DtebqB67XdAbcvl5U2mPSaWaSDRk9qs/vLrLDiX1jcxnr9mztGae2gGXWRAkyiQJkNq+GFybeev7TRJgzs9h/Uqmi0aBCD2 0hcFh96O jbKNeU6BcVfuRE0E8vpYe8UgPiH6DatHHYIodq00g80Iz9f5rDibe3A+O9QvBt8uABcG6mSrb8SmAR/kr4GcvMEukjV8hnc67zx9Ws0eeCTpDRdUKIqJQynrmbks/04q3xV7ZdyCmW1oakVPt4X3teNg4h2ukBy+yjSkJnDHWxJIK+xPqIdoDdZWdPlT8R2Q9hZOc1F4t+isRRHM9G1BUD0Xop+tKYiyAbhPoZndhKE9d/JwX33kEtwc5qYWNZKnk5I7PpNHeTYglJ/I8wyH5TvGvndJW6oGNb0Kfc5MpxLFUJJxFMFvuyUJDi5dHaNy8yI7kE8VeT7tZJDI= 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: Replace literal 0 with macro PKEY_UNRESTRICTED where pkey_*() functions are used in mm selftests for memory protection keys for ppc target. Signed-off-by: Yury Khrustalev Suggested-by: Kevin Brodsky Reviewed-by: Kevin Brodsky --- Note that I couldn't build these tests so I would appreciate if someone could check this patch. Thank you! --- tools/testing/selftests/powerpc/include/pkeys.h | 2 +- tools/testing/selftests/powerpc/mm/pkey_exec_prot.c | 2 +- tools/testing/selftests/powerpc/mm/pkey_siginfo.c | 2 +- tools/testing/selftests/powerpc/ptrace/core-pkey.c | 6 +++--- tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/powerpc/include/pkeys.h b/tools/testing/selftests/powerpc/include/pkeys.h index 51729d9a7111..430cb4bd7472 100644 --- a/tools/testing/selftests/powerpc/include/pkeys.h +++ b/tools/testing/selftests/powerpc/include/pkeys.h @@ -85,7 +85,7 @@ int pkeys_unsupported(void) SKIP_IF(!hash_mmu); /* Check if the system call is supported */ - pkey = sys_pkey_alloc(0, 0); + pkey = sys_pkey_alloc(0, PKEY_UNRESTRICTED); SKIP_IF(pkey < 0); sys_pkey_free(pkey); diff --git a/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c b/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c index 0af4f02669a1..29b91b7456eb 100644 --- a/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c +++ b/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c @@ -72,7 +72,7 @@ static void segv_handler(int signum, siginfo_t *sinfo, void *ctx) switch (fault_type) { case PKEY_DISABLE_ACCESS: - pkey_set_rights(fault_pkey, 0); + pkey_set_rights(fault_pkey, PKEY_UNRESTRICTED); break; case PKEY_DISABLE_EXECUTE: /* diff --git a/tools/testing/selftests/powerpc/mm/pkey_siginfo.c b/tools/testing/selftests/powerpc/mm/pkey_siginfo.c index 2db76e56d4cb..e89a164c686b 100644 --- a/tools/testing/selftests/powerpc/mm/pkey_siginfo.c +++ b/tools/testing/selftests/powerpc/mm/pkey_siginfo.c @@ -83,7 +83,7 @@ static void segv_handler(int signum, siginfo_t *sinfo, void *ctx) mprotect(pgstart, pgsize, PROT_EXEC)) _exit(1); else - pkey_set_rights(pkey, 0); + pkey_set_rights(pkey, PKEY_UNRESTRICTED); fault_count++; } diff --git a/tools/testing/selftests/powerpc/ptrace/core-pkey.c b/tools/testing/selftests/powerpc/ptrace/core-pkey.c index f6da4cb30cd6..64c985445cb7 100644 --- a/tools/testing/selftests/powerpc/ptrace/core-pkey.c +++ b/tools/testing/selftests/powerpc/ptrace/core-pkey.c @@ -124,16 +124,16 @@ static int child(struct shared_info *info) /* Get some pkeys so that we can change their bits in the AMR. */ pkey1 = sys_pkey_alloc(0, PKEY_DISABLE_EXECUTE); if (pkey1 < 0) { - pkey1 = sys_pkey_alloc(0, 0); + pkey1 = sys_pkey_alloc(0, PKEY_UNRESTRICTED); FAIL_IF(pkey1 < 0); disable_execute = false; } - pkey2 = sys_pkey_alloc(0, 0); + pkey2 = sys_pkey_alloc(0, PKEY_UNRESTRICTED); FAIL_IF(pkey2 < 0); - pkey3 = sys_pkey_alloc(0, 0); + pkey3 = sys_pkey_alloc(0, PKEY_UNRESTRICTED); FAIL_IF(pkey3 < 0); info->amr |= 3ul << pkeyshift(pkey1) | 2ul << pkeyshift(pkey2); diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c b/tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c index d89474377f11..37794f82ed66 100644 --- a/tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c +++ b/tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c @@ -81,16 +81,16 @@ static int child(struct shared_info *info) /* Get some pkeys so that we can change their bits in the AMR. */ pkey1 = sys_pkey_alloc(0, PKEY_DISABLE_EXECUTE); if (pkey1 < 0) { - pkey1 = sys_pkey_alloc(0, 0); + pkey1 = sys_pkey_alloc(0, PKEY_UNRESTRICTED); CHILD_FAIL_IF(pkey1 < 0, &info->child_sync); disable_execute = false; } - pkey2 = sys_pkey_alloc(0, 0); + pkey2 = sys_pkey_alloc(0, PKEY_UNRESTRICTED); CHILD_FAIL_IF(pkey2 < 0, &info->child_sync); - pkey3 = sys_pkey_alloc(0, 0); + pkey3 = sys_pkey_alloc(0, PKEY_UNRESTRICTED); CHILD_FAIL_IF(pkey3 < 0, &info->child_sync); info->amr1 |= 3ul << pkeyshift(pkey1);