Yes.
When a process calls exec
, the kernel copies the entire argv
and envp
arrays. Then, these are copied into the new process image -- notably, when the program starts running, its stack looks like:
NULL
...
envp[1]
envp[0]
NULL
argv[argc-1]
...
argv[1]
argv[0]
argc
The Glibc startup code in _start
massages this into the proper form to invoke main
.
(For more details, the copy from the old process is done in linux/fs/exec.c
, the copy to the new process is done in linux/fs/binfmt_elf.c
, and program startup is done in architecture-specific code such as glibc/sysdeps/i386/start.S
, glibc/sysdeps/x86_64/start.S
, or glibc/ports/sysdeps/arm/start.S
, which exist just to kick off into __libc_start_main
in glibc/csu/libc-start.c
which launches main
.)