[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241006185537.GC10213@redhat.com>
Date: Sun, 6 Oct 2024 20:55:38 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Luca Boccassi <luca.boccassi@...il.com>
Cc: linux-kernel@...r.kernel.org, christian@...uner.io
Subject: Re: [PATCH v5] pidfd: add ioctl to retrieve pid info
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.
Powered by blists - more mailing lists