setuid on x64
set user identity
sys_setuid(uid_t uid)
| number | 105 (0x69) |
|---|---|
| abi | common |
| entry point | sys_setuid |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | setuid(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 105, the syscall number |
rdi | uid_t uid |
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 23
- arm64 146
- arm 23
- riscv64 146
- ia32 23
- x32 1073741929
- loongarch64 146
- ppc64 23
- ppc 23
- s390x 213
- mips64 5103
- mipsn32 6103
- mipso32 4023
- alpha 23
- arc 146
- blackfin 23, removed in 4.17
- cris 23, removed in 4.17
- csky 146
- frv 23, removed in 4.17
- hexagon 146
- ia64 1045, removed in 6.7
- m68k 23
- metag 146, removed in 4.17
- microblaze 23
- mn10300 23, removed in 4.17
- nds32 146, removed in 5.18
- nios2 146
- openrisc 146
- parisc 23
- score 146, removed in 4.17
- sh 23
- sparc 23
- sparc64 23
- tilegx 146, removed in 4.17
- tilepro 146, removed in 4.17
- xtensa 136
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/setuid