setregid on x64
set real and/or effective user or group ID
sys_setregid(gid_t rgid, gid_t egid)
| number | 114 (0x72) |
|---|---|
| abi | common |
| entry point | sys_setregid |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | setregid(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 114, the syscall number |
rdi | gid_t rgid |
rsi | gid_t egid |
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 71
- arm64 143
- arm 71
- riscv64 143
- ia32 71
- x32 1073741938
- loongarch64 143
- ppc64 71
- ppc 71
- s390x 204
- mips64 5112
- mipsn32 6112
- mipso32 4071
- alpha 127
- arc 143
- blackfin 71, removed in 4.17
- cris 71, removed in 4.17
- csky 143
- frv 71, removed in 4.17
- hexagon 143
- ia64 1072, removed in 6.7
- m68k 71
- metag 143, removed in 4.17
- microblaze 71
- mn10300 71, removed in 4.17
- nds32 143, removed in 5.18
- nios2 143
- openrisc 143
- parisc 71
- score 143, removed in 4.17
- sh 71
- sparc 127
- sparc64 127
- tilegx 143, removed in 4.17
- tilepro 143, removed in 4.17
- xtensa 143
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/setregid