[LibOS] `execve` syscall must treat `argv == NULL` as `argv = {NULL}`
Description of the problem
The man page for execve says:
On Linux,
argvandenvpcan be specified as NULL. In both cases, this has the same effect as specifying the argument as a pointer to a list containing a single null pointer. Do not take advantage of this nonstandard and nonportable misfeature! On many other UNIX systems, specifyingargvas NULL will result in an error (EFAULT). Some other UNIX systems treat theenvp==NULLcase the same as Linux.
Currently Gramine doesn't implement this special case. See code here: https://github.com/gramineproject/gramine/blob/64b004bb59a237ea2486ef791fd970519888c638/libos/src/sys/libos_exec.c#L144
This should be easy to implement. We just need:
argv == NULL->argv = {NULL}envp == NULL->envp = {NULL}
For discussions, see https://github.com/gramineproject/gramine/pull/781
Unfortunately, the current quirk in Gramine with respect to envp prevents us from performing envp = {NULL} conversion. See this code: https://github.com/gramineproject/gramine/blob/546c598b694d091121babc215bf6b9f9f52bbb4d/libos/src/sys/libos_exec.c#L150-L152
Also see a previous attempt at fixing a related problem (and failing): https://github.com/gramineproject/gramine/pull/781
So this issue then should deal only with argv = {NULL}. Fortunately, Stefan created a PR to solve this, #979.