From: David Sterba <dsterba@suse.cz>
To: Mark Salyzyn <salyzyn@android.com>
Cc: Latchesar Ionkov <lucho@ionkov.net>,
Eric Sandeen <sandeen@sandeen.net>,
Mike Marshall <hubcap@omnibond.com>,
James Morris <jmorris@namei.org>,
devel@lists.orangefs.org, Eric Van Hensbergen <ericvh@gmail.com>,
Joel Becker <jlbec@evilplan.org>,
Trond Myklebust <trond.myklebust@hammerspace.com>,
Mathieu Malaterre <malat@debian.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, Jan Kara <jack@suse.com>,
Casey Schaufler <casey@schaufler-ca.com>,
Andrew Morton <akpm@linux-foundation.org>,
Dave Kleikamp <shaggy@kernel.org>,
linux-doc@vger.kernel.org, Jeff Layton <jlayton@kernel.org>,
Chao Yu <yuchao0@huawei.com>, Mimi Zohar <zohar@linux.ibm.com>,
"David S. Miller" <davem@davemloft.net>,
linux-cifs@vger.kernel.org, Paul Moore <paul@paul-moore.com>,
"Darrick J. Wong" <darrick.wong@oracle.com>,
Hugh Dickins <hughd@google.com>,
kernel-team@android
Subject: Re: [PATCH v8] Add flags option to get xattr method paired to __vfs_getxattr
Date: Tue, 27 Aug 2019 19:07:00 +0200 [thread overview]
Message-ID: <20190827170700.GW2752@suse.cz> (raw)
In-Reply-To: <20190827150544.151031-1-salyzyn@android.com>
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 <salyzyn@android.com>
> Reviewed-by: Jan Kara <jack@suse.cz>
> Cc: Stephen Smalley <sds@tycho.nsa.gov>
> 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 <dsterba@suse.com>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2019-08-27 17:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 15:05 [PATCH v8] Add flags option to get xattr method paired to __vfs_getxattr Mark Salyzyn via Linux-f2fs-devel
2019-08-27 15:49 ` Jeff Layton
2019-08-27 17:07 ` David Sterba [this message]
2019-08-27 21:35 ` Darrick J. Wong
2019-08-28 14:24 ` Christoph Hellwig
2019-08-28 14:40 ` Mark Salyzyn via Linux-f2fs-devel
2019-08-30 1:24 ` Mike Marshall
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=20190827170700.GW2752@suse.cz \
--to=dsterba@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=casey@schaufler-ca.com \
--cc=darrick.wong@oracle.com \
--cc=davem@davemloft.net \
--cc=devel@lists.orangefs.org \
--cc=ericvh@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hubcap@omnibond.com \
--cc=hughd@google.com \
--cc=jack@suse.com \
--cc=jlayton@kernel.org \
--cc=jlbec@evilplan.org \
--cc=jmorris@namei.org \
--cc=kernel-team@android \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucho@ionkov.net \
--cc=malat@debian.org \
--cc=paul@paul-moore.com \
--cc=salyzyn@android.com \
--cc=sandeen@sandeen.net \
--cc=shaggy@kernel.org \
--cc=trond.myklebust@hammerspace.com \
--cc=yuchao0@huawei.com \
--cc=zohar@linux.ibm.com \
/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).