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: Joseph Myers <joseph at codesourcery dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: Florian Weimer <fweimer at redhat dot com>, <libc-alpha at sourceware dot org>
- Date: Fri, 29 Jan 2016 17:45:21 +0000
- 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> <56AB6FFF dot 7040308 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1601291541490 dot 29026 at digraph dot polyomino dot org dot uk> <56ABA3D5 dot 4000905 at linaro dot org>
On Fri, 29 Jan 2016, Adhemerval Zanella wrote:
> My view is for such function is just try to allocate the buffer on
> stack and allow it fails through invalid access in case of buffer
> overflow.
I'd say just trying the allocation is OK in this case (if stack allocation
is all that's permitted by the function semantics, and bearing in mind
that current Linux versions determine ARG_MAX dynamically based on the
stack limit) *if* it's allocated in a way that guarantees failure if it's
too large (i.e. touching each page in turn) rather than potentially
overflowing into unrelated memory.
--
Joseph S. Myers
joseph@codesourcery.com