setreuid on x64
set real and/or effective user or group ID
sys_setreuid(uid_t ruid, uid_t euid)
| number | 113 (0x71) |
|---|---|
| abi | common |
| entry point | sys_setreuid |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | setreuid(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 113, the syscall number |
rdi | uid_t ruid |
rsi | uid_t euid |
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 70
- arm64 145
- arm 70
- riscv64 145
- ia32 70
- x32 1073741937
- loongarch64 145
- ppc64 70
- ppc 70
- s390x 203
- mips64 5111
- mipsn32 6111
- mipso32 4070
- alpha 126
- arc 145
- blackfin 70, removed in 4.17
- cris 70, removed in 4.17
- csky 145
- frv 70, removed in 4.17
- hexagon 145
- ia64 1071, removed in 6.7
- m68k 70
- metag 145, removed in 4.17
- microblaze 70
- mn10300 70, removed in 4.17
- nds32 145, removed in 5.18
- nios2 145
- openrisc 145
- parisc 70
- score 145, removed in 4.17
- sh 70
- sparc 126
- sparc64 126
- tilegx 145, removed in 4.17
- tilepro 145, removed in 4.17
- xtensa 142
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/setreuid