From: Oleg Nesterov <oleg@redhat.com>
To: Luca Boccassi <luca.boccassi@gmail.com>
Cc: linux-kernel@vger.kernel.org, christian@brauner.io
Subject: Re: [PATCH v5] pidfd: add ioctl to retrieve pid info
Date: Sun, 6 Oct 2024 20:55:38 +0200 [thread overview]
Message-ID: <20241006185537.GC10213@redhat.com> (raw)
In-Reply-To: <CAMw=ZnS1GTC9RGQCeTqB8g2b78mFXi4zLfg6bumrp+zmgx0VXg@mail.gmail.com>
On 10/06, Luca Boccassi wrote:
>
> I see, so what should I do here then? Check both? Or none?
I don't know, because I don't know how are you going to use this API.
> The caller
> needs to verify that the data is still valid at the point they use it
> anyway,
So "none" should work fine? Just it should be documented that, say,
kinfo.pid can be 0 if we race with the exiting task.
Just in case, you can also use lock_task_sighand() || return -ESRCH,
this way kinfo.*pid can't be zero. But I don't think this will buy too
much, the task can exit right after pidfd_info() returns.
Oleg.
next prev parent reply other threads:[~2024-10-06 18:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-06 14:54 [PATCH v5] pidfd: add ioctl to retrieve pid info luca.boccassi
2024-10-06 17:21 ` Oleg Nesterov
2024-10-06 17:52 ` Luca Boccassi
2024-10-06 18:55 ` Oleg Nesterov [this message]
2024-10-06 21:33 ` Luca Boccassi
2024-10-07 12:11 ` Christian Brauner
2024-10-06 17:38 ` Oleg Nesterov
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=20241006185537.GC10213@redhat.com \
--to=oleg@redhat.com \
--cc=christian@brauner.io \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.boccassi@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox