Skip to content

proc: make /proc/self point to thread

Oleg Nesterov linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1proc: make /proc/self point to threadfs/proc/self.c+7 -74 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] proc: make /proc/self point to thread
Quoted 4 lines · Linus Torvalds
Quoted 1 line · Linus Torvalds
Quoted 8 lines
Quoted 3 lines

Patch looks ok to me, but since this has never worked and nobody has actually complained, I can't really convince myself that this is critical.

Actually, let's back-track..

Did you try the other approach? Make /proc/self point to the thread instead of the task?

Yes, I thought about this. But I agree with Eric, we probably need another magic link, /proc/thread or whatever.

And. I think that s/task_pid/task_tgid/ in proc_fd_permission() makes sense anyway. It is not only for /proc/self, why we should restrict the access to /proc/<sub-thread>/fd ?

Quoted 4 lines

The thread-group leader seems to have these extra files:

- autogroup, coredump_filter, mountstats, net, task

Note really afaics. Yes, tgid_base_stuff and tid_base_stuff differ, but proc_root_lookup() uses tgid_base_stuff in any case, so /proc/<tid>/ also has task,mountstats,etc even if it is not leader.

Quoted 1 line

Yes, it would be semantically different,

And I am afraid this can break things. But I leave this to you and Eric.

Personally I think that /proc/self pointing to "current" is better, and in fact I was surprised when I recently found that this is not true. But perhaps it is too late to change this old behaviour.

Quoted 4 lines

but it would mean that
"/proc/self/fd/" would actually make sense in a way that it currently does *not* - which would seem fairly important, since the primary use for it tends to be /dev/stdin.

I think this doesn't matter "in practice", normally all threads have the same ->files. Who needs CLONE_THREAD without CLONE_FILES ?

Quoted 2 lines

And the other semantic differences might be much harder to notice. Worth testing?

Perhaps... Well, if Andrew takes this patch (assuming you and Eric ack it), we can see if we have any bug reports.

Oleg.