setgid on x64
set group identity
sys_setgid(gid_t gid)
| number | 106 (0x6a) |
|---|---|
| abi | common |
| entry point | sys_setgid |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | setgid(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 106, the syscall number |
rdi | gid_t gid |
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 46
- arm64 144
- arm 46
- riscv64 144
- ia32 46
- x32 1073741930
- loongarch64 144
- ppc64 46
- ppc 46
- s390x 214
- mips64 5104
- mipsn32 6104
- mipso32 4046
- alpha 132
- arc 144
- blackfin 46, removed in 4.17
- cris 46, removed in 4.17
- csky 144
- frv 46, removed in 4.17
- hexagon 144
- ia64 1061, removed in 6.7
- m68k 46
- metag 144, removed in 4.17
- microblaze 46
- mn10300 46, removed in 4.17
- nds32 144, removed in 5.18
- nios2 144
- openrisc 144
- parisc 46
- score 144, removed in 4.17
- sh 46
- sparc 46
- sparc64 46
- tilegx 144, removed in 4.17
- tilepro 144, removed in 4.17
- xtensa 138
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/setgid