LWN: Comments on "Adding the pidfd abstraction to the kernel" https://lwn.net/Articles/801319/ This is a special feed containing comments posted to the individual LWN article titled "Adding the pidfd abstraction to the kernel". en-us Sat, 25 Oct 2025 06:43:46 +0000 Sat, 25 Oct 2025 06:43:46 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Adding the pidfd abstraction to the kernel https://lwn.net/Articles/805795/ https://lwn.net/Articles/805795/ zse <div class="FormattedComment"> There might be a use case for pidfds referring to an individual thread: Currently, audio applications that want a thread to run with real-time priorities have to send a request (containing the kernel thread id of the target thread) to the RealtimeKit daemon. That looks like the same race condition to me.<br> </div> Fri, 29 Nov 2019 12:02:09 +0000 Adding the pidfd abstraction to the kernel https://lwn.net/Articles/802183/ https://lwn.net/Articles/802183/ nix <div class="FormattedComment"> This is not just useful for multiple ptracers: it is also useful if you have a thread that wants to ptrace a victim on behalf of other threads in the tracing process. For that, you need a pollable fd that at least trips something pollable (POLLIN, say) when the victim wants attention, so that you can also poll on message pipes etc from the rest of the process. I implemented this for DTrace by reviving the old RH waitfd(), but it was really crocky compared to pidfds and I'd much rather use those.<br> <p> But we can't use those as long as waitid is used -- as I discovered to my cost in the waitfd implementation waitid destroys a bunch of info that waitpid returns (IIRC, the high bits of the return code, but my memory of this was faded) and which is crucial for ptrace. There's a reason all the ptrace examples use waitpid rather than waitid... a shame, because the waitid API is ever so much nicer than waitpid. (Alternatively, waitid could be fixed so it was usable to accept ptrace results -- but that seems likely to be quite difficult!)<br> </div> Sun, 13 Oct 2019 16:16:01 +0000 Adding the pidfd abstraction to the kernel https://lwn.net/Articles/801878/ https://lwn.net/Articles/801878/ mjw <div class="FormattedComment"> <font class="QuotedText">&gt; I'd like to be able to use strace and gdb on a process at the same time.</font><br> <p> There is a patch for that: <a href="https://lists.strace.io/pipermail/strace-devel/2019-September/009154.html">https://lists.strace.io/pipermail/strace-devel/2019-Septe...</a><br> </div> Wed, 09 Oct 2019 18:14:38 +0000 Adding the pidfd abstraction to the kernel https://lwn.net/Articles/801847/ https://lwn.net/Articles/801847/ scientes <div class="FormattedComment"> I'd like to be able to use strace and gdb on a process at the same time.<br> </div> Wed, 09 Oct 2019 15:42:18 +0000 Adding the pidfd abstraction to the kernel https://lwn.net/Articles/801765/ https://lwn.net/Articles/801765/ roc <div class="FormattedComment"> (without detaching)<br> </div> Wed, 09 Oct 2019 00:20:53 +0000 Adding the pidfd abstraction to the kernel https://lwn.net/Articles/801764/ https://lwn.net/Articles/801764/ roc <div class="FormattedComment"> For my purposes it would be adequate to allow just one ptracer at a time. The problem is that right now there is no way to hand off ptrace ownership from one process to another.<br> </div> Wed, 09 Oct 2019 00:20:21 +0000 Adding the pidfd abstraction to the kernel https://lwn.net/Articles/801755/ https://lwn.net/Articles/801755/ NYKevin <div class="FormattedComment"> ptrace() is a debugger interface, not a general-purpose API. If the end user really wants to attach two debuggers to the same process and send them off to the races, well, why not just let them do it? They're a programmer, they should know better.<br> </div> Tue, 08 Oct 2019 22:22:04 +0000 Adding the pidfd abstraction to the kernel https://lwn.net/Articles/801717/ https://lwn.net/Articles/801717/ acarno <div class="FormattedComment"> <font class="QuotedText">&gt; eliminates the current restriction that a task can have just one unique ptracer process</font><br> <p> Given that ptrace() allows the tracing process to manipulate the traced process, would this generate race conditions? I feel like you'd need to define a "read-only" context to allow multiple ptracer processes.<br> </div> Tue, 08 Oct 2019 17:22:40 +0000 Adding the pidfd abstraction to the kernel https://lwn.net/Articles/801641/ https://lwn.net/Articles/801641/ hupstream <div class="FormattedComment"> Here is the link for this talk (Kernel Recipes 2019): <a href="https://youtu.be/19SlR_zjPxc">https://youtu.be/19SlR_zjPxc</a><br> </div> Tue, 08 Oct 2019 12:03:25 +0000 Adding the pidfd abstraction to the kernel https://lwn.net/Articles/801592/ https://lwn.net/Articles/801592/ roc <div class="FormattedComment"> <font class="QuotedText">&gt; There do not appear to be any use cases for pidfds that refer to an individual thread for now;</font><br> <p> ptrace() would need this.<br> <p> It would be great if ptrace() supported pidfds in a way that eliminates the current restriction that a task can have just one unique ptracer process *and* that ptracer cannot be changed without detaching and reattaching, i.e., so it became possible to hand off ptrace control to another ptracer process.<br> </div> Tue, 08 Oct 2019 02:33:26 +0000