public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/5786] New: sysconf(_SC_ARG_MAX) no longer accurate since Linux kernel 2.6.23
@ 2008-02-22 15:39 michael dot kerrisk at gmail dot com
  2008-02-23  0:28 ` [Bug libc/5786] " carlos at codesourcery dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: michael dot kerrisk at gmail dot com @ 2008-02-22 15:39 UTC (permalink / raw)
  To: glibc-bugs

In Linux 2.6.23, the limit on the size of [argv + environ] became controllable
by the user, based on the RLIMIT_STACK resource limit.  (See the man page
excerpt below.)  Glibc doesn't seem to know this yet -- I'm not even sure
whether it can be made to know it.  Anyway, as things stand, the return value of
sysconf(_SC_ARG_MAX) is no longer accurate (unless I've missed something), and
this report is a heads up on that point.

>From execve.2

   Limits on size of arguments and environment
       Most Unix implementations impose some limit on the  total
       size  of the command-line argument (argv) and environment
       (envp) strings that may  be  passed  to  a  new  program.
       POSIX.1  allows an implementation to advertise this limit
       using the ARG_MAX constant (either defined in  <limits.h>
       or    available    at    run    time   using   the   call
       sysconf(_SC_ARG_MAX)).

       On Linux prior to kernel 2.6.23, the memory used to store
       the  environment  and  argument strings was limited to 32
       pages (defined by the kernel constant MAX_ARG_PAGES).  On
       architectures  with a 4-kB page size, this yields a maxi-
       mum size of 128 kB.

       On kernel 2.6.23 and later, most architectures support  a
       size  limit  derived  from the soft RLIMIT_STACK resource
       limit (see getrlimit(2)) that is in force at the time  of
       the  execve()  call.   For these architectures, the total
       size is limited to 1/4 of the  allowed  stack  size,  the
       limit  per  string  is  32  pages  (the  kernel  constant
       MAX_ARG_STRLEN), and the maximum  number  of  strings  is
       0x7FFFFFFF.   (This change allows programs to have a much
       larger argument and/or environment  list.   Imposing  the
       1/4-limit  ensures  that  the new program always has some
       stack space.)  Architectures with  no  memory  management
       unit  are  excepted:  they maintain the limit that was in
       effect before kernel 2.6.23.

-- 
           Summary: sysconf(_SC_ARG_MAX) no longer accurate since Linux
                    kernel 2.6.23
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: michael dot kerrisk at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=5786

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <bug-5786-131@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2014-07-02  7:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-22 15:39 [Bug libc/5786] New: sysconf(_SC_ARG_MAX) no longer accurate since Linux kernel 2.6.23 michael dot kerrisk at gmail dot com
2008-02-23  0:28 ` [Bug libc/5786] " carlos at codesourcery dot com
2008-02-23  7:52 ` michael dot kerrisk at googlemail dot com
2008-02-25 17:13   ` Carlos O'Donell
2008-02-25 17:14 ` carlos at codesourcery dot com
2008-02-26  9:54 ` michael dot kerrisk at googlemail dot com
2008-02-26 13:58 ` carlos at codesourcery dot com
2008-02-26 14:33 ` michael dot kerrisk at googlemail dot com
2008-03-08  7:40 ` drepper at redhat dot com
     [not found] <bug-5786-131@http.sourceware.org/bugzilla/>
2014-02-16 19:43 ` jackie.rosen at hushmail dot com
2014-05-28 19:44 ` schwab at sourceware dot org
2014-07-02  7:03 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).