diff options
| author | Oleg Nesterov <[email protected]> | 2019-01-03 15:28:11 -0800 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2019-01-04 13:13:47 -0800 |
| commit | 655c16a8ce9c15842547f40ce23fd148aeccc074 (patch) | |
| tree | 6008b24bf4add9cd20d479dd53eebbc56ce1fd74 /include/linux | |
| parent | 8099b047ecc431518b9bb6bdbba3549bbecdc343 (diff) | |
exec: separate MM_ANONPAGES and RLIMIT_STACK accounting
get_arg_page() checks bprm->rlim_stack.rlim_cur and re-calculates the
"extra" size for argv/envp pointers every time, this is a bit ugly and
even not strictly correct: acct_arg_size() must not account this size.
Remove all the rlimit code in get_arg_page(). Instead, add bprm->argmin
calculated once at the start of __do_execve_file() and change
copy_strings to check bprm->p >= bprm->argmin.
The patch adds the new helper, prepare_arg_pages() which initializes
bprm->argc/envc and bprm->argmin.
[[email protected]: fix !CONFIG_MMU version of get_arg_page()]
Link: http://lkml.kernel.org/r/[email protected]
[[email protected]: use max_t]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Oleg Nesterov <[email protected]>
Acked-by: Kees Cook <[email protected]>
Tested-by: Guenter Roeck <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Michal Hocko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/binfmts.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index e9f5fe69df31..03200a8c0178 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -25,6 +25,7 @@ struct linux_binprm { #endif struct mm_struct *mm; unsigned long p; /* current top of mem */ + unsigned long argmin; /* rlimit marker for copy_strings() */ unsigned int /* * True after the bprm_set_creds hook has been called once |