Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp967327rdb; Fri, 19 Jan 2024 04:32:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFr7pp/2pofs6pxJ4+2E49d0MRULu8RSU33u0j1FONayyqwbRgnfezejv28RcH/Q3/7zSHs X-Received: by 2002:a17:903:22cd:b0:1d6:f89d:6177 with SMTP id y13-20020a17090322cd00b001d6f89d6177mr1227192plg.64.1705667567943; Fri, 19 Jan 2024 04:32:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705667567; cv=pass; d=google.com; s=arc-20160816; b=aHQhXrbT23Bp3dXLE8QTmFwuOLHLwa3m0r1plhZTwa7iAGn0EYYx7JrEc2xR5IpiXE ruRPYk75Bh5xIKIrYkyJF+/NnwBqM1mtE2OJb0w83ChUHez/Bkvm9u+Umb1Ozdyq1kB7 QQd2rr0q5zC256Rk5eOHpo8UmZfmrhkofRPEUuD1rmOuXGXLKAnui/Ckt8q3ESJKhkCL 78zZ9P7NxWl/3B+qBJEMuq4ZoAE9ty729RNbbLjvt61P+VRArjJsxfSLRIMNaSgViLgb H/3kpKNQeBX89v7NGWhutSgz37apsHy8gVyRiwE0z5qq4CcfjaqThRkCSecTqoXgjOZR dmhw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RALkxyecGZtNzX1Cl4PVBR5O+n2KlHAbxRKlzyERpN4=; fh=MS67Ykx0kSdGriRkFbFYj/Bv9dma3H97qD/XCRAK1Cw=; b=QC34j5NSf6vUcRMxPPE06JfjgxDzeltbYOI6Jrfy3EZ0yTdmyvOvfk+agfiEPamaf1 J5h6+rndZ31W0qp99a2jPWUABoNmp6cW9qKsnK2R5U0q7AW5QsPR8t2VnR1Wj52tgVCZ /COD6yFFDeIWsK4wJzcbjvEgIJxJQmhBzN1k0HLE+CHsDJQ4k+xZeuwjbEU7ZMmfPmIV 2/fJAGppNFrUaF+LVFVH7z6rg3Nmm6gZedUdKFJB+Ffzc/ZdkqhIHVwOlYlpzA0EKR5E xj+IxrjJvmL7PHjfrPvKVx70+PPAdNPCJ4oJhSRz00IgmzDY+o7artYHSJIW3xiBDGYw R+DQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b="gtndS8/Y"; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-31135-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31135-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r5-20020a1709028bc500b001d71d722818si1392380plo.513.2024.01.19.04.32.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 04:32:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31135-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b="gtndS8/Y"; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-31135-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31135-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 807FD2836DA for ; Fri, 19 Jan 2024 12:32:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B781524A2; Fri, 19 Jan 2024 12:32:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="gtndS8/Y" Received: from smtp-1908.mail.infomaniak.ch (smtp-1908.mail.infomaniak.ch [185.125.25.8]) (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 F1AE7524C2 for ; Fri, 19 Jan 2024 12:32:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705667535; cv=none; b=KV5nvUYH3kDAinhdex9O8b/jyK91tx3Qx4TxL5F/xKEphzThtCZr2/O05aIe5aZB4Ribq+7QOENflkh28JJS6yJLXuO8eqYJn/HZWYjKqoq6nZEt4F+YORPalOAaTkf+hX7uIKxQz83VPwq8po6oMcOyOHfexHQNDWCFU8XF6e4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705667535; c=relaxed/simple; bh=/rHoGZTfUaI2731SCJ/Ui1obvUcWjbrYkcngo32s3NI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GpmIHIQ0faYe0vCRuDNEkIEy7PJvDHeoH9GgoY24Kr65I8lubrXP8cH8RfwBAJB/WkTVATM1Htru74RWujlERhYI3pbM93t/7kk25Chk4aiS8guqEt1XzXGp5WF9EuTJJQw2B4QefN9I7jszoNrfWhp9B0Vgx4NI1qE8UP4Gupg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net; spf=pass smtp.mailfrom=digikod.net; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b=gtndS8/Y; arc=none smtp.client-ip=185.125.25.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=digikod.net Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4TGfBW0CY9zMqsrp; Fri, 19 Jan 2024 13:32:03 +0100 (CET) Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4TGfBT3VQ1z3Y; Fri, 19 Jan 2024 13:32:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1705667522; bh=/rHoGZTfUaI2731SCJ/Ui1obvUcWjbrYkcngo32s3NI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gtndS8/YTII1IUBg6cxIKRVTqllpPrXuv0rGGy+ahVXJ838yhn0MQoFWwMWAOp352 jEpY9qgt/HNKEga06/it/vVXGcuGVm3dtgRLYXAqRXKDuh/4uXdRZdHnagnHv2r/sH 82UnU9NsMyFZT3lQQByOlyR2onA46Nqw3JDEd0rw= Date: Fri, 19 Jan 2024 13:31:58 +0100 From: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= To: Hu Yadi Cc: jmorris@namei.org, serge@hallyn.com, shuah@kernel.org, mathieu.desnoyers@efficios.com, amir73il@gmail.com, brauner@kernel.org, avagin@google.com, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kselftest@vger.kernel.org, 514118380@qq.com, konstantin.meskhidze@huawei.com Subject: Re: [PATCH v4] selftests/landlock:Fix two build issues Message-ID: <20240119.Ugaehae2ze5b@digikod.net> References: <20240115102409.19799-1-hu.yadi@h3c.com> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240115102409.19799-1-hu.yadi@h3c.com> X-Infomaniak-Routing: alpha On Mon, Jan 15, 2024 at 06:24:09PM +0800, Hu Yadi wrote: > 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, > ^~~~~~~ > > Fixes: 04f9070e99a4 ("selftests/landlock: Add tests for pseudo filesystems") > Fixes: a549d055a22e ("selftests/landlock: Add network tests") Could you please create two patches as requested for v3, one per fix? This is useful because it enables to backport these fixes when appropriate. > > this patch is to fix them > > Signed-off-by: Hu.Yadi > Suggested-by: Jiao > Reviewed-by: Berlin > --- > Changes v4 -> v3: > fix gettid error from kernel test robot > https://lore.kernel.org/oe-kbuild-all/202401151147.T1s11iHJ-lkp@intel.com/ > 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 | 7 ++++++- > 2 files changed, 10 insertions(+), 2 deletions(-) > > 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", > + }, I requested some changes here. > .file_path = file1_s1d1, > }; > > diff --git a/tools/testing/selftests/landlock/net_test.c b/tools/testing/selftests/landlock/net_test.c > index 929e21c4db05..d50f2920ed82 100644 > --- a/tools/testing/selftests/landlock/net_test.c > +++ b/tools/testing/selftests/landlock/net_test.c > @@ -21,6 +21,11 @@ We should include sys/syscall.h > > #include "common.h" > > +static pid_t landlock_gettid(void) Please rename to sys_gettid(). > +{ > + return syscall(__NR_gettid); > +} > + > const short sock_port_start = (1 << 10); > > static const char loopback_ipv4[] = "127.0.0.1"; > @@ -88,7 +93,7 @@ static int set_service(struct service_fixture *const srv, > case AF_UNIX: > srv->unix_addr.sun_family = prot.domain; > sprintf(srv->unix_addr.sun_path, > - "_selftests-landlock-net-tid%d-index%d", gettid(), > + "_selftests-landlock-net-tid%d-index%d", landlock_gettid(), > index); > srv->unix_addr_len = SUN_LEN(&srv->unix_addr); > srv->unix_addr.sun_path[0] = '\0'; > -- > 2.23.0 >