]> www.infradead.org Git - users/willy/linux.git/commit
exec: separate MM_ANONPAGES and RLIMIT_STACK accounting
authorOleg Nesterov <oleg@redhat.com>
Wed, 5 Dec 2018 00:14:12 +0000 (11:14 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 6 Dec 2018 22:09:08 +0000 (09:09 +1100)
commit50caa087c321c9cf0836e2fc99f4bc5dd2ec59a3
treedf156f8a032afb91d66e08b4bedf668a5b574bf0
parent8d45102ee2b76be552667697314753394e670ad2
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.

Link: http://lkml.kernel.org/r/20181112160910.GA28440@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
fs/exec.c
include/linux/binfmts.h