Skip to content

Commit fe8993b

Browse files
committed
exec: Consolidate pdeath_signal clearing
Instead of an additional secureexec check for pdeath_signal, just move it up into the initial secureexec test. Neither perf nor arch code touches pdeath_signal, so the relocation shouldn't change anything. Signed-off-by: Kees Cook <[email protected]> Acked-by: Serge Hallyn <[email protected]>
1 parent 64701de commit fe8993b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

fs/exec.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,9 @@ void setup_new_exec(struct linux_binprm * bprm)
13511351
bprm->secureexec |= bprm->cap_elevated;
13521352

13531353
if (bprm->secureexec) {
1354+
/* Make sure parent cannot signal privileged process. */
1355+
current->pdeath_signal = 0;
1356+
13541357
/*
13551358
* For secureexec, reset the stack limit to sane default to
13561359
* avoid bad behavior from the prior rlimits. This has to
@@ -1383,10 +1386,6 @@ void setup_new_exec(struct linux_binprm * bprm)
13831386
*/
13841387
current->mm->task_size = TASK_SIZE;
13851388

1386-
if (bprm->secureexec) {
1387-
current->pdeath_signal = 0;
1388-
}
1389-
13901389
/* An exec changes our domain. We are no longer part of the thread
13911390
group */
13921391
current->self_exec_id++;

0 commit comments

Comments
 (0)