execvpe limits PATH environment variable to PATH_MAX

Joseph Myers joseph@codesourcery.com
Tue Mar 31 16:56:28 GMT 2020


On Tue, 31 Mar 2020, Adhemerval Zanella via Libc-alpha wrote:

> The problem with ARG_MAX is it might not represent what underlying system
> actually support.  Linux, for instance, check the total of argv and
> envp to a limit of MAX_ARG_STRINGS (0x7FFFFFFF) and then check the to
> resulting size against 1/4 of the max stack size or 3/4 of RLIMIT_STACK.
> So I don't think ARG_MAX represents the path limit.

It also limits individual string lengths to MAX_ARG_STRLEN (PAGE_SIZE * 
32).  So that's the effective limit on the length of an environment 
variable (name + value) (dependent on architecture and kernel 
configuration).

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Libc-alpha mailing list