setfsuid on x64
set user identity used for filesystem checks
sys_setfsuid(uid_t uid)
| number | 122 (0x7a) |
|---|---|
| abi | common |
| entry point | sys_setfsuid |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | setfsuid(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 122, 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 138
- arm64 151
- arm 138
- riscv64 151
- ia32 138
- x32 1073741946
- loongarch64 151
- ppc64 138
- ppc 138
- s390x 215
- mips64 5120
- mipsn32 6120
- mipso32 4138
- alpha 325
- arc 151
- blackfin 138, removed in 4.17
- cris 138, removed in 4.17
- csky 151
- frv 138, removed in 4.17
- hexagon 151
- ia64 1142, removed in 6.7
- m68k 138
- metag 151, removed in 4.17
- microblaze 138
- mn10300 138, removed in 4.17
- nds32 151, removed in 5.18
- nios2 151
- openrisc 151
- parisc 138
- score 151, removed in 4.17
- sh 138
- sparc 228
- sparc64 228
- tilegx 151, removed in 4.17
- tilepro 151, removed in 4.17
- xtensa 180
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/setfsuid