setgroups on x64
get/set list of supplementary group IDs
sys_setgroups(int gidsetsize, gid_t *grouplist)
| number | 116 (0x74) |
|---|---|
| abi | common |
| entry point | sys_setgroups |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | setgroups(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 116, the syscall number |
rdi | int gidsetsize |
rsi | gid_t *grouplist |
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 81
- arm64 159
- arm 81
- riscv64 159
- ia32 81
- x32 1073741940
- loongarch64 159
- ppc64 81
- ppc 81
- s390x 206
- mips64 5114
- mipsn32 6114
- mipso32 4081
- alpha 80
- arc 159
- blackfin 81, removed in 4.17
- cris 81, removed in 4.17
- csky 159
- frv 81, removed in 4.17
- hexagon 159
- ia64 1078, removed in 6.7
- m68k 81
- metag 159, removed in 4.17
- microblaze 81
- mn10300 81, removed in 4.17
- nds32 159, removed in 5.18
- nios2 159
- openrisc 159
- parisc 81
- score 159, removed in 4.17
- sh 81
- sparc 80
- sparc64 80
- tilegx 159, removed in 4.17
- tilepro 159, removed in 4.17
- xtensa 197
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/setgroups