fchownat on x64
change ownership of a file
sys_fchownat(int dfd, const char *filename, uid_t user, gid_t group, int flag)
| number | 260 (0x104) |
|---|---|
| abi | common |
| entry point | sys_fchownat |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | fchownat(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 260, the syscall number |
rdi | int dfd |
rsi | const char *filename |
rdx | uid_t user |
r10 | gid_t group |
r8 | int flag |
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 298
- arm64 54
- arm 325
- riscv64 54
- ia32 298
- x32 1073742084
- loongarch64 54
- ppc64 289
- ppc 289
- s390x 291
- mips64 5250
- mipsn32 6254
- mipso32 4291
- alpha 453
- arc 54
- blackfin 298, removed in 4.17
- cris 298, removed in 4.17
- csky 54
- frv 298, removed in 4.17
- hexagon 54
- ia64 1284, removed in 6.7
- m32r 298, removed in 4.17
- m68k 291
- metag 54, removed in 4.17
- microblaze 298
- mn10300 299, removed in 4.17
- nds32 54, removed in 5.18
- nios2 54
- openrisc 54
- parisc 278
- score 54, removed in 4.17
- sh 298
- sparc 287
- sparc64 287
- tilegx 54, removed in 4.17
- tilepro 54, removed in 4.17
- xtensa 297
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/fchownat