All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Sherry Yang <sherry.yang@oracle.com>, Kees Cook <keescook@chromium.org>
Cc: "linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftests/seccomp: Fix seccomp failure by adding missing headers
Date: Thu, 10 Feb 2022 10:54:22 -0700	[thread overview]
Message-ID: <b908237b-63ad-ff10-8d89-540d2cab842e@linuxfoundation.org> (raw)
In-Reply-To: <C340461A-6FD2-440A-8EFC-D7E85BF48DB5@oracle.com>

On 2/3/22 1:46 PM, Sherry Yang wrote:
> 
>> On Feb 3, 2022, at 12:20 PM, Kees Cook <keescook@chromium.org> wrote:
>>
>> On Thu, Feb 03, 2022 at 07:40:46PM +0000, Sherry Yang wrote:
>>>> This didn't look right to me. That's outside the build tree, yes?
>>>
>>> It’s inside the build tree. “../../../../usr/include“ may look a little confusing, it’s actually linux/usr/include (linux/ is top directory of the repo we git clone), i.e. https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/usr/include?h=v5.17-rc2__;!!ACWV5N9M2RV99hQ!cP8-SXVNX-k1LuWYjfUYvCYlrOJsInLi9l7hNsqLoXiFULd7xqRS9HRF9WnTno3nBg$
>>> The file tools/testing/sefltests/Makefile can install kernel headers in default path “usr/include”. “../../../../usr/include“ is also used in other Makefile of selftests, like https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/clone3/Makefile?h=v5.17-rc2__;!!ACWV5N9M2RV99hQ!cP8-SXVNX-k1LuWYjfUYvCYlrOJsInLi9l7hNsqLoXiFULd7xqRS9HRF9WmhyH6mcQ$
>>
>> Ah-ha, thanks. Following the other example, should it just be -I instead
>> of -isystem?
> 
> In this case, “-I” works but gcc gives warnings, shown below
> 
> ———Warning Begin———
> gcc -Wl,-no-as-needed -Wall -I../../../../usr/include/  -lpthread  seccomp_bpf.c  -o /home/opc/linux/tools/testing/selftests/seccomp/seccomp_bpf
> In file included from seccomp_bpf.c:29:
> ../../../../usr/include/linux/ptrace.h:50: warning: "PTRACE_GETREGSET" redefined
>   #define PTRACE_GETREGSET 0x4204
>   
> In file included from seccomp_bpf.c:26:
> /usr/include/sys/ptrace.h:153: note: this is the location of the previous definition
>   #define PTRACE_GETREGSET PTRACE_GETREGSET

> ———Warning End———
> 
> So there is redefinition problem between glibc and kernel headers. I tried updating kernel headers, the ptrace.h installed in /usr/include/linux/ptrace.h is the same as we installed in the sandbox ../../../../usr/include/linux/ptrace.h, however, gcc doesn’t throw these warnings if we compile seccomp_bpf.c using /usr/include/linux/ptrace.h. This is because system headers will automatically suppress these warnings (refer to https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html). In my opinion, it’s fair to use “-isystem”, since they're actually generated kernel headers.
> 
> Sherry

Sounds like -i works - I will queue this up for Linux 5.17-rc5.

thanks,
-- Shuah


  reply	other threads:[~2022-02-10 17:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220202201118.13933-1-sherry.yang@oracle.com>
2022-02-02 21:17 ` [PATCH] selftests/seccomp: Fix seccomp failure by adding missing headers Shuah Khan
2022-02-03 18:46   ` Kees Cook
2022-02-03 19:40   ` Sherry Yang
2022-02-03 20:20     ` Kees Cook
2022-02-03 20:46       ` Sherry Yang
2022-02-10 17:54         ` Shuah Khan [this message]
2022-02-10 18:13           ` Sherry Yang
     [not found]           ` <6FCDF584-C765-4344-A851-E623B2FCB9A6@oracle.com>
2022-02-10 18:14             ` Shuah Khan
2022-02-10 20:38               ` Sherry Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b908237b-63ad-ff10-8d89-540d2cab842e@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=sherry.yang@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.