readlinkat on x64
read value of a symbolic link
sys_readlinkat(int dfd, const char *path, char *buf, int bufsiz)
| number | 267 (0x10b) |
|---|---|
| abi | common |
| entry point | sys_readlinkat |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | readlinkat(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 267, the syscall number |
rdi | int dfd |
rsi | const char *path |
rdx | char *buf |
r10 | int bufsiz |
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 305
- arm64 78
- arm 332
- riscv64 78
- ia32 305
- x32 1073742091
- loongarch64 78
- ppc64 296
- ppc 296
- s390x 298
- mips64 5257
- mipsn32 6261
- mipso32 4298
- alpha 460
- arc 78
- blackfin 305, removed in 4.17
- cris 305, removed in 4.17
- csky 78
- frv 305, removed in 4.17
- hexagon 78
- ia64 1291, removed in 6.7
- m32r 305, removed in 4.17
- m68k 298
- metag 78, removed in 4.17
- microblaze 305
- mn10300 306, removed in 4.17
- nds32 78, removed in 5.18
- nios2 78
- openrisc 78
- parisc 285
- score 78, removed in 4.17
- sh 305
- sparc 294
- sparc64 294
- tilegx 78, removed in 4.17
- tilepro 78, removed in 4.17
- xtensa 295
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/readlinkat