linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Alexander Lochmann <alexander.lochmann@tu-dortmund.de>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jan Kara <jack@suse.cz>,
	Horst Schirmeier <horst.schirmeier@tu-dortmund.de>
Subject: Re: [PATCH] Fix sync. in blkdev_write_iter() acessing i_flags
Date: Fri, 7 Dec 2018 17:58:12 +0000	[thread overview]
Message-ID: <20181207175811.GZ2217@ZenIV.linux.org.uk> (raw)
In-Reply-To: <4903939e-d3d6-b0c2-9c33-0fea0a61213c@tu-dortmund.de>

On Fri, Dec 07, 2018 at 05:10:15PM +0100, Alexander Lochmann wrote:
> 
> inode.i_flags might be altered without proper
> synchronisation when the inode belongs to devtmpfs.
> blkdev_write_iter() starts writing via __generic_file_write_iter()
> which sets S_NOSEC bit without any synchronisation.
> 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
> If S_NOSEC is *not* set, i_rwsem is acquired around
> __generic_file_write_iter().

> +	 * Ensure excl. access to i_flags in __generic_file_write_iter().
> +	 * Otherwise, it would race with chmod adding SUID bit.
> +	 */

_What_ SUID bit?  We are talking about a write to block device, for fsck sake...

  reply	other threads:[~2018-12-07 17:58 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 [this message]
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

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=20181207175811.GZ2217@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=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 \
    /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;
as well as URLs for NNTP newsgroup(s).