lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 1 May 2014 11:52:48 -0600
From:	Andreas Dilger <adilger@...ger.ca>
To:	"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
Cc:	agruen@...nel.org, bfields@...ldses.org, akpm@...ux-foundation.org,
	viro@...iv.linux.org.uk, dhowells@...hat.com,
	linux-fsdevel@...r.kernel.org, linux-nfs@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH -V1 22/22] ext4: Add Ext4 compat richacl feature flag

On May 1, 2014, at 9:48 AM, Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com> wrote:

> Andreas Dilger <adilger@...ger.ca> writes:
> 
>> On Apr 27, 2014, at 10:14 AM, Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com> wrote:
>>> This feature flag can be used to enable richacl on
>>> the file system. Once enabled the "acl" mount option
>>> will enable richacl instead of posix acl
>> 
>>> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
>>> index 6f9e6fadac04..2a0221652d79 100644
>>> --- a/fs/ext4/super.c
>>> +++ b/fs/ext4/super.c
>>> @@ -1274,6 +1274,30 @@ static ext4_fsblk_t get_sb_block(void **data)
>>> 	return sb_block;
>>> }
>>> 
>>> +static void enable_acl(struct super_block *sb)
>>> +{
>>> +#if !defined(CONFIG_EXT4_FS_POSIX_ACL) && !defined(CONFIG_EXT4_FS_RICHACL)
>>> +	return;
>>> +#endif
>>> +	if (EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_RICHACL)) {
>>> +		sb->s_flags |= MS_RICHACL;
>>> +		sb->s_flags &= ~MS_POSIXACL;
>>> +	} else {
>>> +		sb->s_flags |= MS_POSIXACL;
>>> +		sb->s_flags &= ~MS_RICHACL;
>>> +	}
>> 
>> This should put the #ifdef around the code that is being enabled/disabled,
>> otherwise it just becomes dead code:
>> 
>> static int enable_acl(struct super_block *sb)
>> {
>> 	if (EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_RICHACL)) {
>> #if defined(CONFIG_EXT4_FS_RICHACL)
>> 		sb->s_flags |= MS_RICHACL;
>> 		sb->s_flags &= ~MS_POSIXACL;
>> #else
>> 		return -EOPNOTSUPP;
>> #endif
>> 	} else {
>> #if defined(CONFIG_EXT4_FS_POSIX_ACL)
>> 		sb->s_flags |= MS_POSIXACL;
>> 		sb->s_flags &= ~MS_RICHACL;
>> #else
>> 		return -EOPNOTSUPP;
>> #endif
>> 	}
>> 	return 0;
>> }
> 
> That is too much #ifdef with no real benefit ?

The benefit is that if neither CONFIG_EXT4_FS_RICHACL nor CONFIG_EXT4_FS_POSIX_ACL are defined there isn't unreachable code
after "return" at the start of the function.  Some static code
analysis tools will complain about this.

Cheers, Andreas






Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ