Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJgzZopaVSX75SeGQTs0gx9D8oyuGp--HSX3UGBxCx42ZTVYBg@mail.gmail.com>
Date: Mon, 22 Jul 2024 09:20:35 -0400
From: enh <enh@...gle.com>
To: libc-coord@...ts.openwall.com
Subject: Re: Allocating for execve and related functions

i removed _almost_ every VLA from bionic years ago ... the exec()
family being the most notable exceptions.

On Mon, Jul 22, 2024 at 2:37 AM Florian Weimer <fweimer@...hat.com> wrote:
>
> 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.