Skip to contentSkip to conversation

Question to directory setgid bit FS implementation details

DISCUSSION Markus Kolb 2 participants 3 messages Oct 25, 2011

lore
Share & tools
lore
#0 lore raw

Hello,

can you please explain in brief how the creation of files in directories with setgid bit set is implemented in filesystems.
I'd like to know this for a ext2/3/4 fs, jfs and nfs v3/4 if there are essential differences.

Which source part is responsible for setting the group on the new file?
Is the effective group of the process changed before creating the file?
Is there any sync for thread safety during the change of process group?
Where can I find this sync in source?
Or how is this implemented that the file gets the same group like the parent directory?

Many thanks
Markus

#1 lore raw
Quoted 3 lines · Markus Kolb

can you please explain in brief how the creation of files in directories with setgid bit set is implemented in filesystems.

Look in fs/inode.c, function inode_init_owner(). All of 8 lines of code.

#2 lore raw
Quoted 7 lines · On Tue, 25 Oct 2011 05:19:24 -0400, [email protected] wrote:
Quoted 3 lines · Markus Kolb

can you please explain in brief how the creation of files in directories with setgid bit set is implemented in filesystems.

Look in fs/inode.c, function inode_init_owner(). All of 8 lines of code.

Ok.
Looks for me that there are only changes in data structs.

To be on the safe side can you confirm that there should be no call inside the kernel code to change the effective group of a process which creates a file in a directory with setgid-bit set?!

Thanks