From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>
Subject: Re: Question regarding MAX_ARG_STRLEN with execve()
Date: Mon, 3 Jul 2017 13:58:59 +0530 [thread overview]
Message-ID: <b2ce8ca1-bf62-6307-7999-9efd687d12bb@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170630142218.GB22923@dhcp22.suse.cz>
On 06/30/2017 07:52 PM, Michal Hocko wrote:
> On Fri 30-06-17 11:59:37, Anshuman Khandual wrote:
>> Hello,
>>
>> execve() system call should support argument length of
>> MAX_ARG_STRLEN (PAGE_SIZE * 32). On 64K page size systems, we
>> are not able to pass 32 * PAGE_SIZE arguments into the execve()
>> system call because of the following reasons.
>>
>> * struct linux_binprm's vma starts with a size of PAGE_SIZE
>>
>> vma->vm_end = STACK_TOP_MAX;
>> vma->vm_start = vma->vm_end - PAGE_SIZE;
>>
>> * The VMA expands as much depending upon the argument size. So
>> for 32 * PAGE_SIZE argument, it becomes 33 * PAGE_SIZE.
>>
>> * 33 * PAGE_SIZE with 64K pages fails the following test in
>> get_arg_page() function. 33 * PAGE_SIZE is more than 2MB
>> (8 MB /4) with 64K page size.
>>
>> if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur) / 4)
>>
>> * Right now RLIMIT_STACK is hard coded 8MB which does not take
>> PAGE_SIZE into account.
>>
>> Wondering what should be the solution for this problem ?
>>
>> * Change the default stack size from 8MB ?
> just increase the ulimit if you want to use such a large arguments.
>
Yeah that is possible but it does not still offset the fact that
the calculation is broken on the page size of 64K. I mean, yeah
its not practical to have such a large argument. But the point
is whether we would want to support the MAX_ARG_STRLEN semantic
for execve system call or not. At present its broken for 64K
and I am asking whether we will be willing to revisit the
'1/4th of the stack' condition.
next prev parent reply other threads:[~2017-07-03 8:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-30 6:29 Anshuman Khandual
2017-06-30 14:22 ` Michal Hocko
2017-07-03 8:28 ` Anshuman Khandual [this message]
2017-07-03 9:21 ` Michal Hocko
2017-07-04 11:06 ` Anshuman Khandual
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=b2ce8ca1-bf62-6307-7999-9efd687d12bb@linux.vnet.ibm.com \
--to=khandual@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@kernel.org \
--cc=mingo@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®