On Sun, Feb 14, 2021 at 12:30:07PM -0800, Linus Torvalds wrote: > On Sun, Feb 14, 2021 at 8:38 AM Jens Axboe <axboe@xxxxxxxxx> wrote: > > > > > Similarly it looks like opening of "/dev/tty" fails to > > > return the tty of the caller but instead fails because > > > io-wq threads don't have a tty. > > > > I've got a patch queued up for 5.12 that clears ->fs and ->files for the > > thread if not explicitly inherited, and I'm working on similarly > > proactively catching these cases that could potentially be problematic. > > Well, the /dev/tty case still needs fixing somehow. > > Opening /dev/tty actually depends on current->signal, and if it is > NULL it will fall back on the first VT console instead (I think). > > I wonder if it should do the same thing /proc/self does.. I still think that entire "offload pathname resolution to helper threads" thing is bollocks. ->fs, ->files and ->signal is still nowhere near enough - look at /proc/net, for example. Or netns-sensitive parts of sysfs, for that matter... And that's not going into really weird crap where opener is very special and assumed to be doing all IO.