This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] posix: Remove dynamic memory allocation from execl{e,p}
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Zack Weinberg <zackw at panix dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 29 Jan 2016 13:45:29 -0200
- Subject: Re: [PATCH] posix: Remove dynamic memory allocation from execl{e,p}
- Authentication-results: sourceware.org; auth=none
- References: <1454075599-2304-1-git-send-email-adhemerval dot zanella at linaro dot org> <CAKCAbMjTUe8O3sR7o+y26nYNEtsQCOhExsPWs8HmB5UB=_5ckQ at mail dot gmail dot com>
> Em 29 de jan de 2016, Ãs 13:00, Zack Weinberg <zackw@panix.com> escreveu:
>
> On Fri, Jan 29, 2016 at 8:53 AM, Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>> GLIBC execl{e,p} implementation might use malloc if the total number of
>> arguments exceeds initial assumption size (1024). This might lead to
>> issues in two situations: [...]
>
> I think it would help the discussion if you could outline the
> conditions under which these functions need to allocate memory in the
> first place. Does it happen all the time, or only when falling back
> to non-#! shell script invocation, or what?
>
> zw
Excel{e,p} first try to use a stack allocate buffer for up to 1024 arguments and try to allocate dynamic memory for large values (by trying to allocate memory to 2048 argument and doubling each time it does no fulfill the requirements).
These functions does not try to run shell script with shebang (different than execpe).