This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 1/3] posix: Remove dynamic memory allocation from execl{e,p}


On Mon, 1 Feb 2016, Adhemerval Zanella wrote:

> +  char *argv[argc+1];
> +  va_start (ap, arg);
> +  argv[0] = (char*) arg;
> +  for (i = 1; i < argc; i++)
> +     argv[i] = va_arg (ap, char *);
> +  argv[i] = NULL;

I don't see how you're ensuring this stack allocation is safe (i.e. if 
it's too big, it doesn't corrupt memory that's in use by other threads).  
Can't it jump beyond any guard page and start overwriting other memory, 
possibly in use by another thread, before reaching unmapped memory?  I'd 
expect safe large stack allocations (as with -fstack-check) to need to 
touch the pages in the right order (and doing that safely probably means 
using -fstack-check).

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]