io_uring: signal worker thread unshare
authorJens Axboe <axboe@kernel.dk>
Thu, 25 Feb 2021 22:43:58 +0000 (15:43 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 1 Mar 2021 21:56:19 +0000 (14:56 -0700)
commitff392ee5fa0ac693000d003081f7bf3947466850
treedec47475f95d60b2732f9f11c9bac6110b7e478a
parent89f55cf4b7c79e1e3d59aef34c7c8a8b1e0efed9
io_uring: signal worker thread unshare

If the original task switches credentials or unshares any part of the
task state, then we should notify the io_uring workers to they can
re-fork as well. For credentials, this actually happens just fine for
the io-wq workers, as we grab and pass that down. For SQPOLL, we're
stuck with the original credentials, which means that it cannot be used
if the task does eg seteuid().

For unshare(2), the story is the same, except a task cannot do that and
expect the workers to assume the new identity.

Fix this up by just having the threads exit and re-fork if the ring task
does seteuid() (and friends), or does unshare(2) on any parts of the
task.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io-wq.c
fs/io-wq.h
fs/io_uring.c
include/linux/io_uring.h
kernel/cred.c
kernel/fork.c