set_tid_address on x64
set pointer to thread ID
sys_set_tid_address(int *tidptr)
| number | 218 (0xda) |
|---|---|
| abi | common |
| entry point | sys_set_tid_address |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | set_tid_address(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 218, the syscall number |
rdi | int *tidptr |
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 258
- arm64 96
- arm 256
- riscv64 96
- ia32 258
- x32 1073742042
- loongarch64 96
- ppc64 232
- ppc 232
- s390x 252
- mips64 5212
- mipsn32 6213
- mipso32 4252
- alpha 411
- arc 96
- blackfin 259, removed in 4.17
- cris 258, removed in 4.17
- csky 96
- frv 258, removed in 4.17
- hexagon 96
- ia64 1233, removed in 6.7
- m32r 258, removed in 4.17
- m68k 253
- metag 96, removed in 4.17
- microblaze 258
- mn10300 258, removed in 4.17
- nds32 96, removed in 5.18
- nios2 96
- openrisc 96
- parisc 237
- score 96, removed in 4.17
- sh 258
- sparc 166
- sparc64 166
- tilegx 96, removed in 4.17
- tilepro 96, removed in 4.17
- xtensa 126
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/set_tid_address