Skip to content



setregid - set real and effective group IDs.


The setregid() system call allows a process to change both its real group ID and its effective group ID.

This capability is similar to setting user IDs but operates on the group level, providing processes the ability to modify their association with user groups. In Unix-like systems, the real group ID identifies the primary group of the user who initiated the process, while the effective group ID influences the group-based permissions for that process.

This mechanism is instrumental for processes that need to alternate between different group-based privileges temporarily, ensuring resource access control and security at the group level.


  • rgid:gid_t[K] - The real group ID to be set. If this argument is -1, the real GID is not changed.
  • egid:gid_t[K] - The effective group ID to be set. If this argument is -1, the effective GID is not changed.

Available Tags

  • K - Originated from kernel-space.
  • U - Originated from user space.
  • TOCTOU - Vulnerable to TOCTOU (time of check, time of use).
  • OPT - Optional argument - might not always be available (passed with null value).




Tracepoint (through sys_enter).


To observe and trace when the setregid() system call is executed, collecting data about the changes to the real and effective group IDs.

Example Use Case

Observing group-level privilege changes is essential in secure environments, especially when monitoring potential group-based privilege escalation or processes frequently transitioning between group contexts.


Improper usage or vulnerabilities in programs using setregid() can be exploited to gain unauthorized group privileges, leading to potential security lapses.

  • setgid() - Set the effective group ID of the calling process.
  • setresgid() - Set real, effective, and saved group IDs.
  • setegid() - Set effective group ID.

This document was automatically generated by OpenAI and reviewed by a Human.