lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 18 Jan 2021 12:33:49 +0100 From: Greg Kroah-Hartman <gregkh@...uxfoundation.org> To: linux-kernel@...r.kernel.org Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, stable@...r.kernel.org, Pavel Begunkov <asml.silence@...il.com>, Jens Axboe <axboe@...nel.dk>, Sasha Levin <sashal@...nel.org> Subject: [PATCH 5.10 054/152] io_uring: drop mm and files after task_work_run From: Pavel Begunkov <asml.silence@...il.com> [ Upstream commit d434ab6db524ab1efd0afad4ffa1ee65ca6ac097 ] __io_req_task_submit() run by task_work can set mm and files, but io_sq_thread() in some cases, and because __io_sq_thread_acquire_mm() and __io_sq_thread_acquire_files() do a simple current->mm/files check it may end up submitting IO with mm/files of another task. We also need to drop it after in the end to drop potentially grabbed references to them. Cc: stable@...r.kernel.org # 5.9+ Signed-off-by: Pavel Begunkov <asml.silence@...il.com> Signed-off-by: Jens Axboe <axboe@...nel.dk> Signed-off-by: Sasha Levin <sashal@...nel.org> --- fs/io_uring.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/io_uring.c b/fs/io_uring.c index 6c356b9e87b39..cab640c10bc0f 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6841,6 +6841,7 @@ static int io_sq_thread(void *data) if (ret & SQT_SPIN) { io_run_task_work(); + io_sq_thread_drop_mm(); cond_resched(); } else if (ret == SQT_IDLE) { if (kthread_should_park()) @@ -6855,6 +6856,7 @@ static int io_sq_thread(void *data) } io_run_task_work(); + io_sq_thread_drop_mm(); if (cur_css) io_sq_thread_unassociate_blkcg(); -- 2.27.0
Powered by blists - more mailing lists