linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] exec: Move io_uring_task_cancel after the point of no return
@ 2020-11-30 22:58 Eric W. Biederman
  2020-12-02 15:21 ` Eric W. Biederman
  0 siblings, 1 reply; 2+ messages in thread
From: Eric W. Biederman @ 2020-11-30 22:58 UTC (permalink / raw)
  To: linux-kernel
  Cc: Linus Torvalds, Oleg Nesterov, Al Viro, Kees Cook, Jens Axboe


Now that unshare_files happens in begin_new_exec after the point of no
return, io_uring_task_cancel can also happen later.

Effectively this means io_uring activities for a task are only canceled
when exec succeeds.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---

This is against my exec-for-v5.11 branch

 fs/exec.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 14fae2ec1c9d..9e9368603168 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1257,6 +1257,11 @@ int begin_new_exec(struct linux_binprm * bprm)
 	if (retval)
 		goto out;
 
+	/*
+	 * Cancel any io_uring activity across execve
+	 */
+	io_uring_task_cancel();
+
 	/* Ensure the files table is not shared. */
 	retval = unshare_files();
 	if (retval)
@@ -1783,11 +1788,6 @@ static int bprm_execve(struct linux_binprm *bprm,
 	struct file *file;
 	int retval;
 
-	/*
-	 * Cancel any io_uring activity across execve
-	 */
-	io_uring_task_cancel();
-
 	retval = prepare_bprm_creds(bprm);
 	if (retval)
 		return retval;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] exec: Move io_uring_task_cancel after the point of no return
  2020-11-30 22:58 [PATCH] exec: Move io_uring_task_cancel after the point of no return Eric W. Biederman
@ 2020-12-02 15:21 ` Eric W. Biederman
  0 siblings, 0 replies; 2+ messages in thread
From: Eric W. Biederman @ 2020-12-02 15:21 UTC (permalink / raw)
  To: linux-kernel
  Cc: Linus Torvalds, Oleg Nesterov, Al Viro, Kees Cook, Jens Axboe

ebiederm@xmission.com (Eric W. Biederman) writes:

> Now that unshare_files happens in begin_new_exec after the point of no
> return, io_uring_task_cancel can also happen later.
>
> Effectively this means io_uring activities for a task are only canceled
> when exec succeeds.
>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
> ---
>
> This is against my exec-for-v5.11 branch

applied.

>  fs/exec.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/fs/exec.c b/fs/exec.c
> index 14fae2ec1c9d..9e9368603168 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -1257,6 +1257,11 @@ int begin_new_exec(struct linux_binprm * bprm)
>  	if (retval)
>  		goto out;
>  
> +	/*
> +	 * Cancel any io_uring activity across execve
> +	 */
> +	io_uring_task_cancel();
> +
>  	/* Ensure the files table is not shared. */
>  	retval = unshare_files();
>  	if (retval)
> @@ -1783,11 +1788,6 @@ static int bprm_execve(struct linux_binprm *bprm,
>  	struct file *file;
>  	int retval;
>  
> -	/*
> -	 * Cancel any io_uring activity across execve
> -	 */
> -	io_uring_task_cancel();
> -
>  	retval = prepare_bprm_creds(bprm);
>  	if (retval)
>  		return retval;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-02 15:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30 22:58 [PATCH] exec: Move io_uring_task_cancel after the point of no return Eric W. Biederman
2020-12-02 15:21 ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).