From patchwork Thu Jan 9 17:38:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13933051 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 8F7DFE77197 for ; Thu, 9 Jan 2025 17:39:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2AC366B0093; Thu, 9 Jan 2025 12:39:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 25D006B0095; Thu, 9 Jan 2025 12:39:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D7346B0096; Thu, 9 Jan 2025 12:39:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DD0A06B0093 for ; Thu, 9 Jan 2025 12:39:20 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A26BBAE9B4 for ; Thu, 9 Jan 2025 17:39:20 +0000 (UTC) X-FDA: 82988624880.05.1875423 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by imf20.hostedemail.com (Postfix) with ESMTP id DDCFA1C0015 for ; Thu, 9 Jan 2025 17:39:18 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=collabora.com header.s=zohomail header.b=RxGbR76O; dmarc=pass (policy=none) header.from=collabora.com; arc=pass ("zohomail.com:s=zohoarc:i=1"); spf=pass (imf20.hostedemail.com: domain of usama.anjum@collabora.com designates 136.143.188.112 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1736444359; a=rsa-sha256; cv=pass; b=WVtpMxtgkPv1VJR0X/DP/09waVyxOpBZR/R2Kf/p267sTXNrt3jJ71sP2Z+hQM1CsvEtpm Zfw0atAbnkW6t7tOmb3sVk4VkDBJ6qv4w66C2A8LwF1t8s6LVN8SZAW4d4yLE0/FjDB2f6 X7H39jCJ4kUlpyV9MvUBus66X0JMUig= ARC-Authentication-Results: i=2; imf20.hostedemail.com; dkim=pass header.d=collabora.com header.s=zohomail header.b=RxGbR76O; dmarc=pass (policy=none) header.from=collabora.com; arc=pass ("zohomail.com:s=zohoarc:i=1"); spf=pass (imf20.hostedemail.com: domain of usama.anjum@collabora.com designates 136.143.188.112 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736444359; 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:dkim-signature; bh=wQRYp4NaHn6qZOxrq/QHoWxtMXxEn9kcEYhJcS6nYa8=; b=F1DZDnBMXAMZ/VyNHlcVb1YLR6bQiTjeFfc8/kpBtOdqk81yUns86zVRPU4IdeYjYsMEsD UgBslo+X/xvSdIodlRP4wJmmheA94XC69JfO5NFbXapz8fI3Mqzv1aJKRfMuH9j2hLZoat GXguwT5LDk4dZKmTDjj8GHBZ7W+gAg8= ARC-Seal: i=1; a=rsa-sha256; t=1736444343; cv=none; d=zohomail.com; s=zohoarc; b=YklJUeOzj8JLFJvKWPF881sglOIFJXR/Q94B968H/0eeoGYOud4eIIN43wmKOd9xvXbOYLxDSsf1kDv0Od7q6rida9iSBfoi5pg9j8p7qYmJIED4xDz9D6PhWP62wenRv+iKnv6/W7eN+uS/AG8E6Qj/FQ18GaVR0sEel6TvYPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736444343; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=wQRYp4NaHn6qZOxrq/QHoWxtMXxEn9kcEYhJcS6nYa8=; b=lfOS/OsurKC7ZWxEKVxVBdOLaFCA/fAFKIC/MgdmBrsmd9CSD9axohcszYu2ZLCYNZrdT55CkuYrtMzZNa9bXhZ/aSPfaC+yOCxZOPn7MyZzkTx1mzXJapx48JiscJgGxhp6p/VD39HRthQAkx0SiH/SHe0bE+ErD1xDWP2H5yk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1736444343; s=zohomail; d=collabora.com; i=usama.anjum@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=wQRYp4NaHn6qZOxrq/QHoWxtMXxEn9kcEYhJcS6nYa8=; b=RxGbR76OTIUSMV5K6a1KOXlhEkaEYHu+EO7eJCjD4eZaFD+kti0SnJ9nfBh/X/fO vgyqep6C/rnHMyohN+Byz2GqbckBRV6dsgG3Cqxk3AzTxECG847KiAswzj+nfUCuR4/ HGeeGDzUTX4gMEQk5D5hHzETlANo1wrKfD5PytQQ= Received: by mx.zohomail.com with SMTPS id 1736444341790884.6842476868715; Thu, 9 Jan 2025 09:39:01 -0800 (PST) From: Muhammad Usama Anjum To: Kees Cook , Andy Lutomirski , Will Drewry , Shuah Khan , Andrew Morton , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Muhammad Usama Anjum , kernel@collabora.com Subject: [PATCH 03/16] selftests/mm: Fix unused parameter warnings Date: Thu, 9 Jan 2025 22:38:29 +0500 Message-Id: <20250109173842.1142376-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109173842.1142376-1-usama.anjum@collabora.com> References: <20250109173842.1142376-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-ZohoMailClient: External X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: DDCFA1C0015 X-Stat-Signature: ya3m8gsgpkfbhoy67cxfjyj4i38f5tez X-HE-Tag: 1736444358-717496 X-HE-Meta: U2FsdGVkX1/Y79EWYV950yvV0jGZStspDjcWtmX4/R+CJj0hXOJpchTEL7K39+BsEJhTgvfeP3Wz170jh1Ps4d+zGoi+lSl2l+0zj7eHl7TbPQQhTxYpP2LAwDIdkcONkrCZLA7+Qv8+JjO+dQdkdii0t1a3yfA/9dQewYBeCbpJjt9oGOUfoDK1VImCjKHTo7jFFDnfeaIyWVL+mm4ah6Ut420ZbVry+BfhBrynEbk7DD1fl58B+Uf22qYivrrRlMAOz6rjOS9iDCRD0uJ9eXG+kH9SBNpZ2y9nbdJ6PUaKel6uWaD7IGX5sG2HNCb2pOQ0w96lDN5kzniCbIBp2nTJPh5vRNzrF9sR44SbdvB10v8ookYyFJDN9sGwUCgJe5QZxcMRr4MeawEzGIm4QB8lBQuzHtdayGchfyKVmQrr52i7JjalWArnn/r6QHyiuSZwWiUmzharz3DlAzPSfWuqHvsP1UZ0N/B+l/85kzRbs8cGilhy/ymBE56FzqFCVFSQ3aqysRGhcSEl2h4i/j9AtbNM3FB+X7/hzkx85/JAeuxIsJ+8sJsBzTehi5MPIhfEtV8M+SRRFNDmELTO8kl/GURZtjpBjaXxXzoO8DJBS5xLAseJq8EYbq3z0HFwhu1LdJBcghzTyIyIEsI8viEhqriQRyZsFU2WZ/yYB2TvTcPlFaY5+blA6FRk3b1Iva8GyTC3r9ystzixfpP7bykG69oqCdsPPdZP/IckCDT91OHzI73vGOamJSKpThr9GtXohXtIrt/RYkvNxgLHlBDZ4pSHsAhl7Jha6AkZWIAp5rwsGEGXRHm2WPmE3p61byPrZcHe6Z6DmE3Cn91dp9xwxvvVrc+oNh1nLq4OfSMX8/cHWM9grS16wo7g8W4NlAC9kyQGruETdxI6LtGniZhKi+Sdvf/e3lR2j2ndi2O9/JM5KHob3YMsthgW68UCLavcYqy7woFx9jbcHff AmLKRgtQ u10SvhzyjnW2GJkYnEUqsyJyHw1g1M7c/Ug6kCS+Q34wOreACdJIG4OMZQ94bZPKIzaMedpm+0yiD5MllC0SnMiN49w+cz70PGl36srhF2yWn3LMrurR0GrvKrIQy1uWSdopgLK+L5FloBrfZYJsL1ZUb8mQTtWeAuFoDPgjlByaNegA2WMSQO/GALgi+D/4RSpuwbwFR3S5GQ4jX9xi3BWEeOGh0OYtrySAYOwYTEFXOETSCCinaRJqgDeUHHrHHxmVAJ6MYNwXxQxUqse2R92iftmwYp/6cSB66KwcrulNhrG3JuWJfM4O0f+H+Y3FDqEfJ 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: Fix unused parameter warnings. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/pkey-x86.h | 4 +++- .../selftests/mm/pkey_sighandler_tests.c | 17 +++++++++++------ tools/testing/selftests/mm/protection_keys.c | 18 ++++++++++-------- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/tools/testing/selftests/mm/pkey-x86.h b/tools/testing/selftests/mm/pkey-x86.h index f7ecd335df1e6..75cef8ee00702 100644 --- a/tools/testing/selftests/mm/pkey-x86.h +++ b/tools/testing/selftests/mm/pkey-x86.h @@ -157,7 +157,9 @@ static inline void expect_fault_on_read_execonly_key(void *p1, int pkey) expected_pkey_fault(pkey); } -static inline void *malloc_pkey_with_mprotect_subpage(long size, int prot, u16 pkey) +static inline void *malloc_pkey_with_mprotect_subpage(long __attribute__((unused)) size, + int __attribute__((unused)) prot, + u16 __attribute__((unused)) pkey) { return PTR_ERR_ENOTSUP; } diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c index 249989f8b7a2a..cd46528d6c215 100644 --- a/tools/testing/selftests/mm/pkey_sighandler_tests.c +++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c @@ -42,7 +42,8 @@ static siginfo_t siginfo = {0}; * which is protected by MPK 0 which we don't have access to. */ static inline __always_inline -long syscall_raw(long n, long a1, long a2, long a3, long a4, long a5, long a6) +long syscall_raw(long n, long a1, long a2, long a3, long a4, long a5, + long __attribute__((unused)) a6) { unsigned long ret; #ifdef __x86_64__ @@ -110,7 +111,8 @@ static inline u64 pkey_reg_restrictive_default(void) return set_pkey_bits(PKEY_REG_ALLOW_NONE, 0, PKEY_DISABLE_ACCESS); } -static void sigsegv_handler(int signo, siginfo_t *info, void *ucontext) +static void sigsegv_handler(int __attribute__((unused)) signo, siginfo_t *info, + void __attribute__((unused)) *ucontext) { pthread_mutex_lock(&mutex); @@ -122,7 +124,8 @@ static void sigsegv_handler(int signo, siginfo_t *info, void *ucontext) syscall_raw(SYS_exit, 0, 0, 0, 0, 0, 0); } -static void sigusr1_handler(int signo, siginfo_t *info, void *ucontext) +static void sigusr1_handler(int __attribute__((unused)) signo, siginfo_t *info, + void __attribute__((unused)) *ucontext) { pthread_mutex_lock(&mutex); @@ -132,7 +135,9 @@ static void sigusr1_handler(int signo, siginfo_t *info, void *ucontext) pthread_mutex_unlock(&mutex); } -static void sigusr2_handler(int signo, siginfo_t *info, void *ucontext) +static void sigusr2_handler(int __attribute__((unused)) signo, + siginfo_t __attribute__((unused)) *info, + void __attribute__((unused)) *ucontext) { /* * pkru should be the init_pkru value which enabled MPK 0 so @@ -155,7 +160,7 @@ static void raise_sigusr2(void) */ } -static void *thread_segv_with_pkey0_disabled(void *ptr) +static void *thread_segv_with_pkey0_disabled(void __attribute__((unused)) *ptr) { /* Disable MPK 0 (and all others too) */ __write_pkey_reg(pkey_reg_restrictive_default()); @@ -165,7 +170,7 @@ static void *thread_segv_with_pkey0_disabled(void *ptr) return NULL; } -static void *thread_segv_pkuerr_stack(void *ptr) +static void *thread_segv_pkuerr_stack(void __attribute__((unused)) *ptr) { /* Disable MPK 0 (and all others too) */ __write_pkey_reg(pkey_reg_restrictive_default()); diff --git a/tools/testing/selftests/mm/protection_keys.c b/tools/testing/selftests/mm/protection_keys.c index a4683f2476f27..3a66798a8e8d6 100644 --- a/tools/testing/selftests/mm/protection_keys.c +++ b/tools/testing/selftests/mm/protection_keys.c @@ -309,7 +309,7 @@ static char *si_code_str(int si_code) static int pkey_faults; static int last_si_pkey = -1; -static void signal_handler(int signum, siginfo_t *si, void *vucontext) +static void signal_handler(int __attribute__((unused)) signum, siginfo_t *si, void *vucontext) { ucontext_t *uctxt = vucontext; int trapno; @@ -891,7 +891,7 @@ static void close_test_fds(void) nr_test_fds = 0; } -static void test_pkey_alloc_free_attach_pkey0(int *ptr, u16 pkey) +static void test_pkey_alloc_free_attach_pkey0(int *ptr, u16 __attribute__((unused)) pkey) { int i, err; int max_nr_pkey_allocs; @@ -1108,7 +1108,7 @@ static void test_pkey_syscalls_on_non_allocated_pkey(int *ptr, u16 pkey) } /* Assumes that all pkeys other than 'pkey' are unallocated */ -static void test_pkey_syscalls_bad_args(int *ptr, u16 pkey) +static void test_pkey_syscalls_bad_args(int *ptr, u16 __attribute__((unused)) pkey) { int err; int bad_pkey = NR_PKEYS+99; @@ -1134,7 +1134,7 @@ static void become_child(void) } /* Assumes that all pkeys other than 'pkey' are unallocated */ -static void test_pkey_alloc_exhaust(int *ptr, u16 pkey) +static void test_pkey_alloc_exhaust(int __attribute__((unused)) *ptr, u16 __attribute__((unused)) pkey) { int err; int allocated_pkeys[NR_PKEYS] = {0}; @@ -1240,7 +1240,7 @@ static void arch_force_pkey_reg_init(void) * a long-running test that continually checks the pkey * register. */ -static void test_pkey_init_state(int *ptr, u16 pkey) +static void test_pkey_init_state(int __attribute__((unused)) *ptr, u16 __attribute__((unused)) pkey) { int err; int allocated_pkeys[NR_PKEYS] = {0}; @@ -1399,7 +1399,7 @@ static void *get_pointer_to_instructions(void) return p1; } -static void test_executing_on_unreadable_memory(int *ptr, u16 pkey) +static void test_executing_on_unreadable_memory(int __attribute__((unused)) *ptr, u16 pkey) { void *p1; int scratch; @@ -1431,7 +1431,8 @@ static void test_executing_on_unreadable_memory(int *ptr, u16 pkey) pkey_assert(!ret); } -static void test_implicit_mprotect_exec_only_memory(int *ptr, u16 pkey) +static void test_implicit_mprotect_exec_only_memory(int __attribute__((unused)) *ptr, + u16 __attribute__((unused)) pkey) { void *p1; int scratch; @@ -1480,7 +1481,8 @@ static void test_implicit_mprotect_exec_only_memory(int *ptr, u16 pkey) } #if defined(__i386__) || defined(__x86_64__) -static void test_ptrace_modifies_pkru(int *ptr, u16 pkey) +static void test_ptrace_modifies_pkru(int __attribute__((unused)) *ptr, + u16 __attribute__((unused)) pkey) { u32 new_pkru; pid_t child;