[PATCH v2 1/3] posix: Remove dynamic memory allocation from execl{e,p}
Adhemerval Zanella
adhemerval.zanella@linaro.org
Mon Feb 1 17:18:00 GMT 2016
On 01-02-2016 14:52, Joseph Myers wrote:
> 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).
>
Right, it is not ensuring the safeness. Is '-fstack-check' the suffice
option to ensure it or do we need a more strict one?
More information about the Libc-alpha
mailing list