Re: [PATCH] kill suid bit only for regular files

Krzysztof Halasa
2008-10-27T15:19:39Z

Dmitri Monakhov <dmonakhov@openvz.org> writes:

>> Are we sure that should_remove_suid() is not and never will used for
>> directories?
> This bits are meaningless for directory. Posix is quiet about this case.

> Ok. Will do. My point is: it is improbable what some body(except me :) )
> want to set S_ISUID/S_ISGID bit for non regular files. But it is
> technically possible and result in unexpected consequence.

I don't know about the context, but SGID bits for directories are not
magic, they mean the newly created files will inherit GID from the
parent directory, and if the file is actually a subdirectory, it will
also have SGID set. The same was also true WRT SUID bits on some
systems.
--
Krzysztof Halasa