Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1209313imu; Fri, 7 Dec 2018 16:52:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/XSCdKxIk07kBL2a+tVsgn48dPX1tUQAfFgRFLv8SUHoXTBMgjjLciz4luSV/ATmjlQ/B3/ X-Received: by 2002:a62:8add:: with SMTP id o90mr4271197pfk.210.1544230329121; Fri, 07 Dec 2018 16:52:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544230329; cv=none; d=google.com; s=arc-20160816; b=WNmi1I+1VBXQSOOHhPSysRTcMyg5W02P8nqDciYqKYd0iOFd02Fl/UVhFiKYNmri0w 5hGH6WECoaP3EN7xUNPAqYq3qJIOIpdxweJy09Hw8nSTAWRPHkSkZZUin9vbPT6T4e45 m8pv6WWMQY8g3iE/smASmVjJ/WzTRj+XPeDZWxDKQrlprCmBGekr5AMwsQHt8Xx6rFHI 5jfbJjvAbBPW6gVcdW7UxiIdIGG5zDTMk+7KCweHLpxNVnw9kWppipF1fwSAGsUeDR7D jo4VITMJX3HQlbRrfZFhS02macDpVXkXsmsbMvv98xk+Hmnp+i67cqFAooYID6RrSWyM 06Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9DunlPyWItkfgv+psiS2weAQszG2YmyBdYUmwsVU1EU=; b=z11IjpoE2/PKR/GdKE+6KH86jotEQSKSAiFPp5AKU5YSOC7P3vS5s3uOqzvfCCd0Q4 VZvm6a3uKPzil38TcK5h/B2sJ1seBqIOiyb6Sa0rD7rXuyXRwDoe+eegFTfcJ9pRqNKO vtTGAg19ascw9l62yC/kn55TGEVQhqFQo+kEFg3lnXox3gCX5Xj58HQEaK2pn/XU5LCe Uyi26RNSVVbRBEqAGriCYFsly8Sklm0QaXpjD4oncJJOEoYh2sxjK+aBE5OXYeUCdwmk 9nePtag5mVovwFG0+8N5VqWlxS9HK2Zrb8VzORuBHT078xrJ828t/gUx5vy1GA4IJZOB EgDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k35si4057023pgm.225.2018.12.07.16.51.53; Fri, 07 Dec 2018 16:52:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726153AbeLHAts (ORCPT + 99 others); Fri, 7 Dec 2018 19:49:48 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:36736 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726041AbeLHAts (ORCPT ); Fri, 7 Dec 2018 19:49:48 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.91 #2 (Red Hat Linux)) id 1gVQoS-0001mX-W8; Sat, 08 Dec 2018 00:49:45 +0000 Date: Sat, 8 Dec 2018 00:49:44 +0000 From: Al Viro To: Alexander Lochmann Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Horst Schirmeier Subject: Re: [PATCH] Fix sync. in blkdev_write_iter() acessing i_flags Message-ID: <20181208004944.GA2217@ZenIV.linux.org.uk> References: <4903939e-d3d6-b0c2-9c33-0fea0a61213c@tu-dortmund.de> <20181207175811.GZ2217@ZenIV.linux.org.uk> <5c86e85f-0ad4-935a-3021-7046551f361f@tu-dortmund.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5c86e85f-0ad4-935a-3021-7046551f361f@tu-dortmund.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 07, 2018 at 08:49:16PM +0100, Alexander Lochmann wrote: > > _What_ SUID bit? We are talking about a write to block device, for fsck sake... > > > That's the way I understood Jan's explanation: > " > Thinking more about this I'm not sure if this is actually the right > solution. Because for example the write(2) can set S_NOSEC flag wrongly > when it would race with chmod adding SUID bit. So probably we rather need > to acquire i_rwsem in blkdev_write_iter() if file does not have S_NOSEC set > (we don't want to acquire it unconditionally as that would heavily impact > scalability of block device writes). IDGI. We are talking about a block device here. What business could file_remove_privs() have doing _anything_ to it? should_remove_suid() returns to return 0 for those; what case do you have in mind? Somebody setting security.capabilities on a block device inode? IMO the bug here is file_remove_privs() not buggering off immediately after having observed that we are dealing with a block device. It really has nothing useful to do.