Hello Theo,
On 9/16/21 10:53 PM, Theo de Raadt wrote:
@@ -45,25 +46,31 @@ execl(const char *name, const char *arg,
{
va_list ap;
char **argv;
- int n;
+ size_t maplen;
+ int save_errno, n, error;
See below.
va_start(ap, arg);
n = 1;
w
we had the same issue in bionic when we removed all our alloca()s, modulo
the fact that ours is a VLA rather than alloca(), but same thing:
https://android.googlesource.com/platform/bionic/+/master/libc/bionic/exec.cpp#61
we argued that it doesn't matter in this case though because we'll touch
all
It always returns -1 until the world changes in some subtle way,
then the code is wrong.
The logic is supposed to return what execve returns, not reinvent
the value.
Over decades this kind of assumption can turn into a bug, so I
prefer to do it right.
Alejandro Colomar (man-pages) wrote:
> Hel
enh wrote:
> we had the same issue in bionic when we removed all our alloca()s, modulo the
> fact
> that ours is a VLA rather than alloca(), but same thing:
> https://android.googlesource.com/platform/bionic/+/master/libc/bionic/exec.cpp#61
that cargo culting doesn't fix anything...
> we argue
Theo de Raadt wrote:
> Maybe we should investigate using mmap. Of the 4 cases, 3 are not
> too difficult, but the 4th case will be very messy, including unwind
> for the 3rd case.
Here is a version that uses mmap instead of alloca, including rollback
of resource allocations in case of failure.
Alejandro Colomar (man-pages) wrote:
> Hi,
>
> I don't know if OpenBSD has a different implementation of alloca(3)
> than Linux. In Linux, alloca(3) (a.k.a. __builtin_alloca()) can't
> return NULL, as it can't detect errors.
There are no alloca can return NULL.
> The only way to detect an
> e
Hi,
I don't know if OpenBSD has a different implementation of alloca(3) than
Linux. In Linux, alloca(3) (a.k.a. __builtin_alloca()) can't return
NULL, as it can't detect errors. The only way to detect an error is to
add a handler for SIGSEGV, AFAIK.
I found the following code in :