A completely-from-scratch hobby operating system: bootloader, kernel, drivers, C library, and userspace including a composited graphical UI, dynamic linker, syntax-highlighting text editor, network stack, etc.
This PR adds the Group ID feature to processes on the system. This addition enables checking group permissions through the has_permissions() function.
In addition to adding the group ID field to the process structure, the following changes are included with this PR:
spawn_init() has been updated to initialize the GID. Similarly, spawn_process() has been updated to inherit the GID from the parent.
System calls for setting and getting the process GID have been implemented.
The chown command has been updated to appropriately submit the current gid instead of the process's uid in its place.
The chgrp command has been added. It is basically identical to the chown command implementation except it operates on changing the GID.
The procfs module's status function has been updated to show the process GID.
The has_permissions() function has been updated to check the GID.
Testing
I didn't see a folder for test programs so I wasn't sure if it was appropriate to even add one in this PR.
I tested this manually with make headless and a small toy program that would set the process GID using the getgid() and setgid() system calls. I ran this as a background process and then checked /proc/pid/status to verify the new GID was there.
Remarks
To the best of my knowledge I believe this PR is complete. I'm still getting familiar with the code base so any feedback on whether this change is incomplete, unnecessary, unwanted, etc, is greatly appreciated.
This PR adds the Group ID feature to processes on the system. This addition enables checking group permissions through the
has_permissions()
function.In addition to adding the group ID field to the process structure, the following changes are included with this PR:
spawn_init()
has been updated to initialize the GID. Similarly,spawn_process()
has been updated to inherit the GID from the parent.System calls for setting and getting the process GID have been implemented.
The
chown
command has been updated to appropriately submit the currentgid
instead of the process'suid
in its place.The
chgrp
command has been added. It is basically identical to thechown
command implementation except it operates on changing the GID.The
procfs
module'sstatus
function has been updated to show the process GID.The
has_permissions()
function has been updated to check the GID.Testing
I didn't see a folder for test programs so I wasn't sure if it was appropriate to even add one in this PR.
I tested this manually with
make headless
and a small toy program that would set the process GID using thegetgid()
andsetgid()
system calls. I ran this as a background process and then checked/proc/pid/status
to verify the new GID was there.Remarks
To the best of my knowledge I believe this PR is complete. I'm still getting familiar with the code base so any feedback on whether this change is incomplete, unnecessary, unwanted, etc, is greatly appreciated.