Re: RFC: Using openat()

Jim Warner <[email protected]> Fri, 20 Jan 2023 12:04:22 -0600
Newsgroups gmane.linux.procps.devel
Message-ID <[email protected]>
On 1/20/23 5:01 AM, Craig Small (csmall) wrote:
> I have a proposed patch where the library uses openat() for all open 
> files below
> /proc/<PID>.  I think this is a reasonable idea as it means if a PID is 
> reused you're not using half the old process and half the new process 
> information.
> . . .
> Let me know what you think.

Hi Craig.

Personally, I would advise against such a change at this particular 
time.  After all, the migration to libproc2 is already huge.  Why not 
let that dust settle first.

Besides, the risk of a PID race seems extremely low and in its present 
form this patch breaks the top and w programs.  Part of the problem 
appears to involve a potential closing of STDIN_FILENO.

Once over that hurdle, be sure to run top with the -H switch using 
valgrind to see if there are any invalid file descriptors.

Regards,

Jim

p.s. I've tried to isolate the root cause but far no joy ...