mknod on x64
create a special or ordinary file
sys_mknod(const char *filename, umode_t mode, unsigned dev)
| number | 133 (0x85) |
|---|---|
| abi | common |
| entry point | sys_mknod |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | mknod(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 133, the syscall number |
rdi | const char *filename |
rsi | umode_t mode |
rdx | 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 14
- arm 14
- ia32 14
- x32 1073741957
- ppc64 14
- ppc 14
- s390x 14
- mips64 5131
- mipsn32 6131
- mipso32 4014
- alpha 14
- blackfin 14, removed in 4.17
- cris 14, removed in 4.17
- frv 14, removed in 4.17
- ia64 1037, removed in 6.7
- m32r 14, removed in 4.17
- m68k 14
- microblaze 14
- mn10300 14, removed in 4.17
- parisc 14
- score 1027, removed in 4.17
- sh 14
- sparc 14
- sparc64 14
- xtensa 36
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/mknod