From: Shuah Khan <skhan@linuxfoundation.org>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Christian Brauner <christian@brauner.io>,
Shuah Khan <shuah@kernel.org>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Suren Baghdasaryan <surenb@google.com>,
Vlastimil Babka <vbabka@suse.cz>,
pedro.falcato@gmail.com, linux-kselftest@vger.kernel.org,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-api@vger.kernel.org, linux-kernel@vger.kernel.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH 3/3] selftests: pidfd: add tests for PIDFD_SELF_*
Date: Wed, 16 Oct 2024 13:58:18 -0600 [thread overview]
Message-ID: <fd01038a-0057-4e29-bed7-03846885b089@linuxfoundation.org> (raw)
In-Reply-To: <71221c84-7721-42b7-add4-269a1f25c478@lucifer.local>
On 10/11/24 02:20, Lorenzo Stoakes wrote:
> On Thu, Oct 10, 2024 at 05:16:22PM -0600, Shuah Khan wrote:
>> On 10/10/24 12:15, Lorenzo Stoakes wrote:
>>> Add tests to assert that PIDFD_SELF_* correctly refers to the current
>>> thread and process.
>>>
>>> This is only practically meaningful to pidfd_send_signal() and
>>> pidfd_getfd(), but also explicitly test that we disallow this feature for
>>> setns() where it would make no sense.
>>>
>>> We cannot reasonably wait on ourself using waitid(P_PIDFD, ...) so while in
>>> theory PIDFD_SELF_* would work here, we'd be left blocked if we tried it.
>>>
>>> We defer testing of mm-specific functionality which uses pidfd, namely
>>> process_madvise() and process_mrelease() to mm testing (though note the
>>> latter can not be sensibly tested as it would require the testing process
>>> to be dying).
>>>
>>> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
>>> ---
>>> tools/testing/selftests/pidfd/pidfd.h | 8 ++
>>> .../selftests/pidfd/pidfd_getfd_test.c | 136 ++++++++++++++++++
>>> .../selftests/pidfd/pidfd_setns_test.c | 11 ++
>>> tools/testing/selftests/pidfd/pidfd_test.c | 67 +++++++--
>>> 4 files changed, 213 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h
>>> index 88d6830ee004..1640b711889b 100644
>>> --- a/tools/testing/selftests/pidfd/pidfd.h
>>> +++ b/tools/testing/selftests/pidfd/pidfd.h
>>> @@ -50,6 +50,14 @@
>>> #define PIDFD_NONBLOCK O_NONBLOCK
>>> #endif
>>> +/* System header file may not have this available. */
>>> +#ifndef PIDFD_SELF_THREAD
>>> +#define PIDFD_SELF_THREAD -100
>>> +#endif
>>> +#ifndef PIDFD_SELF_THREAD_GROUP
>>> +#define PIDFD_SELF_THREAD_GROUP -200
>>> +#endif
>>> +
>>
>> Can't we pick these up from linux/pidfd.h - patch 2/3 adds
>> them.
>
> We're running this file in userland and it's not obvious we can correctly
> import this header, it'd be some "../../" thing out of the testing root
> directory and might not interact well with all scenarios in which this file
> is built.
>
> Also the existing tests do not seem to try to import that header, so it
> seemed the safest way of doing this.
>
kselftest has dependency on "make headers" and tests include
headers from linux/ directory
These local make it difficult to maintain these tests in the
longer term. Somebody has to go clean these up later.
The import will be fine and you can control that with -I flag in
the makefile. Remove these and try to get including linux/pidfd.h
working.
I see your v2 and v3. Please revise this patch to include the
header file and remove these local defines.
thanks,
-- Shuah
prev parent reply other threads:[~2024-10-16 19:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-10 18:15 [PATCH 0/3] introduce PIDFD_SELF* sentinels Lorenzo Stoakes
2024-10-10 18:15 ` [PATCH 1/3] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup Lorenzo Stoakes
2024-10-10 18:15 ` [PATCH 2/3] pidfd: add PIDFD_SELF* sentinels to refer to own thread/process Lorenzo Stoakes
2024-10-10 18:15 ` [PATCH 3/3] selftests: pidfd: add tests for PIDFD_SELF_* Lorenzo Stoakes
2024-10-10 23:16 ` Shuah Khan
2024-10-11 8:20 ` Lorenzo Stoakes
2024-10-16 19:58 ` Shuah Khan [this message]
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=fd01038a-0057-4e29-bed7-03846885b089@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=Liam.Howlett@oracle.com \
--cc=christian@brauner.io \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=pedro.falcato@gmail.com \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®