Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2185331rbb; Tue, 27 Feb 2024 13:30:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVdEngdMYQOTb1XqZHDtQY61tQA5SK2lfQtlUs3N6GcPBAQ3OOnRxDDAYjWr1Mu5f8AHHNSPPcvy9dcEaoV1BlEd55DaTT6y5y+SVHPJQ== X-Google-Smtp-Source: AGHT+IHxVDK+CQMDovTMoPX4ul2PmgEE/9jDPP2Vjy9sA+h9573aYdq7auALzNg11EaNao7om3hF X-Received: by 2002:a05:6808:4281:b0:3c1:83fb:ee34 with SMTP id dq1-20020a056808428100b003c183fbee34mr2808737oib.29.1709069453946; Tue, 27 Feb 2024 13:30:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709069453; cv=pass; d=google.com; s=arc-20160816; b=ohm296qnXtIOEIS+DaCmCGbJyZ0vWyJ4Q+dPWXQq2Gq6sIb4cku1nO52K2q5Paygzj 8x6pbiahhMqr56r/zrZgmdWVr6igtGiEAjly0nVy9uU1E4n7GZzoodGXEoHVyRC7w7lJ zu5S8uvvPYnChbzZ68tDFdyEb9nn5JfzDSQceLdkiMdOw/NGxIlWwqsDd3epPQ2f449b ZiaVlIW9KONP++xHAb5UckkswEHzfrjZ7zif/V8SVDp7vE0ZEDXj1n1fJmWp4ZeOzXRi Pto0fhgvMCwdS2DmlIMyrH/rL+3bu4zGgqpSfFzxhA5ulNZmJFPDXFAnrFOfp6HX8bFV fFJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=B6cYCiTKgel5L8zLDPQBA3bSl0Hw58QwImvNAKCqvVA=; fh=2LDmnzHVfU4B6o9J5BGiBXSDuypx0HjyGOJoVc8O1EU=; b=FWb9spuJXTrWZrhPY6qAJvkAXSADxSlAwpokjtLcWqGd+i+NmWdmcPT7OpurZyk/Xk QxEmKq35ffSHHyf5qCYdC3OlqU+f/lyvp3JTLXJ2T/KwTR9CtIdk6kYxJWSBAGlH5bo7 UAagp+SNFsQ523T3HrcWrRLNKPtp1adgEIb0OaHk0uLdZf+ecxaBVL0Rn9/865VB4LgN sWlOLaghzeFuprDP9PkvLVXKOw9v9bmrRo4x++FfUhwkKg4wASKhcfF/Ef/Uv8ScqRkC WwRuK0xIxqXYBakpXXh90uhUummXUsHATDnvbrmZDrgAa3VlNl7zioAi4dyw3o92jNWP mI2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=MViJut8W; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linuxfoundation.org dmarc=pass fromdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-84052-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84052-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d8-20020a05622a05c800b0042e7bb8db2dsi7818880qtb.49.2024.02.27.13.30.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:30:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84052-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=MViJut8W; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linuxfoundation.org dmarc=pass fromdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-84052-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84052-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.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 26FEC1C28ECD for ; Tue, 27 Feb 2024 21:30:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ADE621534EF; Tue, 27 Feb 2024 21:28:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="MViJut8W" Received: from mail-il1-f178.google.com (mail-il1-f178.google.com [209.85.166.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D51CB14F99A for ; Tue, 27 Feb 2024 21:28:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709069288; cv=none; b=O1wM2oxlZpIuQkC/Rdu4y8spzhTt8Rw40PBvFi4PN5bYFitku3rWMd9lW472AQ2ymOxuCGdHETK5csSt4lcEzWJcZfaYDtPW692mJcJRSwgGzyBM0nqvClveHVBiyNP5iXkStK0//b7hpu/PsQTBIHArnLNXH7SbYarY/VgbUqU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709069288; c=relaxed/simple; bh=ldVgS1aR0z42eyCtxT/QNicwlMS2zhb2zcTkrKdh6Qw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aSoeeby9C9zXgesfY3j8QPWrM4rumBWy3NjuvIbaRKJwJU5H1dyboSaEV5tN0jv/OZYehwvInBb+EmqBnv68zGoeXPCGq+brnmeC9yB0aVs6pyG6TD98IpZIWSZwPNDPhP9h6pwo/nThXRKvRmQ2kVXszjSWQSV45DVj6RC+0bU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MViJut8W; arc=none smtp.client-ip=209.85.166.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-il1-f178.google.com with SMTP id e9e14a558f8ab-365b5050622so331045ab.0 for ; Tue, 27 Feb 2024 13:28:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1709069285; x=1709674085; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=B6cYCiTKgel5L8zLDPQBA3bSl0Hw58QwImvNAKCqvVA=; b=MViJut8W/ornDe2lYZvhFAcoW4XTLadRYSGrAzk1xMFpQJqWdiZi05CrOjSZGRKd7/ Itl0S4wwERn3857Miz9Q8TVq0jCa21hao69+bRPOkBYe/eXOGISt/c2MwqIA0ZBkohrX bJtnaVQa69nYcmQHAvtc5Azgw3014HN+7mfCU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709069285; x=1709674085; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=B6cYCiTKgel5L8zLDPQBA3bSl0Hw58QwImvNAKCqvVA=; b=JUcxwnQFXfXG5Kpgbp1ordZL/r1+8ZV73dIsLP4uuOGvsI7tfReIiH8XmuytAh9JC7 FpyBSdfd+ub4+bzZqZW9XVAiQWTxVqxs7AOY+UO7OKwU9FVVAzO6e7Nr/nr0CFfHZLYO 5bZkM4c+1Sl5yd7VZVI/M2MuB4RaWcKejkyYpp4a9jU5rYR/RmZdYmD7hTQ+S2GDrcsu ZQwSf5GeVaFtb/ztAv3DUINFFWKy6n/MuqCH9y+V0iG0xgQxoD4RtamsmDwUcBFhWmPK uAZMuUCeX6KvYgsIx9MDHwBLvTHG8C/MDlqlSlXGDmwuGkJAEElsPDUWqQdWGH/JP080 xCDg== X-Forwarded-Encrypted: i=1; AJvYcCVomhHAfU3t2W0MuyKnQN4EJZKmtCaBYGLUagCa4FsLrTvPxgEzh0N0vfXD0V4UJDUz30+TlAKJT1GCbMz+u8rl+/2IBzQA0tHl5KHu X-Gm-Message-State: AOJu0YyKXZW9RGl/22Brn98jE9awW+gUQVSXJHdBIk630fx9Je8zmlG6 fRaBo8eR2o3ub9/b9IlsX9WmbdewU95mzdVlrwmIq3jpwNwLrUsL4tswM1Ml3SU= X-Received: by 2002:a6b:7a4a:0:b0:7c7:9c4b:90e6 with SMTP id k10-20020a6b7a4a000000b007c79c4b90e6mr10237659iop.1.1709069285100; Tue, 27 Feb 2024 13:28:05 -0800 (PST) Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id x20-20020a056638249400b004747c4f663dsm1661363jat.0.2024.02.27.13.28.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Feb 2024 13:28:03 -0800 (PST) Message-ID: Date: Tue, 27 Feb 2024 14:28:02 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RESEND PATCH] selftests/overlayfs: fix compilation error in overlayfs Content-Language: en-US To: Andrei Vagin Cc: Meng Li , Huang Rui , linux-pm@vger.kernel.org, Nathan Fontenot , Deepak Sharma , Alex Deucher , Mario Limonciello , Perry Yuan , Xiaojian Du , Viresh Kumar , Borislav Petkov , linux-kernel@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , Shuah Khan References: <20240227074204.3573450-1-li.meng@amd.com> <2aaa2a61-f753-4434-8c92-886fc4bb9aef@linuxfoundation.org> From: Shuah Khan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/27/24 14:20, Andrei Vagin wrote: > On Tue, Feb 27, 2024 at 8:41 AM Shuah Khan wrote: >> >> On 2/27/24 00:42, Meng Li wrote: >>> make -C tools/testing/selftests, compiling dev_in_maps fail. >>> In file included from dev_in_maps.c:10: >>> /usr/include/x86_64-linux-gnu/sys/mount.h:35:3: error: expected identifier before numeric constant >>> 35 | MS_RDONLY = 1, /* Mount read-only. */ >>> | ^~~~~~~~~ >>> >>> That sys/mount.h has to be included before linux/mount.h. >>> >>> Signed-off-by: Meng Li >>> --- >>> tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >> >> I don't see this problem when I build it on my system when >> I run: >> >> make -C tools/testing/selftests >> or >> make -C tools/testing/selftests/filesystems/overlayfs >> >> Are you running this after doing headers_install? > > It depends on libc headers. It can work with one libc and doesn't work > with another one. I have seen many times when linux headers conflicted > with libc headers. The only reliable way to avoid this sort of issues is > to include just one linux or libc header. > > In this case, we can do something like this: > > diff --git a/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c > b/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c > index e19ab0e85709..f1ba82e52192 100644 > --- a/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c > +++ b/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c > @@ -10,7 +10,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -40,6 +39,14 @@ static int sys_move_mount(int from_dfd, const char > *from_pathname, > return syscall(__NR_move_mount, from_dfd, from_pathname, > to_dfd, to_pathname, flags); > } > > +static int sys_mount(const char *source, const char *target, > + const char *filesystemtype, unsigned long mountflags, > + const void *data) > +{ > + return syscall(__NR_mount, source, target, filesystemtype, > mountflags, data); > +} > + > + > static long get_file_dev_and_inode(void *addr, struct statx *stx) > { > char buf[4096]; > @@ -167,7 +174,7 @@ int main(int argc, char **argv) > return 1; > } > > - if (mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL) == -1) { > + if (sys_mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL) == -1) { > pr_perror("mount"); > return 1; > } > This is definitely better solution to this problem than reordering the includes only find another problem down the road. thanks, -- Shuah