From: Alexander Lochmann <alexander.lochmann@tu-dortmund.de>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Horst Schirmeier <horst.schirmeier@tu-dortmund.de>
Subject: Re: [PATCH] Abort file_remove_privs() for non-reg. files
Date: Fri, 8 Mar 2019 16:10:20 +0100 [thread overview]
Message-ID: <85b502ee-d20e-d3c4-eb6e-cff40c079a8d@tu-dortmund.de> (raw)
In-Reply-To: <3273d690-488f-b13c-5988-f600c4f83192@tu-dortmund.de>
[-- Attachment #1.1: Type: text/plain, Size: 2494 bytes --]
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@tu-dortmund.de>
>>> Signed-off-by: Horst Schirmeier <horst.schirmeier@tu-dortmund.de>
>>
>> The patch looks good to me. You can add:
>>
>> Reviewed-by: Jan Kara <jack@suse.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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2019-03-08 15:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-07 16:10 [PATCH] Fix sync. in blkdev_write_iter() acessing i_flags Alexander Lochmann
2018-12-07 17:58 ` Al Viro
2018-12-07 19:49 ` Alexander Lochmann
2018-12-08 0:49 ` Al Viro
2018-12-10 9:47 ` Jan Kara
2018-12-14 10:55 ` [PATCH] Abort file_remove_privs() for non-reg. files Alexander Lochmann
2018-12-17 8:28 ` Jan Kara
2019-01-11 15:42 ` Alexander Lochmann
2019-03-08 15:10 ` Alexander Lochmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85b502ee-d20e-d3c4-eb6e-cff40c079a8d@tu-dortmund.de \
--to=alexander.lochmann@tu-dortmund.de \
--cc=horst.schirmeier@tu-dortmund.de \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®