Skip to content

Commit 779f4e1

Browse files
keestorvalds
authored andcommitted
Revert "exec: avoid RLIMIT_STACK races with prlimit()"
This reverts commit 04e35f4. SELinux runs with secureexec for all non-"noatsecure" domain transitions, which means lots of processes end up hitting the stack hard-limit change that was introduced in order to fix a race with prlimit(). That race fix will need to be redesigned. Reported-by: Laura Abbott <labbott@redhat.com> Reported-by: Tomáš Trnka <trnka@scm.com> Cc: stable@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent f8940a0 commit 779f4e1

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

fs/exec.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,15 +1339,10 @@ void setup_new_exec(struct linux_binprm * bprm)
13391339
* avoid bad behavior from the prior rlimits. This has to
13401340
* happen before arch_pick_mmap_layout(), which examines
13411341
* RLIMIT_STACK, but after the point of no return to avoid
1342-
* races from other threads changing the limits. This also
1343-
* must be protected from races with prlimit() calls.
1342+
* needing to clean up the change on failure.
13441343
*/
1345-
task_lock(current->group_leader);
13461344
if (current->signal->rlim[RLIMIT_STACK].rlim_cur > _STK_LIM)
13471345
current->signal->rlim[RLIMIT_STACK].rlim_cur = _STK_LIM;
1348-
if (current->signal->rlim[RLIMIT_STACK].rlim_max > _STK_LIM)
1349-
current->signal->rlim[RLIMIT_STACK].rlim_max = _STK_LIM;
1350-
task_unlock(current->group_leader);
13511346
}
13521347

13531348
arch_pick_mmap_layout(current->mm);

0 commit comments

Comments
 (0)