Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1678878

Re: Question regarding MAX_ARG_STRLEN with execve()

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: Question regarding MAX_ARG_STRLEN with execve()
Date 2017-06-30 16:30 +0200
Message-ID <tY55M-6Ah-11@gated-at.bofh.it> (permalink)
References <tXXKV-1TC-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

> * Change the ratio test from 1/4th ?

-- 
Michal Hocko
SUSE Labs

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Question regarding MAX_ARG_STRLEN with execve() Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-06-30 08:40 +0200
  Re: Question regarding MAX_ARG_STRLEN with execve() Michal Hocko <mhocko@kernel.org> - 2017-06-30 16:30 +0200
    Re: Question regarding MAX_ARG_STRLEN with execve() Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-07-03 10:30 +0200
      Re: Question regarding MAX_ARG_STRLEN with execve() Michal Hocko <mhocko@kernel.org> - 2017-07-03 11:30 +0200

csiph-web