File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1350,6 +1350,18 @@ void setup_new_exec(struct linux_binprm * bprm)
1350
1350
*/
1351
1351
bprm -> secureexec |= bprm -> cap_elevated ;
1352
1352
1353
+ if (bprm -> secureexec ) {
1354
+ /*
1355
+ * For secureexec, reset the stack limit to sane default to
1356
+ * avoid bad behavior from the prior rlimits. This has to
1357
+ * happen before arch_pick_mmap_layout(), which examines
1358
+ * RLIMIT_STACK, but after the point of no return to avoid
1359
+ * needing to clean up the change on failure.
1360
+ */
1361
+ if (current -> signal -> rlim [RLIMIT_STACK ].rlim_cur > _STK_LIM )
1362
+ current -> signal -> rlim [RLIMIT_STACK ].rlim_cur = _STK_LIM ;
1363
+ }
1364
+
1353
1365
arch_pick_mmap_layout (current -> mm );
1354
1366
1355
1367
current -> sas_ss_sp = current -> sas_ss_size = 0 ;
You can’t perform that action at this time.
0 commit comments