fchmodat on x64
change permissions of a file
sys_fchmodat(int dfd, const char *filename, umode_t mode)
| number | 268 (0x10c) |
|---|---|
| abi | common |
| entry point | sys_fchmodat |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | fchmodat(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 268, the syscall number |
rdi | int dfd |
rsi | const char *filename |
rdx | umode_t mode |
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 306
- arm64 53
- arm 333
- riscv64 53
- ia32 306
- x32 1073742092
- loongarch64 53
- ppc64 297
- ppc 297
- s390x 299
- mips64 5258
- mipsn32 6262
- mipso32 4299
- alpha 461
- arc 53
- blackfin 306, removed in 4.17
- cris 306, removed in 4.17
- csky 53
- frv 306, removed in 4.17
- hexagon 53
- ia64 1292, removed in 6.7
- m32r 306, removed in 4.17
- m68k 299
- metag 53, removed in 4.17
- microblaze 306
- mn10300 307, removed in 4.17
- nds32 53, removed in 5.18
- nios2 53
- openrisc 53
- parisc 286
- score 53, removed in 4.17
- sh 306
- sparc 295
- sparc64 295
- tilegx 53, removed in 4.17
- tilepro 53, removed in 4.17
- xtensa 300
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/fchmodat