execve on x64
execute program
sys_execve(const char *filename, const char *const *argv, const char *const *envp)
| number | 59 (0x3b) |
|---|---|
| abi | 64 |
| entry point | sys_execve |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | execve(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 59, the syscall number |
rdi | const char *filename |
rsi | const char *const *argv |
rdx | const char *const *envp |
rax | the return value |
Then run syscall to enter the kernel.
The syscall instruction clobbers rcx (the return address lands in rcx) and r11 (the flags land in r11).
Since Linux 5.14 the kernel reads the syscall number from eax and ignores the upper 32 bits of rax. Older kernels fail with ENOSYS when those bits are not zero, and mov eax, N clears them, so it works on both.
Same syscall on other architectures
- x86 11
- arm64 221
- arm 11
- riscv64 221
- ia32 11
- x32 1073742344
- loongarch64 221
- ppc64 11
- ppc 11
- s390x 11
- mips64 5057
- mipsn32 6057
- mipso32 4011
- alpha 59
- arc 221
- blackfin 11, removed in 4.17
- cris 11, removed in 4.17
- csky 221
- frv 11, removed in 4.17
- hexagon 221
- ia64 1033, removed in 6.7
- m32r 11, removed in 4.17
- m68k 11
- metag 221, removed in 4.17
- microblaze 11
- mn10300 11, removed in 4.17
- nds32 221, removed in 5.18
- nios2 221
- openrisc 221
- parisc 11
- score 221, removed in 4.17
- sh 11
- sparc 59
- sparc64 59
- tilegx 221, removed in 4.17
- tilepro 221, removed in 4.17
- xtensa 117
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/execve