From patchwork Fri Jul 28 17:29:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 13332186 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 2C856C001E0 for ; Fri, 28 Jul 2023 17:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234235AbjG1R3p (ORCPT ); Fri, 28 Jul 2023 13:29:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233851AbjG1R3g (ORCPT ); Fri, 28 Jul 2023 13:29:36 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B43C2D64 for ; Fri, 28 Jul 2023 10:29:32 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id ca18e2360f4ac-7748ca56133so23306039f.0 for ; Fri, 28 Jul 2023 10:29:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1690565371; x=1691170171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TyD41TjCbmVuD3Q46FNMhjbjisbmz8hDWYj37AkUnHk=; b=hRWim4l1+IGA137PJlwexSNurfpuER9flcSAxOm4LsJLdw4LW3UU3afJMVs4uU00D3 1Qt5g/3GnnH930VtMFyQBycmOwkuWCDxTkUfNRg36JNk6CjHSj/4FJQSx52zavvuSDms r8tm/WVlJJnSmLy94GGd+gUn1klK5b8ETym7Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690565371; x=1691170171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TyD41TjCbmVuD3Q46FNMhjbjisbmz8hDWYj37AkUnHk=; b=mFc/w9ghbcRONybu9yrXQjRONh8z2KZkVtOVibljYZH2pImi4dCdfdSd8hAHg/Jl05 YAKjmt1tN7UgoVMLzn6qPZB/SidqRLaoIX4XvBV/5Y92grXmGknyxDp953wtXaB5+JQd o1YSF8lISANMlLcGmCdrTRpmrSD4tjZrKmi8oYKmWIsocRtKPTHV1XimkT/DOFNo6MG4 XwoRIysrg2axOAM2NObEL/QOLalgOydr+k9UR6oKMXA3RVR92p2Szu2jhAA2JYbHnB1/ b5cARg7Uep62d3wOppYE22fCxD/KrNOPw6Wpr473IGhP9Jkx2O6yggSw6IrhZEb9PznW Dlqg== X-Gm-Message-State: ABy/qLagGlaXdAkNRfXAXYd+WupHK/CD9iLGLfv5Y8/crpY4/GPVD5+B CX7Hnrb4iWzXrbyp63AnNjs6Qm5Pf0UDL7gpBkQZ69am X-Google-Smtp-Source: APBJJlEG47QTZ1NoYk+U+Zk7I8oCNRRLU7ElqoKqeRa52rla1kFe15V3Xjtvfnln+NhSRMvp/M6PGg== X-Received: by 2002:a05:6602:2b91:b0:77a:ee79:652 with SMTP id r17-20020a0566022b9100b0077aee790652mr339190iov.1.1690565371630; Fri, 28 Jul 2023 10:29:31 -0700 (PDT) Received: from shuah-tx13.internal ([38.15.45.1]) by smtp.gmail.com with ESMTPSA id b2-20020a029a02000000b0042b37dda71asm1181050jal.136.2023.07.28.10.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jul 2023 10:29:30 -0700 (PDT) From: Shuah Khan To: shuah@kernel.org, Liam.Howlett@oracle.com, anjali.k.kulkarni@oracle.com, naresh.kamboju@linaro.org, kuba@kernel.org Cc: Shuah Khan , davem@davemloft.net, lkft-triage@lists.linaro.org, netdev@vger.kernel.org, llvm@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH next 1/3] selftests:connector: Fix Makefile to include KHDR_INCLUDES Date: Fri, 28 Jul 2023 11:29:26 -0600 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The test compile fails with following errors. Fix the Makefile CFLAGS to include KHDR_INCLUDES to pull in uapi defines. gcc -Wall proc_filter.c -o ../tools/testing/selftests/connector/proc_filter proc_filter.c: In function ‘send_message’: proc_filter.c:22:33: error: invalid application of ‘sizeof’ to incomplete type ‘struct proc_input’ 22 | sizeof(struct proc_input)) | ^~~~~~ proc_filter.c:42:19: note: in expansion of macro ‘NL_MESSAGE_SIZE’ 42 | char buff[NL_MESSAGE_SIZE]; | ^~~~~~~~~~~~~~~ proc_filter.c:22:33: error: invalid application of ‘sizeof’ to incomplete type ‘struct proc_input’ 22 | sizeof(struct proc_input)) | ^~~~~~ proc_filter.c:48:34: note: in expansion of macro ‘NL_MESSAGE_SIZE’ 48 | hdr->nlmsg_len = NL_MESSAGE_SIZE; | ^~~~~~~~~~~~~~~ ` Reported-by: Naresh Kamboju Link: https://lore.kernel.org/all/CA+G9fYt=6ysz636XcQ=-KJp7vJcMZ=NjbQBrn77v7vnTcfP2cA@mail.gmail.com/ Signed-off-by: Shuah Khan Reviewed-by: Anjali Kulkarni --- tools/testing/selftests/connector/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/connector/Makefile b/tools/testing/selftests/connector/Makefile index 21c9f3a973a0..92188b9bac5c 100644 --- a/tools/testing/selftests/connector/Makefile +++ b/tools/testing/selftests/connector/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -CFLAGS += -Wall +CFLAGS += -Wall $(KHDR_INCLUDES) TEST_GEN_PROGS = proc_filter From patchwork Fri Jul 28 17:29:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 13332183 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 C48D5C07E8E for ; Fri, 28 Jul 2023 17:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230373AbjG1R3h (ORCPT ); Fri, 28 Jul 2023 13:29:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233592AbjG1R3f (ORCPT ); Fri, 28 Jul 2023 13:29:35 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DB343A81 for ; Fri, 28 Jul 2023 10:29:33 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id ca18e2360f4ac-7748ca56133so23306839f.0 for ; Fri, 28 Jul 2023 10:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1690565372; x=1691170172; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dT09jtLuy7a5zKnUmbIcfbqwcSckF6Rn16/QMnBw9d4=; b=ik1kl2QQs6gPAyqKxmdly76qC7JHXn+5QGW4RI0PwbnJ0R/L395Y9sycGvRLYDQcZy nOWDXXXddSS5rl784gp45eNnu+DdKmIEWVUWQ4TW9vyspok+cwRiIAg60ADmJe70X1CY 7kz/kUN29oVvwFQAhtrdsqOTTt+2KHcw/wuMg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690565372; x=1691170172; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dT09jtLuy7a5zKnUmbIcfbqwcSckF6Rn16/QMnBw9d4=; b=HpanWRhyj5A0Je0LPLFmBJt4OI+NFAl7nIy6w9vT2YijL2hMr0jEiXH1HEO2IasQJD tLJ1N7L3C7izIpxnrxof7XoJQCPBbMwqxaK+czUEgi5Okn0j2X4c34a2RMTmMddjVTpE wU21jFfwySYvrhtxle4Rk3C2ejzY6ZCYgwpkVhSr2G4Jmnv090RVbtz0elWMi64XyOSr qv8v7hElqseUoHBcT9wv2oImlI/apmYsPotjTAkXuJ9gd0yL4PmpwLEZxocXpSWh1qMc yU5AWAWORVadq9n5TcwGiPz7+IH8wJ/DGVEt0tVMeEzkyrQY/W9yTdcLs2/KRarSrpH2 polA== X-Gm-Message-State: ABy/qLbUPic5yT8m0h6luLvXRPQqy479wTTLd5uzdlptUDHbu9afXsvl Vpnh73vAPWWO44cJCUuDZRs4TQ== X-Google-Smtp-Source: APBJJlE1OMp2GGXg6HYJsYLE/2Pq79PXrP4ciLYxaRJN/m5Tq3XeasWWvCny30uP2LXSkucWtGutdw== X-Received: by 2002:a6b:c9d3:0:b0:788:2d78:813c with SMTP id z202-20020a6bc9d3000000b007882d78813cmr248574iof.0.1690565372321; Fri, 28 Jul 2023 10:29:32 -0700 (PDT) Received: from shuah-tx13.internal ([38.15.45.1]) by smtp.gmail.com with ESMTPSA id b2-20020a029a02000000b0042b37dda71asm1181050jal.136.2023.07.28.10.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jul 2023 10:29:31 -0700 (PDT) From: Shuah Khan To: shuah@kernel.org, Liam.Howlett@oracle.com, anjali.k.kulkarni@oracle.com, kuba@kernel.org Cc: Shuah Khan , davem@davemloft.net, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH next 2/3] selftests:connector: Add .gitignore and poupulate it with test Date: Fri, 28 Jul 2023 11:29:27 -0600 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Add gitignore and poupulate it with test name - proc_filter Signed-off-by: Shuah Khan Reviewed-by: Anjali Kulkarni --- tools/testing/selftests/connector/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 tools/testing/selftests/connector/.gitignore diff --git a/tools/testing/selftests/connector/.gitignore b/tools/testing/selftests/connector/.gitignore new file mode 100644 index 000000000000..c90098199a44 --- /dev/null +++ b/tools/testing/selftests/connector/.gitignore @@ -0,0 +1 @@ +proc_filter From patchwork Fri Jul 28 17:29:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 13332185 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 86F52C41513 for ; Fri, 28 Jul 2023 17:29:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233399AbjG1R3h (ORCPT ); Fri, 28 Jul 2023 13:29:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230041AbjG1R3f (ORCPT ); Fri, 28 Jul 2023 13:29:35 -0400 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F68E35B6 for ; Fri, 28 Jul 2023 10:29:33 -0700 (PDT) Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-7748ca56133so23307039f.0 for ; Fri, 28 Jul 2023 10:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1690565373; x=1691170173; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KuA89WjH66+oRZgNKFoC7RQpjlgTsdzDJBprqnr0FHw=; b=IAy+tr7webKUVIYTbYZ3+jMG9e+SLvCy1lRwlIA6odcD7pfpmsLH4n/Zmptj2QKAN+ MjcbIvWBxeRLPNXObo+QhSNvUR5blz1BhmX5B3NYGTkyP7ONmVDuirYJxkDS8cx73hj3 Ox5zA+1aTG9Feo6KNRFjFnSS8qc0eIoTzcNL8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690565373; x=1691170173; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KuA89WjH66+oRZgNKFoC7RQpjlgTsdzDJBprqnr0FHw=; b=gL9i7hDlS/sxLOaYVLaLh3fIEJcR9u4jiCuaesMMd7o0Zzctwlt+3PJLYsFmBBWsl/ 7977wpyUKAlT8xnwY7L0ZgPWFeHqPb/ElcA18D8hHRBrhfUwCpNM6ojkyzELpQ6Ozjto 7YPChndXBy/KTPmJ/KvN7q09/ASvSjel0JqQTl8swAIXGk3X5NFyFgkyyWBLEkco2Hk7 JS3HhPrilCT9AX1XOXU2WRKPhxzC/+SAiVhZknpymc9HpIHAPQ6THBnvAyusyWcpn0Ab 9gOQllxz6DOHQfA9WO6u1D7Gs2Nyz8CcFqtkRZEmSBwTplHOPgChwZ8FySfOuZi17+qc xLTA== X-Gm-Message-State: ABy/qLYSHoHR6CYSwecMesdnGm/zXBnoKkgBbF2grJeNXz/Sq7Lesq1w 8K2AMV8G8HSRVKM7rYqQynfpJQ== X-Google-Smtp-Source: APBJJlFzdMGCDX1zblqKU916FlQ1jnF3KuGDuuZWNWcFedwwUFsC2XmS+hROGqQpBAcHWPUDGJ1cBQ== X-Received: by 2002:a05:6602:2b91:b0:77a:ee79:652 with SMTP id r17-20020a0566022b9100b0077aee790652mr339316iov.1.1690565372907; Fri, 28 Jul 2023 10:29:32 -0700 (PDT) Received: from shuah-tx13.internal ([38.15.45.1]) by smtp.gmail.com with ESMTPSA id b2-20020a029a02000000b0042b37dda71asm1181050jal.136.2023.07.28.10.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jul 2023 10:29:32 -0700 (PDT) From: Shuah Khan To: shuah@kernel.org, Liam.Howlett@oracle.com, anjali.k.kulkarni@oracle.com, kuba@kernel.org Cc: Shuah Khan , davem@davemloft.net, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH next 3/3] selftests:connector: Add root check and fix arg error paths to skip Date: Fri, 28 Jul 2023 11:29:28 -0600 Message-Id: <2c0ac97f9c8e6bd46b60854c136099c0dd4a09f6.1690564372.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org proc_filter test requires root privileges. Add root privilege check and skip the test. Also fix argument parsing paths to skip in their error legs. Signed-off-by: Shuah Khan --- tools/testing/selftests/connector/proc_filter.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/connector/proc_filter.c b/tools/testing/selftests/connector/proc_filter.c index 4fe8c6763fd8..7b2081b98e5c 100644 --- a/tools/testing/selftests/connector/proc_filter.c +++ b/tools/testing/selftests/connector/proc_filter.c @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) if (argc > 2) { printf("Expected 0(assume no-filter) or 1 argument(-f)\n"); - exit(1); + exit(KSFT_SKIP); } if (argc == 2) { @@ -256,10 +256,15 @@ int main(int argc, char *argv[]) filter = 1; } else { printf("Valid option : -f (for filter feature)\n"); - exit(1); + exit(KSFT_SKIP); } } + if (geteuid()) { + printf("Connector test requires root privileges.\n"); + exit(KSFT_SKIP); + } + if (filter) { input.event_type = PROC_EVENT_NONZERO_EXIT; input.mcast_op = PROC_CN_MCAST_LISTEN;