Skip to contentSkip to conversation

exec: Move io_uring_task_cancel after the point of no return

PATCH Applied Eric W. Biederman 1 participant 2 messages Nov 30, 2020 – Dec 2, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exec: Move io_uring_task_cancel after the point of no return

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.

---

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

 fs/exec.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
fs/exec.c +5 -5
index 14fae2ec1c9d..9e9368603168 100644
@@ -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;
Signature · 1 line
2.20.1
author Applied
#1 lore raw
Quoted 10 lines · [email protected] (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.

---

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

applied.

Quoted 31 lines
 fs/exec.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
fs/exec.c +5 -5
index 14fae2ec1c9d..9e9368603168 100644
@@ -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;