Re: [PATCH] src/t_attr_corruption: use security.capability instead of security.evm

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



On 2/25/19 5:47 PM, Darrick J. Wong wrote:
> On Mon, Feb 25, 2019 at 02:10:52PM -0500, jeffm@xxxxxxxx wrote:
>> From: Jeff Mahoney <jeffm@xxxxxxxx>
>>
>> src/t_attr_corruption uses the security.evm extended attribute because
>> it sorts before security.posix_acl_access.  The security.evm attribute
>> is a formatted structure and when passed an uninitialized buffer, it
>> will fail with EPERM.
>>
>> We see test failures like:
>>     --- tests/generic/529.out2019-02-21 13:22:47.583406922 -0500
>>     +++ /opt/xfstests/results//generic/529.out.bad 2019-02-21 13:57:31.967406922 -0500
>>     @@ -1,2 +1,2 @@
>>      QA output created by 529
>>     -list attr: Numerical result out of range
>>     +set evm: Operation not permitted
>>
>> This patch uses security.capability which also sorts where it needs to
>> do for the test and also accepts an unformatted buffer.
>>
>> Signed-off-by: Jeff Mahoney <jeffm@xxxxxxxx>
>> ---
>>  src/t_attr_corruption.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/t_attr_corruption.c b/src/t_attr_corruption.c
>> index f26611f9..0c229dbc 100644
>> --- a/src/t_attr_corruption.c
>> +++ b/src/t_attr_corruption.c
>> @@ -76,7 +76,7 @@ int main(int argc, char *argv[])
>>  	if (ret)
>>  		die("set posix acl");
>>  
>> -	ret = fsetxattr(fd, "security.evm", buf, 1, 1);
>> +	ret = fsetxattr(fd, "security.capability", buf, 1, 1);
> 
> This fails for me both with and without EVM configured into my kernel:
> 
> fsetxattr(3, "security.capability", "\3", 1, XATTR_CREATE) = -1 EINVAL (Invalid argument)
> 
> Judging from fs/xattr.c it looks as though security.capability also has
> a defined format that's parsed by security/commoncap.c...

Huh.  Ok.  That worked on my SLE12 SP3 host (4.4.x) but now that I test
it on a 5.0-rc, I get EINVAL too.  It looks like prior to v3 caps
(v4.14), validation only happened when they were loaded as part of
prepare_binprm.

-Jeff

-- 
Jeff Mahoney
SUSE Labs

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux