Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <87v80yq6en.fsf@oldenburg.str.redhat.com>
Date: Mon, 22 Jul 2024 08:37:04 +0200
From: Florian Weimer <fweimer@...hat.com>
To: libc-coord@...ts.openwall.com
Subject: Allocating for execve and related functions

In some cases, it is necessary to allocate before making an execve
system call.  In execvp and similar functions, space for constructing
the pathname is needed.  For execl, the argument vector needs to be
built.  Some functions have fallback to the shell for missing script
interpreters, which also requires copying the argument vector.
Thread-safe environment access may require a copy of the environment
vector.

The allocation needs to be performed in an async-signal-safe fashion,
but that isn't the main problem.  In a vfork scenario, the allocation
happens in the original process, and if execve is successful, any
allocation leaks.

Has anyone found a way to work around this?  A single per-thread buffer
again runs into signal safety issues.  Maybe a stack of buffers, and
cleanup code in vfork for anything allocated in the new process?

Thanks,
Florian

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.