syslog on x64
read and/or clear kernel message ring buffer and set console_loglevel
sys_syslog(int type, char *buf, int len)
| number | 103 (0x67) |
|---|---|
| abi | common |
| entry point | sys_syslog |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | syslog(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 103, the syscall number |
rdi | int type |
rsi | char *buf |
rdx | int len |
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 103
- arm64 116
- arm 103
- riscv64 116
- ia32 103
- x32 1073741927
- loongarch64 116
- ppc64 103
- ppc 103
- s390x 103
- mips64 5101
- mipsn32 6101
- mipso32 4103
- alpha 310
- arc 116
- blackfin 103, removed in 4.17
- cris 103, removed in 4.17
- csky 116
- frv 103, removed in 4.17
- hexagon 116
- ia64 1117, removed in 6.7
- m32r 103, removed in 4.17
- m68k 103
- metag 116, removed in 4.17
- microblaze 103
- mn10300 103, removed in 4.17
- nds32 116, removed in 5.18
- nios2 116
- openrisc 116
- parisc 103
- score 116, removed in 4.17
- sh 103
- sparc 207
- sparc64 207
- tilegx 116, removed in 4.17
- tilepro 116, removed in 4.17
- xtensa 200
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/syslog