Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2129147rdd; Thu, 11 Jan 2024 23:16:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHd4RIatfD3+H89F+cdhGJtfT2T1bjM30AqBhK0unUOVvzwsvFdk/TbK19+1lvwfkhUKD0D X-Received: by 2002:a05:622a:315:b0:429:735c:f66 with SMTP id q21-20020a05622a031500b00429735c0f66mr978352qtw.108.1705043788919; Thu, 11 Jan 2024 23:16:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705043788; cv=none; d=google.com; s=arc-20160816; b=XVljt3wyNXQ9gUiMoqv8BtjG95kjPUYSQpqIbaUEC7SYJDV3DBPsfNs9GZNr3/fr6w 3oTdxNsCu7kzWT5AZ7L0dvPsV38UE4aqhTzSX9ZTlrcBniki5sPCl7fuxoMbZZEOjytu Jc8ThiaamBV3Jg9VCkSWyiSYVGgoRmAiNVQSVVbcDEHDpr+dL8TENBYYEJBzELhFnnJi 9fJ41domVd166BY4Lj6rX6LKVJfomgSyqdPfW5UWgTQJ9Yx3KikLV3srK95ucHKdbcbP wmj+f5OcaE5R57nQJICYs7TChhs4NNRZ8tb+2A9hNqofWGSSe6eK/BFQ7pr4GVp3aBZj c9+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=NPyaJnqu5yQY7MzOAL9ysl0B1STPYYJNm5si4kLV4v4=; fh=+ZJgeVirBVvidjxmfL4pAjjWho6G1gVhHLd/Yb/Zi8I=; b=IB8em9NL+ZpKw0Ide0wLDtggoNK7opx1eOO7kIJyjcIwgnqsT2JmUWCQqDjvs+qGB1 e5QGSp1+rrJ+wnK+y6tSmzwJLPnIiZwqODxOtl2FB9vqpCRKrH8TXnovoOl8hc+s2OU8 iImaDP50BqeCYwsyk7hudARX/B3pY7ApxyXXsh33Nx88H1JKrl7T0tUPlkWsXR7vSJwk LuHaQHeiHvXf4i11P6H4hS85K+QaDkbQHCZSq4/hkAq/8uI7iURZATFCoFDfds8NgMSP Dv6LKHlnXVMNBQx0lHiZ8DvLbMYjFykmB+43hf4jNKQSSwvyQeX8XkmvKZSYZmloVzfX vAbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-24362-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24362-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id cr18-20020a05622a429200b004279140bd88si2478012qtb.746.2024.01.11.23.16.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 23:16:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24362-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-24362-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24362-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 56FE11C24C5C for ; Fri, 12 Jan 2024 07:16:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 939075C8E6; Fri, 12 Jan 2024 07:16:19 +0000 (UTC) Received: from h3cspam02-ex.h3c.com (smtp.h3c.com [60.191.123.50]) (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 125B55C902; Fri, 12 Jan 2024 07:16:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=h3c.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=h3c.com Received: from mail.maildlp.com ([172.25.15.154]) by h3cspam02-ex.h3c.com with ESMTP id 40C7F1rd043835; Fri, 12 Jan 2024 15:15:02 +0800 (GMT-8) (envelope-from hu.yadi@h3c.com) Received: from DAG6EX02-IMDC.srv.huawei-3com.com (unknown [10.62.14.11]) by mail.maildlp.com (Postfix) with ESMTP id 886D122E1859; Fri, 12 Jan 2024 15:19:24 +0800 (CST) Received: from localhost.localdomain (10.99.206.12) by DAG6EX02-IMDC.srv.huawei-3com.com (10.62.14.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.27; Fri, 12 Jan 2024 15:15:02 +0800 From: Hu Yadi To: , , , , CC: , , , , <514118380@qq.com>, "Hu.Yadi" Subject: [PATCH v3] selftests/landlock:Fix two build issues Date: Fri, 12 Jan 2024 15:12:45 +0800 Message-ID: <20240112071245.669-1-hu.yadi@h3c.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BJSMTP01-EX.srv.huawei-3com.com (10.63.20.132) To DAG6EX02-IMDC.srv.huawei-3com.com (10.62.14.11) X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL:h3cspam02-ex.h3c.com 40C7F1rd043835 From: "Hu.Yadi" Two issues comes up while building selftest/landlock on my side (gcc 7.3/glibc-2.28/kernel-4.19) the first one is as to gettid net_test.c: In function ‘set_service’: net_test.c:91:45: warning: implicit declaration of function ‘gettid’; [-Wimplicit-function-declaration] "_selftests-landlock-net-tid%d-index%d", gettid(), ^~~~~~ getgid net_test.c:(.text+0x4e0): undefined reference to `gettid' the second is compiler error gcc -Wall -O2 -isystem fs_test.c -lcap -o selftests/landlock/fs_test fs_test.c:4575:9: error: initializer element is not constant .mnt = mnt_tmp, ^~~~~~~ this patch is to fix them Signed-off-by: Hu.Yadi Suggested-by: Jiao Reviewed-by: Berlin --- Changes v3 -> v2: - add helper of gettid instead of __NR_gettid - add gcc/glibc version info in comments Changes v1 -> v2: - fix whitespace error - replace SYS_gettid with _NR_gettid tools/testing/selftests/landlock/fs_test.c | 5 ++++- tools/testing/selftests/landlock/net_test.c | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c index 18e1f86a6234..a992cf7c0ad1 100644 --- a/tools/testing/selftests/landlock/fs_test.c +++ b/tools/testing/selftests/landlock/fs_test.c @@ -4572,7 +4572,10 @@ FIXTURE_VARIANT(layout3_fs) /* clang-format off */ FIXTURE_VARIANT_ADD(layout3_fs, tmpfs) { /* clang-format on */ - .mnt = mnt_tmp, + .mnt = { + .type = "tmpfs", + .data = "size=4m,mode=700", + }, .file_path = file1_s1d1, }; diff --git a/tools/testing/selftests/landlock/net_test.c b/tools/testing/selftests/landlock/net_test.c index 929e21c4db05..12a6744568e2 100644 --- a/tools/testing/selftests/landlock/net_test.c +++ b/tools/testing/selftests/landlock/net_test.c @@ -21,6 +21,15 @@ #include "common.h" +#ifndef gettid +static pid_t gettid(void) +{ + return syscall(__NR_gettid); +} + +#endif + + const short sock_port_start = (1 << 10); static const char loopback_ipv4[] = "127.0.0.1"; -- 2.23.0