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 17:10:30 +0000 (10:10 -0700)
commitab55e430a18b7cb79c01a6697dddfafb1463721c
treed07a3a2865bdf70025fe590bb0faf28eef23a73b
parentcee03da2f816b5160b2542ab9b6dbfafbd89ea60
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