mknodat on x64
create a special or ordinary file
sys_mknodat(int dfd, const char *filename, umode_t mode, unsigned dev)
| number | 259 (0x103) |
|---|---|
| abi | common |
| entry point | sys_mknodat |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | mknodat(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 259, the syscall number |
rdi | int dfd |
rsi | const char *filename |
rdx | umode_t mode |
r10 | unsigned dev |
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 297
- arm64 33
- arm 324
- riscv64 33
- ia32 297
- x32 1073742083
- loongarch64 33
- ppc64 288
- ppc 288
- s390x 290
- mips64 5249
- mipsn32 6253
- mipso32 4290
- alpha 452
- arc 33
- blackfin 297, removed in 4.17
- cris 297, removed in 4.17
- csky 33
- frv 297, removed in 4.17
- hexagon 33
- ia64 1283, removed in 6.7
- m32r 297, removed in 4.17
- m68k 290
- metag 33, removed in 4.17
- microblaze 297
- mn10300 298, removed in 4.17
- nds32 33, removed in 5.18
- nios2 33
- openrisc 33
- parisc 277
- score 33, removed in 4.17
- sh 297
- sparc 286
- sparc64 286
- tilegx 33, removed in 4.17
- tilepro 33, removed in 4.17
- xtensa 290
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/mknodat