getgroups on x64
get/set list of supplementary group IDs
sys_getgroups(int gidsetsize, gid_t *grouplist)
| number | 115 (0x73) |
|---|---|
| abi | common |
| entry point | sys_getgroups |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | getgroups(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 115, 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 80
- arm64 158
- arm 80
- riscv64 158
- ia32 80
- x32 1073741939
- loongarch64 158
- ppc64 80
- ppc 80
- s390x 205
- mips64 5113
- mipsn32 6113
- mipso32 4080
- alpha 79
- arc 158
- blackfin 80, removed in 4.17
- cris 80, removed in 4.17
- csky 158
- frv 80, removed in 4.17
- hexagon 158
- ia64 1077, removed in 6.7
- m68k 80
- metag 158, removed in 4.17
- microblaze 80
- mn10300 80, removed in 4.17
- nds32 158, removed in 5.18
- nios2 158
- openrisc 158
- parisc 80
- score 158, removed in 4.17
- sh 80
- sparc 79
- sparc64 79
- tilegx 158, removed in 4.17
- tilepro 158, removed in 4.17
- xtensa 196
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/getgroups