From patchwork Fri Oct 6 10:07:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13411236 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1838E92FFB for ; Fri, 6 Oct 2023 10:08:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231559AbjJFKIF (ORCPT ); Fri, 6 Oct 2023 06:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231207AbjJFKIE (ORCPT ); Fri, 6 Oct 2023 06:08:04 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD3EF9F; Fri, 6 Oct 2023 03:08:02 -0700 (PDT) Received: from localhost.localdomain (unknown [39.34.184.141]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madras.collabora.co.uk (Postfix) with ESMTPSA id 54FB96612212; Fri, 6 Oct 2023 11:07:59 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696586880; bh=/P0lxjquv/ZpR7Ni5SUJUUznYG0dkXXtdTFeHTzDUQo=; h=From:To:Cc:Subject:Date:From; b=jrP5aWqxBLjtDs2aLqN/U/f8VbG2WqcULJYTBjKFFBLvQDcjBxW9tvMx6p7w+1JAI YuIUBqH82skD1jce04v3XMOqMpvQuJti0FPhIq7t4WmHefpTEs8zenu2WlkPt5t3hs xqkLrHYJWvUwuG823jb8wcDLQHpHWaQxG7GuEw1dj0ZCNPCFEOqygjGknF1ymBKqUV RARjFl5dV3h89NAmZJJJwK6YyUbgHuOXt4sGsEvfUHctB9Hug6dgMbl8LfyMsI4+8r 1G/0/hdMZjLgeobtBZQEPNbfhDueSeGxy3rXvbyYgceMhjNZHbGoBmcNsi1WoIbEFC ZsT5y5Q6PwJXg== From: Muhammad Usama Anjum To: Shuah Khan , Muhammad Usama Anjum Cc: kernel@collabora.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] selftests: capabilities: remove duplicate unneeded defines Date: Fri, 6 Oct 2023 15:07:35 +0500 Message-Id: <20231006100743.1631334-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org These duplicate defines should automatically be picked up from kernel headers. Use KHDR_INCLUDES to add kernel header files. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/capabilities/Makefile | 2 +- tools/testing/selftests/capabilities/test_execve.c | 8 -------- tools/testing/selftests/capabilities/validate_cap.c | 8 -------- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/tools/testing/selftests/capabilities/Makefile b/tools/testing/selftests/capabilities/Makefile index 6e9d98d457d5b..411ac098308f1 100644 --- a/tools/testing/selftests/capabilities/Makefile +++ b/tools/testing/selftests/capabilities/Makefile @@ -2,7 +2,7 @@ TEST_GEN_FILES := validate_cap TEST_GEN_PROGS := test_execve -CFLAGS += -O2 -g -std=gnu99 -Wall +CFLAGS += -O2 -g -std=gnu99 -Wall $(KHDR_INCLUDES) LDLIBS += -lcap-ng -lrt -ldl include ../lib.mk diff --git a/tools/testing/selftests/capabilities/test_execve.c b/tools/testing/selftests/capabilities/test_execve.c index df0ef02b40367..e3a352b020a79 100644 --- a/tools/testing/selftests/capabilities/test_execve.c +++ b/tools/testing/selftests/capabilities/test_execve.c @@ -20,14 +20,6 @@ #include "../kselftest.h" -#ifndef PR_CAP_AMBIENT -#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 -#endif - static int nerrs; static pid_t mpid; /* main() pid is used to avoid duplicate test counts */ diff --git a/tools/testing/selftests/capabilities/validate_cap.c b/tools/testing/selftests/capabilities/validate_cap.c index cdfc94268fe6e..60b4e7b716a75 100644 --- a/tools/testing/selftests/capabilities/validate_cap.c +++ b/tools/testing/selftests/capabilities/validate_cap.c @@ -9,14 +9,6 @@ #include "../kselftest.h" -#ifndef PR_CAP_AMBIENT -#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 -#endif - #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) # define HAVE_GETAUXVAL #endif From patchwork Fri Oct 6 10:07:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13411237 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C78FE92FFE for ; Fri, 6 Oct 2023 10:08:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231597AbjJFKIH (ORCPT ); Fri, 6 Oct 2023 06:08:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231583AbjJFKIF (ORCPT ); Fri, 6 Oct 2023 06:08:05 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B159DAD; Fri, 6 Oct 2023 03:08:04 -0700 (PDT) Received: from localhost.localdomain (unknown [39.34.184.141]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madras.collabora.co.uk (Postfix) with ESMTPSA id DC83D66125F2; Fri, 6 Oct 2023 11:08:01 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696586883; bh=aWtDH3Z6axZxgatd0itj89C7sRFa6SKxitusc/fajtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fmiejCJszjjw+LeJC/lWDS1EKkRjW9s39EVwxYN4hhbVE3b9/OYiGxsjHUFQaRw0s POqNcVXNhyaYBvZs+gNcrjvqshzzeqmnKzEyIEYUhuemESiC6ZBo7vDfkOcz/z4hVH 6NdzdLzd07543vw+/eYchs4pzrdQP41xxD5Eb4x9qO9hFIMEV8ome2TR8XDmLLvgNJ yrb9PsD8nmnZJey6pueoGTvLwhcyXWTsb14OSIBR6rCqvI45ISKNm28thw75p8eCVN XuoLSMox4yiuQjLltZpf49aE4mNGjnQ1kj53FmMRZhBZGB/pFI7D1qQzmBog3xqPAq oZdExzsJxq8Ag== From: Muhammad Usama Anjum To: Christian Brauner , Shuah Khan Cc: Muhammad Usama Anjum , kernel@collabora.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 2/4] selftests: clone3: remove duplicate defines Date: Fri, 6 Oct 2023 15:07:36 +0500 Message-Id: <20231006100743.1631334-2-usama.anjum@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231006100743.1631334-1-usama.anjum@collabora.com> References: <20231006100743.1631334-1-usama.anjum@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Remove duplicate defines which are already included in kernel headers. MAX_PID_NS_LEVEL macro is used inside kernel only. It isn't exposed to userspace. So it is never defined in test application. Remove #ifndef in this case. Signed-off-by: Muhammad Usama Anjum --- Changes since v1: - Make patch explanation better --- .../clone3/clone3_cap_checkpoint_restore.c | 2 -- .../testing/selftests/clone3/clone3_clear_sighand.c | 4 ---- tools/testing/selftests/clone3/clone3_selftests.h | 13 ------------- tools/testing/selftests/clone3/clone3_set_tid.c | 2 -- 4 files changed, 21 deletions(-) diff --git a/tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c b/tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c index 52d3f0364bdaa..31b56d6256550 100644 --- a/tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c +++ b/tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c @@ -27,9 +27,7 @@ #include "../kselftest_harness.h" #include "clone3_selftests.h" -#ifndef MAX_PID_NS_LEVEL #define MAX_PID_NS_LEVEL 32 -#endif static void child_exit(int ret) { diff --git a/tools/testing/selftests/clone3/clone3_clear_sighand.c b/tools/testing/selftests/clone3/clone3_clear_sighand.c index 47a8c0fc3676b..54a8b2445be99 100644 --- a/tools/testing/selftests/clone3/clone3_clear_sighand.c +++ b/tools/testing/selftests/clone3/clone3_clear_sighand.c @@ -16,10 +16,6 @@ #include "../kselftest.h" #include "clone3_selftests.h" -#ifndef CLONE_CLEAR_SIGHAND -#define CLONE_CLEAR_SIGHAND 0x100000000ULL -#endif - static void nop_handler(int signo) { } diff --git a/tools/testing/selftests/clone3/clone3_selftests.h b/tools/testing/selftests/clone3/clone3_selftests.h index e81ffaaee02ba..3d2663fe50ba5 100644 --- a/tools/testing/selftests/clone3/clone3_selftests.h +++ b/tools/testing/selftests/clone3/clone3_selftests.h @@ -15,10 +15,6 @@ #define ptr_to_u64(ptr) ((__u64)((uintptr_t)(ptr))) -#ifndef CLONE_INTO_CGROUP -#define CLONE_INTO_CGROUP 0x200000000ULL /* Clone into a specific cgroup given the right permissions. */ -#endif - #ifndef __NR_clone3 #define __NR_clone3 -1 #endif @@ -32,18 +28,9 @@ struct __clone_args { __aligned_u64 stack; __aligned_u64 stack_size; __aligned_u64 tls; -#ifndef CLONE_ARGS_SIZE_VER0 -#define CLONE_ARGS_SIZE_VER0 64 /* sizeof first published struct */ -#endif __aligned_u64 set_tid; __aligned_u64 set_tid_size; -#ifndef CLONE_ARGS_SIZE_VER1 -#define CLONE_ARGS_SIZE_VER1 80 /* sizeof second published struct */ -#endif __aligned_u64 cgroup; -#ifndef CLONE_ARGS_SIZE_VER2 -#define CLONE_ARGS_SIZE_VER2 88 /* sizeof third published struct */ -#endif }; static pid_t sys_clone3(struct __clone_args *args, size_t size) diff --git a/tools/testing/selftests/clone3/clone3_set_tid.c b/tools/testing/selftests/clone3/clone3_set_tid.c index 0229e9ebb995e..ed785afb60770 100644 --- a/tools/testing/selftests/clone3/clone3_set_tid.c +++ b/tools/testing/selftests/clone3/clone3_set_tid.c @@ -23,9 +23,7 @@ #include "../kselftest.h" #include "clone3_selftests.h" -#ifndef MAX_PID_NS_LEVEL #define MAX_PID_NS_LEVEL 32 -#endif static int pipe_1[2]; static int pipe_2[2]; From patchwork Fri Oct 6 10:07:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13411238 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BD99E92FFE for ; Fri, 6 Oct 2023 10:08:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231583AbjJFKIM (ORCPT ); Fri, 6 Oct 2023 06:08:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231645AbjJFKIK (ORCPT ); Fri, 6 Oct 2023 06:08:10 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2D069F; Fri, 6 Oct 2023 03:08:08 -0700 (PDT) Received: from localhost.localdomain (unknown [39.34.184.141]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madras.collabora.co.uk (Postfix) with ESMTPSA id 195576612668; Fri, 6 Oct 2023 11:08:05 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696586887; bh=4T9UXJjURToNqR+AwgGUF57UmbiY2XyHR2+7wjgiYfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSdpbnTzRpB4wSE1JUUgxic4WBB0M4IDzSoUqPM1e0KtnWHcUcLoyTN1bBRqaRjEv xBCwLaXzupFElpWgiiErGmMiTEoiPGS0NRVaH2uthzINxw524gQg1NJpmA8IYurv5b eZdtw+YuF2tR44ThgTxB9d2Y2w1KLo/tFcv8g8vq7JyvwYyl4ebOB1WL7Qao/vANHq wnW7W6tM1zJMYKeBpvL7nnEmjxx6/HcxLS649Wj8ZEre7nTZP4AfXcS+OPOxHtpvpB sk1bgObTiuDxNeuhO3bPDG/yYhbmrISyimblMQkFdqz2iem4D0FYb87kmUGD19mgq4 sQqAS8/7puwZg== From: Muhammad Usama Anjum To: Shuah Khan , Muhammad Usama Anjum Cc: kernel@collabora.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] selftests: core: remove duplicate defines Date: Fri, 6 Oct 2023 15:07:37 +0500 Message-Id: <20231006100743.1631334-3-usama.anjum@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231006100743.1631334-1-usama.anjum@collabora.com> References: <20231006100743.1631334-1-usama.anjum@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Remove duplicate defines which are already defined in kernel headers and re-definition isn't required. Signed-off-by: Muhammad Usama Anjum --- .../testing/selftests/core/close_range_test.c | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/tools/testing/selftests/core/close_range_test.c b/tools/testing/selftests/core/close_range_test.c index 749239930ca83..534576f06df1c 100644 --- a/tools/testing/selftests/core/close_range_test.c +++ b/tools/testing/selftests/core/close_range_test.c @@ -16,34 +16,6 @@ #include "../kselftest_harness.h" #include "../clone3/clone3_selftests.h" -#ifndef __NR_close_range - #if defined __alpha__ - #define __NR_close_range 546 - #elif defined _MIPS_SIM - #if _MIPS_SIM == _MIPS_SIM_ABI32 /* o32 */ - #define __NR_close_range (436 + 4000) - #endif - #if _MIPS_SIM == _MIPS_SIM_NABI32 /* n32 */ - #define __NR_close_range (436 + 6000) - #endif - #if _MIPS_SIM == _MIPS_SIM_ABI64 /* n64 */ - #define __NR_close_range (436 + 5000) - #endif - #elif defined __ia64__ - #define __NR_close_range (436 + 1024) - #else - #define __NR_close_range 436 - #endif -#endif - -#ifndef CLOSE_RANGE_UNSHARE -#define CLOSE_RANGE_UNSHARE (1U << 1) -#endif - -#ifndef CLOSE_RANGE_CLOEXEC -#define CLOSE_RANGE_CLOEXEC (1U << 2) -#endif - static inline int sys_close_range(unsigned int fd, unsigned int max_fd, unsigned int flags) { From patchwork Fri Oct 6 10:07:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13411239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EAC0E92FFB for ; Fri, 6 Oct 2023 10:08:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231648AbjJFKIT (ORCPT ); Fri, 6 Oct 2023 06:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231670AbjJFKIQ (ORCPT ); Fri, 6 Oct 2023 06:08:16 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66CF9FA; Fri, 6 Oct 2023 03:08:12 -0700 (PDT) Received: from localhost.localdomain (unknown [39.34.184.141]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madras.collabora.co.uk (Postfix) with ESMTPSA id C0AA96612212; Fri, 6 Oct 2023 11:08:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696586891; bh=d3OOu4X1+6LdLbtOeqh4zt3O5EoMiW32b7riykuvMiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJpMoqgARKxlrxvE+GxBvcWAtc7MbgXZS71nppsrKEBpUPlc0R5bdKyRHV/l501fg P83sEu77FZ15rDbNb/9cXn8isvhZiqqFHXaSIL9DK/VEOsCtDYdGzQAUK+CimYP/5J meytARV872FUCZVx2xt6bHcUdeiFiPogWMEuI763LFoTOJySY1oyy/GJvO7zMDejuC nBHAFTLJfPLSVKUstw039itQgjks6Y8tMU++eAQ0zZSLigkh3KVxIq0zbOhC/0fBuS VnBbT2XKN/QAQs9tojmzw9MFRbr81Z1YwlrCrgzGplOxrJhiOWa8Z2BZqanh0UBmnC 1JunAiyfke/kA== From: Muhammad Usama Anjum To: Shuah Khan , Muhammad Usama Anjum Cc: kernel@collabora.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] selftests: firmware: remove duplicate unneeded defines Date: Fri, 6 Oct 2023 15:07:38 +0500 Message-Id: <20231006100743.1631334-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231006100743.1631334-1-usama.anjum@collabora.com> References: <20231006100743.1631334-1-usama.anjum@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org These duplicate defines should automatically be picked up from kernel headers. Signed-off-by: Muhammad Usama Anjum --- Changes since v1: - Make the patch explanation better --- tools/testing/selftests/firmware/fw_namespace.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/testing/selftests/firmware/fw_namespace.c b/tools/testing/selftests/firmware/fw_namespace.c index 4c6f0cd83c5b0..04757dc7e5467 100644 --- a/tools/testing/selftests/firmware/fw_namespace.c +++ b/tools/testing/selftests/firmware/fw_namespace.c @@ -17,10 +17,6 @@ #include #include -#ifndef CLONE_NEWNS -# define CLONE_NEWNS 0x00020000 -#endif - static char *fw_path = NULL; static void die(char *fmt, ...)