From: Oleg Nesterov <oleg@redhat.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Ben Woodard <woodard@redhat.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Kees Cook <keescook@chromium.org>, Michal Hocko <mhocko@suse.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] exec: separate MM_ANONPAGES and RLIMIT_STACK accounting
Date: Mon, 26 Nov 2018 13:23:07 +0100 [thread overview]
Message-ID: <20181126122307.GA1660@redhat.com> (raw)
In-Reply-To: <20181123171720.GA18841@roeck-us.net>
Hi Guenter,
On 11/23, Guenter Roeck wrote:
>
> On Mon, Nov 12, 2018 at 05:09:10PM +0100, Oleg Nesterov wrote:
> > 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.
> >
> > Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> > Acked-by: Kees Cook <keescook@chromium.org>
>
> This patch results in various qemu boot failures in -next. Bisect logs
> are attached. It looks like all nommu boots are failing.
^^^^^
Ah, thanks.
Yes, I forgot about the !CONFIG_MMU version of get_arg_page() which doesn't
check RLIMIT_STACK at all.
I'll send the trivial fix. Meanwile, could you test the patch below? to ensure
this is the only problem.
Oleg.
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -526,8 +526,10 @@ static int copy_strings(int argc, struct user_arg_ptr argv,
pos = bprm->p;
str += len;
bprm->p -= len;
+#ifdef CONFIG_MMU
if (bprm->p < bprm->argmin)
goto out;
+#endif
while (len > 0) {
int offset, bytes_to_copy;
next prev parent reply other threads:[~2018-11-26 12:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 16:09 [PATCH] exec: separate MM_ANONPAGES and RLIMIT_STACK accounting Oleg Nesterov
2018-11-13 23:12 ` Kees Cook
2018-11-23 17:17 ` Guenter Roeck
2018-11-26 12:23 ` Oleg Nesterov [this message]
2018-11-26 17:34 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181126122307.GA1660@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mhocko@suse.com \
--cc=woodard@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.