setns on x64
reassociate thread with a namespace
sys_setns(int fd, int nstype)
| number | 308 (0x134) |
|---|---|
| abi | common |
| entry point | sys_setns |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | setns(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 308, the syscall number |
rdi | int fd |
rsi | int nstype |
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 346
- arm64 268
- arm 375
- riscv64 268
- ia32 346
- x32 1073742132
- loongarch64 268
- ppc64 350
- ppc 350
- s390x 339
- mips64 5303
- mipsn32 6308
- mipso32 4344
- alpha 501
- arc 268
- blackfin 379, removed in 4.17
- cris 335, removed in 4.17
- csky 268
- frv 337, removed in 4.17
- hexagon 268
- ia64 1330, removed in 6.7
- m32r 325, removed in 4.17
- m68k 344
- metag 268, removed in 4.17
- microblaze 375
- mn10300 339, removed in 4.17
- nds32 268, removed in 5.18
- nios2 268
- openrisc 268
- parisc 328
- score 268, removed in 4.17
- sh 364
- sparc 337
- sparc64 337
- tilegx 268, removed in 4.17
- tilepro 268, removed in 4.17
- xtensa 308
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/setns