Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 9 Jun 2023 09:05:15 -0600
From: Tali Auster <tali.auster@...il.com>
To: musl@...ts.openwall.com
Subject: execve with null envp

Hello,

Is there any specific behavior specified when NULL is passed for envp in 
any of the exec* methods that accept it? I took a quick look at the 
source tree, and process/execve.c has a comment suggesting that the 
correct behavior may be to use environ for envp before passing the NULL 
to the syscall unchanged. My intuition - and, in practice, Linux with 
glibc seems to agree - is that a NULL envp means an empty environment. I 
imagine the answer to this question may just be a vague shrug, but does 
POSIX mandate anything specific here? Or, perhaps a question with a more 
clear answer, can my userspace code call execve(pathname, argv, NULL) 
and reliably expect the child to have an empty environment?

Hopefully this is on-topic for this list; regardless, thanks for any 
help or direction y'all can provide!

Tali Auster
They/Them

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.