recvmsg on x64
receive a message from a socket
sys_recvmsg(int fd, struct user_msghdr *msg, unsigned int flags)
| number | 47 (0x2f) |
|---|---|
| abi | 64 |
| entry point | sys_recvmsg |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | recvmsg(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 47, the syscall number |
rdi | int fd |
rsi | struct user_msghdr *msg |
rdx | unsigned int flags |
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 372
- arm64 212
- arm 297
- riscv64 212
- ia32 372
- x32 1073742343
- loongarch64 212
- ppc64 342
- ppc 342
- s390x 372
- mips64 5046
- mipsn32 6046
- mipso32 4177
- alpha 113
- arc 212
- blackfin 323, removed in 4.17
- csky 212
- hexagon 212
- ia64 1206, removed in 6.7
- m68k 369
- metag 212, removed in 4.17
- microblaze 361
- nds32 212, removed in 5.18
- nios2 212
- openrisc 212
- parisc 184
- score 212, removed in 4.17
- sh 356
- sparc 113
- sparc64 113
- tilegx 212, removed in 4.17
- tilepro 212, removed in 4.17
- xtensa 107
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/recvmsg