From: Christian Brauner <brauner@kernel.org>
To: Jiri Slaby <jirislaby@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Seth Forshee <sforshee@kernel.org>,
Tycho Andersen <tycho@tycho.pizza>
Subject: Re: [PATCH 2/2] pidfd: add pidfdfs
Date: Tue, 21 May 2024 14:33:19 +0200 [thread overview]
Message-ID: <20240521-ambitioniert-alias-35c21f740dba@brauner> (raw)
In-Reply-To: <0bbf8e1d-0590-4e42-91b2-7a35614319d3@kernel.org>
On Tue, May 21, 2024 at 08:13:08AM +0200, Jiri Slaby wrote:
> On 21. 05. 24, 8:07, Jiri Slaby wrote:
> > On 20. 05. 24, 21:15, Linus Torvalds wrote:
> > > On Mon, 20 May 2024 at 12:01, Linus Torvalds
> > > <torvalds@linux-foundation.org> wrote:
> > > >
> > > > So how about just a patch like this? It doesn't do anything
> > > > *internally* to the inodes, but it fixes up what we expose to user
> > > > level to make it look like lsof expects.
> > >
> > > Note that the historical dname for those pidfs files was
> > > "anon_inode:[pidfd]", and that patch still kept the inode number in
> > > there, so now it's "anon_inode:[pidfd-XYZ]", but I think lsof is still
> > > happy with that.
> >
> > Now the last column of lsof still differs from 6.8:
> > -[pidfd:1234]
> > +[pidfd-4321]
> >
> > And lsof tests still fail, as "lsof -F pfn" is checked against:
> > if ! fgrep -q "p${pid} f${fd} n[pidfd:$pid]" <<<"$line"; then
> >
> > Where $line is:
> > p1015 f3 n[pidfd-1315]
> >
> > Wait, even if I change that minus to a colon, the inner pid (1315)
> > differs from the outer (1015), but it should not (according to the
> > test).
>
> This fixes the test (meaning literally "it shuts up the test", but I have no
> idea if it is correct thing to do at all):
> - return dynamic_dname(buffer, buflen, "anon_inode:[pidfd-%llu]",
> pid->ino);
> + return dynamic_dname(buffer, buflen, "anon_inode:[pidfd:%d]",
> pid_nr(pid));
>
> Maybe pid_vnr() would be more appropriate, I have no idea either.
So as pointed out the legacy format for pidfds is:
lrwx------ 1 root root 64 21. Mai 14:24 39 -> 'anon_inode:[pidfd]'
So it's neither showing inode number nor pid.
The problem with showing the pid unconditionally like that in
dynamic_dname() is that it's wrong in various circumstances. For
example, when the pidfd is sent into a pid namespace outside the it's
pid namespace hierarchy (e.g., into a sibling pid namespace or when the
task has already been reaped.
Imho, showing the pid is more work than it's worth especially because we
expose that info in fdinfo/<nr> anyway. So let's just do the simple thing.
next prev parent reply other threads:[~2024-05-21 12:33 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 16:45 [PATCH 0/2] Move pidfd to tiny pseudo fs Christian Brauner
2024-02-13 16:45 ` [PATCH 1/2] pidfd: move struct pidfd_fops Christian Brauner
2024-02-13 16:45 ` [PATCH 2/2] pidfd: add pidfdfs Christian Brauner
2024-02-13 17:17 ` Linus Torvalds
2024-02-14 14:40 ` Christian Brauner
2024-02-14 18:27 ` Christian Brauner
2024-02-14 18:37 ` Linus Torvalds
2024-02-15 16:11 ` Christian Brauner
2024-02-16 11:50 ` Christian Brauner
2024-02-16 16:41 ` Christian Brauner
2024-02-17 13:59 ` Oleg Nesterov
2024-02-17 17:30 ` Linus Torvalds
2024-02-17 17:38 ` Linus Torvalds
2024-02-18 11:15 ` Christian Brauner
2024-02-18 11:33 ` Christian Brauner
2024-02-18 17:54 ` Christian Brauner
2024-02-18 18:08 ` Linus Torvalds
2024-02-18 18:57 ` Linus Torvalds
2024-02-19 18:05 ` Christian Brauner
2024-02-19 18:34 ` Linus Torvalds
2024-02-19 21:18 ` Christian Brauner
2024-02-19 23:24 ` Linus Torvalds
2024-02-18 14:27 ` Oleg Nesterov
2024-02-18 9:30 ` Christian Brauner
2024-02-22 19:03 ` Nathan Chancellor
2024-02-23 10:18 ` Heiko Carstens
2024-02-23 11:56 ` Christian Brauner
2024-02-23 11:55 ` Christian Brauner
2024-02-23 12:57 ` Heiko Carstens
2024-02-23 13:27 ` Christian Brauner
2024-02-23 13:35 ` Heiko Carstens
2024-02-23 13:41 ` Christian Brauner
2024-02-23 21:26 ` Christian Brauner
2024-02-23 21:58 ` Linus Torvalds
2024-02-24 5:52 ` Christian Brauner
2024-02-24 6:05 ` Christian Brauner
2024-02-24 18:48 ` Linus Torvalds
2024-02-24 19:15 ` Christian Brauner
2024-02-24 19:19 ` Christian Brauner
2024-02-24 19:21 ` Linus Torvalds
2024-02-27 19:26 ` Nathan Chancellor
2024-02-27 22:13 ` Christian Brauner
2024-03-12 10:35 ` Geert Uytterhoeven
2024-03-12 14:09 ` Christian Brauner
2024-05-15 11:10 ` Jiri Slaby
2024-05-15 16:39 ` Christian Brauner
2024-05-16 5:28 ` Jiri Slaby
2024-05-17 7:09 ` Jiri Slaby
2024-05-17 7:54 ` Jiri Slaby
2024-05-17 20:07 ` Linus Torvalds
2024-05-20 8:23 ` Jiri Slaby
2024-05-20 19:01 ` Linus Torvalds
2024-05-20 19:15 ` Linus Torvalds
2024-05-21 6:07 ` Jiri Slaby
2024-05-21 6:13 ` Jiri Slaby
2024-05-21 12:33 ` Christian Brauner [this message]
2024-05-21 12:40 ` Christian Brauner
2024-05-21 15:10 ` Linus Torvalds
2024-05-25 11:57 ` Christian Brauner
2024-05-21 12:16 ` Christian Brauner
2024-02-13 17:02 ` [PATCH 0/2] Move pidfd to tiny pseudo fs Christian Brauner
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=20240521-ambitioniert-alias-35c21f740dba@brauner \
--to=brauner@kernel.org \
--cc=jirislaby@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=sforshee@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tycho@tycho.pizza \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).