I have a question about how Linux handles varibales variables for execve ():
Synopsis for execve (): int execve (const char * filename, char * const argv [], char * const envp []);
Before calling execve (), we allocate memory to store envs / args from the current process memory mapping. But after execve (), the entire text / data / bss / stack of the calling process is overwritten by the new program, and all the memory mappings of the old process are not saved (including memory for passed envs / args).
For a new program, where to read envs / args? Does the kernel create a copy of the passed envs / args and put it in a new memory mapping or some other tricks?
source share