I am confused about syscall __NR_execve . When I recognize the linux system call. The correct way to use execve as follows:
char *sc[2]; sc[0]="/bin/sh"; sc[1]= NULL; execve(sc[0],sc,NULL);
The execve function then calls syscall() to get into the system kernel by placing the arguments in the EAX , EBX , ECX and EDX ECX . However, this still works if I use
execve("/bin/sh",NULL,NULL);
But if I replaced "/bin/sh" with "/bin/ls" , the failure:
A NULL argv[0] was passed through an exec system call.
I wonder why "/bin/sh" can be successfully executed without sufficient parameters, while "/bin/ls" does not work?
source share