Skip to content

Commit 1507b7a

Browse files
committed
exec: Rename the flag called_exec_mmap point_of_no_return
Update the comments and make the code easier to understand by renaming this flag. Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Greg Ungerer <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]>
1 parent 89826cc commit 1507b7a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

fs/exec.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,12 +1326,12 @@ int flush_old_exec(struct linux_binprm * bprm)
13261326
goto out;
13271327

13281328
/*
1329-
* After setting bprm->called_exec_mmap (to mark that current is
1330-
* using the prepared mm now), we have nothing left of the original
1331-
* process. If anything from here on returns an error, the check
1332-
* in search_binary_handler() will SEGV current.
1329+
* With the new mm installed it is completely impossible to
1330+
* fail and return to the original process. If anything from
1331+
* here on returns an error, the check in
1332+
* search_binary_handler() will SEGV current.
13331333
*/
1334-
bprm->called_exec_mmap = 1;
1334+
bprm->point_of_no_return = true;
13351335
bprm->mm = NULL;
13361336

13371337
#ifdef CONFIG_POSIX_TIMERS
@@ -1720,7 +1720,7 @@ int search_binary_handler(struct linux_binprm *bprm)
17201720

17211721
read_lock(&binfmt_lock);
17221722
put_binfmt(fmt);
1723-
if (retval < 0 && bprm->called_exec_mmap) {
1723+
if (retval < 0 && bprm->point_of_no_return) {
17241724
/* we got to flush_old_exec() and failed after it */
17251725
read_unlock(&binfmt_lock);
17261726
force_sigsegv(SIGSEGV);

include/linux/binfmts.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ struct linux_binprm {
4646
*/
4747
secureexec:1,
4848
/*
49-
* Set by flush_old_exec, when exec_mmap has been called.
50-
* This is past the point of no return.
49+
* Set when errors can no longer be returned to the
50+
* original userspace.
5151
*/
52-
called_exec_mmap:1;
52+
point_of_no_return:1;
5353
#ifdef __alpha__
5454
unsigned int taso:1;
5555
#endif

0 commit comments

Comments
 (0)