[PATCH] posix: Remove dynamic memory allocation from execl{e,p}

Joseph Myers joseph@codesourcery.com
Fri Jan 29 17:45:00 GMT 2016


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



More information about the Libc-alpha mailing list