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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> writes:

> On Sun, 19 Oct 2008 18:00:39 +0400 Dmitri Monakhov <dmonakhov@xxxxxxxxxx> wrote:
>
>> We don't have to do it because it is useless for non regular files.
>
> 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.
>
>> In fact block device may trigger this path without dentry->d_inode->i_mutex.
>
> What's wrong with blockdevs triggering this path?
We have following locking rules:notify_changes must be protected 
by d_inode->i_mutex.
BTW: You have add this sanity check to notify_change to -mm tree.
>
> Better changelogs, please.
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.
>
>> Signed-off-by: Dmitri Monakhov <dmonakhov@xxxxxxxxxx>
>> ---
>>  mm/filemap.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> diff --git a/mm/filemap.c b/mm/filemap.c
>> index a2907d5..3d5a2e7 100644
>> --- a/mm/filemap.c
>> +++ b/mm/filemap.c
>> @@ -1767,7 +1767,7 @@ int should_remove_suid(struct dentry *dentry)
>>  	if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
>>  		kill |= ATTR_KILL_SGID;
>>  
>> -	if (unlikely(kill && !capable(CAP_FSETID)))
>> +	if (unlikely(kill && !capable(CAP_FSETID) && S_ISREG(mode)))
>>  		return kill;
>>  
>>  	return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux