On 5/3/24 3:11 PM, Linus Torvalds wrote: > epoll is a mess, and does various invalid things in the name of > performance. > > Let's try to rein it in a bit. Something like this, perhaps? > > Not-yet-signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> > --- > > This is entirely untested, thus the "Not-yet-signed-off-by". But I > think this may be kind of the right path forward. > > I suspect the ->poll() call is the main case that matters, but there are > other places where eventpoll just looks up the file pointer without then > being very careful about it. The sock_from_file(epi->ffd.file) uses in > particular should probably also use this to look up the file. > > Comments? FWIW, I agree that epoll is the odd one out and there's no reason NOT to close this gap, regardless of how safe we currently think the existing usage is. I've done some basic testing with this - both to verify it fixes the actual issue at hand (it does, crashes trivially without it), and networking/pipe based epoll usage and no ill effects observed. Also passes all ltp test cases as well, but I was less concerned about that side. Reviewed-by: Jens Axboe <axboe@xxxxxxxxx> -- Jens Axboe