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] [day] [month] [year] [list]
Message-ID: <85b502ee-d20e-d3c4-eb6e-cff40c079a8d@tu-dortmund.de>
Date:   Fri, 8 Mar 2019 16:10:20 +0100
From:   Alexander Lochmann <alexander.lochmann@...dortmund.de>
To:     Al Viro <viro@...iv.linux.org.uk>
Cc:     Jan Kara <jack@...e.cz>, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Horst Schirmeier <horst.schirmeier@...dortmund.de>
Subject: Re: [PATCH] Abort file_remove_privs() for non-reg. files

Hello Al,

Meanwhile, have you had the opportunity to review our patch?

Regards,
Alex

On 11.01.19 16:42, Alexander Lochmann wrote:
> Hello Al,
> 
> Have you had the opportunity to review our patch?
> 
> Cheers,
> Alex
> 
> On 17.12.18 09:28, Jan Kara wrote:
>> On Fri 14-12-18 11:55:52, Alexander Lochmann wrote:
>>>
>>> file_remove_privs() might be called for non-regular files, e.g.
>>> blkdev inode. There is no reason to do its job on things
>>> like blkdev inodes, pipes, or cdevs. Hence, abort if
>>> file does not refer to a regular inode.
>>> The following stacktrace shows how to get there:
>>> 13: entry_SYSENTER_32:460
>>> 12: do_fast_syscall_32:410
>>> 11: _static_cpu_has:146
>>> 10: do_syscall_32_irqs_on:322
>>> 09: SyS_pwrite64:636
>>> 08: SYSC_pwrite64:650
>>> 07: fdput:38
>>> 06: vfs_write:560
>>> 05: __vfs_write:512
>>> 04: new_sync_write:500
>>> 03: blkdev_write_iter:1977
>>> 02: __generic_file_write_iter:2897
>>> 01: file_remove_privs:1818
>>> 00: inode_has_no_xattr:3163
>>>
>>> Found by LockDoc (Alexander Lochmann, Horst Schirmeier and Olaf
>>> Spinczyk)
>>>
>>> Signed-off-by: Alexander Lochmann <alexander.lochmann@...dortmund.de>
>>> Signed-off-by: Horst Schirmeier <horst.schirmeier@...dortmund.de>
>>
>> The patch looks good to me. You can add:
>>
>> Reviewed-by: Jan Kara <jack@...e.cz>
>>
>> 								Honza
>>
>>> ---
>>>  fs/inode.c | 9 +++++++--
>>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/inode.c b/fs/inode.c
>>> index 35d2108d567c..682088190413 100644
>>> --- a/fs/inode.c
>>> +++ b/fs/inode.c
>>> @@ -1820,8 +1820,13 @@ int file_remove_privs(struct file *file)
>>>  	int kill;
>>>  	int error = 0;
>>>
>>> -	/* Fast path for nothing security related */
>>> -	if (IS_NOSEC(inode))
>>> +	/*
>>> +	 * Fast path for nothing security related.
>>> +	 * As well for non-regular files, e.g. blkdev inodes.
>>> +	 * For example, blkdev_write_iter() might get here
>>> +	 * trying to remove privs which it is not allowed to.
>>> +	 */
>>> +	if (IS_NOSEC(inode) || !S_ISREG(inode->i_mode))
>>>  		return 0;
>>>
>>>  	kill = dentry_needs_remove_privs(dentry);
>>> -- 
>>> 2.19.2
>>>
>>
>>
>>
> 

-- 
Technische Universität Dortmund
Alexander Lochmann                PGP key: 0xBC3EF6FD
Otto-Hahn-Str. 16                 phone:  +49.231.7556141
D-44227 Dortmund                  fax:    +49.231.7556116
http://ess.cs.tu-dortmund.de/Staff/al



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