Re: [RFC 1/2] fs,eventpoll: Add ability to install target file by its number

From
Andy Lutomirski <hidden>
Date
2017-02-17 16:53:21
Also in
linux-fsdevel, lkml
Reply to
Cyrill Gorcunov, 2017-02-17
On Fri, Feb 17, 2017 at 12:30 AM, Cyrill Gorcunov [off-list ref] wrote:
When we checkpoint a process we look into /proc/<pid>/fdinfo/<fd> of eventpoll
file and parse target files list from there. In most situations this is fine
because target file is present in the /proc/<pid>/fd/ list. But in case if file
descriptor was dup'ed or transferred via unix socket and closed after,
it might not be in the list and we can't figure out which file descriptor
to pass into epoll_ctl call.

To resolve this tie lets add EPOLL_CTL_DUP operation which simply takes
target file descriptor number and installs it into a caller's file table,
thus we can use kcmp() syscall and figure out which exactly file to be
added into eventpoll on restore procedure.
This is a scary thing to let an unprivileged process do.

I'm wondering if there might be a nicer way to address this using a
better interface in /proc.
Thread (7 messages) 7 messages, 4 authors, last reply 2017-02-17
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help