From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE3CDC3A5A3 for ; Tue, 27 Aug 2019 17:06:59 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D5BE2173E; Tue, 27 Aug 2019 17:06:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="VCFpj9Sb"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="DDRfx/qG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D5BE2173E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1i2evq-0005vO-J4; Tue, 27 Aug 2019 17:06:58 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1i2evn-0005v0-GU; Tue, 27 Aug 2019 17:06:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=CwBwJQptCuHABBiHqWjHEuVRxpHn6ZdzRWug18r3P1A=; b=VCFpj9Sbe9j6XlPljjQqyhwWWc Lfyo4G7aLlzOr34Y+rxxEMBuGUInj8E4DjeNwwZUrzu41Yc6kW+sGDZOX/LOXRR4Y0wORV87TJbpH eLLLf1M70SN04402e6TYd3SLDOGXg1Jdtxv7m0QZxcbEfq1isEocuSIYbQeBT47gOL0w=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To:Message-ID: Subject:Cc:To:From:Date:Sender:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CwBwJQptCuHABBiHqWjHEuVRxpHn6ZdzRWug18r3P1A=; b=DDRfx/qGYEOUMjJHyFt+wLNWtC ZO8D40bqTFJodW2bjZMPqTJuXlbYtQIv4Osnv68ouSB5uAETb1tPEXnEXr7QAKZ7MoK1iw9aXYgCA kGueHiPY0R9lCWz77i11JUis6Tj/7BcVCebN+r+OxnFSSWQ78eZid5qnbJ4OLXbqntjc=; Received: from mx2.suse.de ([195.135.220.15] helo=mx1.suse.de) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1i2evl-000Mj3-JP; Tue, 27 Aug 2019 17:06:55 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6C032B03C; Tue, 27 Aug 2019 17:06:41 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id D57F2DA809; Tue, 27 Aug 2019 19:07:00 +0200 (CEST) Date: Tue, 27 Aug 2019 19:07:00 +0200 From: David Sterba To: Mark Salyzyn Message-ID: <20190827170700.GW2752@suse.cz> Mail-Followup-To: dsterba@suse.cz, Mark Salyzyn , linux-kernel@vger.kernel.org, kernel-team@android.com, Tyler Hicks , Dominique Martinet , "David S. Miller" , Mathieu Malaterre , Andreas Dilger , devel@driverdev.osuosl.org, Vyacheslav Dubeyko , Joel Becker , Mark Fasheh , Chris Mason , Artem Bityutskiy , Eric Van Hensbergen , Ilya Dryomov , Bharath Vedartham , Eric Biggers , Hugh Dickins , Jann Horn , Serge Hallyn , Trond Myklebust , Gao Xiang , Chao Yu , David Woodhouse , Adrian Hunter , Latchesar Ionkov , Jaegeuk Kim , Jeff Layton , Dave Kleikamp , Tejun Heo , linux-mm@kvack.org, Andrew Morton , Joseph Qi , Mimi Zohar , Greg Kroah-Hartman , linux-afs@lists.infradead.org, linux-mtd@lists.infradead.org, devel@lists.orangefs.org, linux-erofs@lists.ozlabs.org, samba-technical@lists.samba.org, jfs-discussion@lists.sourceforge.net, linux-f2fs-devel@lists.sourceforge.net, v9fs-developer@lists.sourceforge.net, Jonathan Corbet , Theodore Ts'o , James Morris , Anna Schumaker , Richard Weinberger , Mike Marshall , Martin Brandenburg , Allison Henderson , "Darrick J. Wong" , ocfs2-devel@oss.oracle.com, Eric Paris , Paul Moore , Andreas Gruenbacher , Benjamin Coddington , "J. Bruce Fields" , Brian Foster , cluster-devel@redhat.com, Dave Chinner , David Howells , Bob Peterson , Sage Weil , Steve French , Eric Sandeen , Casey Schaufler , Phillip Lougher , David Sterba , Jan Kara , Jan Kara , Miklos Szeredi , Josef Bacik , Stephen Smalley , ceph-devel@vger.kernel.org, ecryptfs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-doc@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-nfs@vger.kernel.org, linux-security-module@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org, netdev@vger.kernel.org, reiserfs-devel@vger.kernel.org, selinux@vger.kernel.org, stable@vger.kernel.org, Alexander Viro References: <20190827150544.151031-1-salyzyn@android.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190827150544.151031-1-salyzyn@android.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) X-Headers-End: 1i2evl-000Mj3-JP Subject: Re: [f2fs-dev] [PATCH v8] Add flags option to get xattr method paired to __vfs_getxattr X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: dsterba@suse.cz Cc: Latchesar Ionkov , Eric Sandeen , Mike Marshall , James Morris , devel@lists.orangefs.org, Eric Van Hensbergen , Joel Becker , Trond Myklebust , Mathieu Malaterre , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Jan Kara , Casey Schaufler , Andrew Morton , Dave Kleikamp , linux-doc@vger.kernel.org, Jeff Layton , Mimi Zohar , "David S. Miller" , linux-cifs@vger.kernel.org, Paul Moore , "Darrick J. Wong" , Hugh Dickins , kernel-team@android.com, selinux@vger.kernel.org, Brian Foster , reiserfs-devel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jaegeuk Kim , Theodore Ts'o , Miklos Szeredi , linux-f2fs-devel@lists.sourceforge.net, Benjamin Coddington , linux-integrity@vger.kernel.org, Martin Brandenburg , Chris Mason , linux-mtd@lists.infradead.org, linux-afs@lists.infradead.org, Jonathan Corbet , Vyacheslav Dubeyko , Allison Henderson , Ilya Dryomov , linux-ext4@vger.kernel.org, Stephen Smalley , Serge Hallyn , Eric Paris , ceph-devel@vger.kernel.org, linux-nfs@vger.kernel.org, Joseph Qi , samba-technical@lists.samba.org, linux-xfs@vger.kernel.org, Bob Peterson , Tejun Heo , linux-erofs@lists.ozlabs.org, Anna Schumaker , ocfs2-devel@oss.oracle.com, jfs-discussion@lists.sourceforge.net, Jan Kara , Eric Biggers , Dominique Martinet , linux-unionfs@vger.kernel.org, David Howells , linux-mm@kvack.org, Andreas Dilger , devel@driverdev.osuosl.org, "J. Bruce Fields" , Andreas Gruenbacher , Sage Weil , Richard Weinberger , Mark Fasheh , cluster-devel@redhat.com, Steve French , v9fs-developer@lists.sourceforge.net, Bharath Vedartham , Jann Horn , ecryptfs@vger.kernel.org, Josef Bacik , Dave Chinner , David Sterba , Artem Bityutskiy , netdev@vger.kernel.org, Adrian Hunter , stable@vger.kernel.org, Tyler Hicks , linux-security-module@vger.kernel.org, Phillip Lougher , David Woodhouse , linux-btrfs@vger.kernel.org, Alexander Viro Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Tue, Aug 27, 2019 at 08:05:15AM -0700, Mark Salyzyn wrote: > Replace arguments for get and set xattr methods, and __vfs_getxattr > and __vfs_setaxtr functions with a reference to the following now > common argument structure: > > struct xattr_gs_args { > struct dentry *dentry; > struct inode *inode; > const char *name; > union { > void *buffer; > const void *value; > }; > size_t size; > int flags; > }; > > Which in effect adds a flags option to the get method and > __vfs_getxattr function. > > Add a flag option to get xattr method that has bit flag of > XATTR_NOSECURITY passed to it. XATTR_NOSECURITY is generally then > set in the __vfs_getxattr path when called by security > infrastructure. > > This handles the case of a union filesystem driver that is being > requested by the security layer to report back the xattr data. > > For the use case where access is to be blocked by the security layer. > > The path then could be security(dentry) -> > __vfs_getxattr({dentry...XATTR_NOSECURITY}) -> > handler->get({dentry...XATTR_NOSECURITY}) -> > __vfs_getxattr({lower_dentry...XATTR_NOSECURITY}) -> > lower_handler->get({lower_dentry...XATTR_NOSECURITY}) > which would report back through the chain data and success as > expected, the logging security layer at the top would have the > data to determine the access permissions and report back the target > context that was blocked. > > Without the get handler flag, the path on a union filesystem would be > the errant security(dentry) -> __vfs_getxattr(dentry) -> > handler->get(dentry) -> vfs_getxattr(lower_dentry) -> nested -> > security(lower_dentry, log off) -> lower_handler->get(lower_dentry) > which would report back through the chain no data, and -EACCES. > > For selinux for both cases, this would translate to a correctly > determined blocked access. In the first case with this change a correct avc > log would be reported, in the second legacy case an incorrect avc log > would be reported against an uninitialized u:object_r:unlabeled:s0 > context making the logs cosmetically useless for audit2allow. > > This patch series is inert and is the wide-spread addition of the > flags option for xattr functions, and a replacement of __vfs_getxattr > with __vfs_getxattr({...XATTR_NOSECURITY}). > > Signed-off-by: Mark Salyzyn > Reviewed-by: Jan Kara > Cc: Stephen Smalley > Cc: linux-kernel@vger.kernel.org > Cc: kernel-team@android.com > Cc: linux-security-module@vger.kernel.org > Cc: stable@vger.kernel.org # 4.4, 4.9, 4.14 & 4.19 > --- > v8: > - Documentation reported 'struct xattr_gs_flags' rather than > 'struct xattr_gs_flags *args' as argument to get and set methods. For btrfs > fs/btrfs/xattr.c | 36 +++++----- Acked-by: David Sterba _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel