All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Salyzyn <salyzyn@android.com>
To: linux-kernel@vger.kernel.org
Cc: kernel-team@android.com, Mark Salyzyn <salyzyn@android.com>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Jonathan Corbet <corbet@lwn.net>, Vivek Goyal <vgoyal@redhat.com>,
	"Eric W . Biederman" <ebiederm@xmission.com>,
	Amir Goldstein <amir73il@gmail.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	linux-unionfs@vger.kernel.org, linux-doc@vger.kernel.org
Subject: [PATCH v14 2/5] overlayfs: check CAP_DAC_READ_SEARCH before issuing exportfs_decode_fh
Date: Tue, 22 Oct 2019 13:44:47 -0700	[thread overview]
Message-ID: <20191022204453.97058-3-salyzyn@android.com> (raw)
In-Reply-To: <20191022204453.97058-1-salyzyn@android.com>

Assumption never checked, should fail if the mounter creds are not
sufficient.

Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Amir Goldstein <amir73il@gmail.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: linux-unionfs@vger.kernel.org
Cc: linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: kernel-team@android.com

---
v11 + v12 +v13 + v14 - rebase

v10:
- return NULL rather than ERR_PTR(-EPERM)
- did _not_ add it ovl_can_decode_fh() because of changes since last
  review, suspect needs to be added to ovl_lower_uuid_ok()?

v8 + v9:
- rebase

v7:
- This time for realz

v6:
- rebase

v5:
- dependency of "overlayfs: override_creds=off option bypass creator_cred"

---
 fs/overlayfs/namei.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index e9717c2f7d45..9702f0d5309d 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -161,6 +161,9 @@ struct dentry *ovl_decode_real_fh(struct ovl_fh *fh, struct vfsmount *mnt,
 	if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid))
 		return NULL;
 
+	if (!capable(CAP_DAC_READ_SEARCH))
+		return NULL;
+
 	bytes = (fh->len - offsetof(struct ovl_fh, fid));
 	real = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
 				  bytes >> 2, (int)fh->type,
-- 
2.23.0.866.gb869b98d4c-goog


  parent reply	other threads:[~2019-10-22 20:46 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 20:44 [PATCH v14 0/5] overlayfs override_creds=off & nested get xattr fix Mark Salyzyn
2019-10-22 20:44 ` [PATCH v14 1/5] Add flags option to get xattr method paired to __vfs_getxattr Mark Salyzyn
2019-10-22 20:44   ` Mark Salyzyn
2019-10-22 20:44   ` Mark Salyzyn
2019-10-22 20:44   ` [f2fs-dev] " Mark Salyzyn via Linux-f2fs-devel
2019-10-22 20:44   ` Mark Salyzyn via Linux-erofs
2019-10-22 20:44   ` [Cluster-devel] " Mark Salyzyn
2019-10-22 22:13   ` Andreas Dilger
2019-10-22 22:13     ` Andreas Dilger
2019-10-22 22:13     ` [Ocfs2-devel] " Andreas Dilger
2019-10-22 22:13     ` Andreas Dilger
2019-10-22 22:13     ` Andreas Dilger
2019-10-22 22:13     ` [Cluster-devel] " Andreas Dilger
2019-10-24  4:57     ` Amir Goldstein
2019-11-04 21:51       ` Mark Salyzyn
2019-10-25  4:39   ` e984eb5108: BUG:kernel_NULL_pointer_dereference,address kernel test robot
2019-10-25  4:39     ` kernel test robot
2019-10-25  4:39     ` kernel test robot
2019-10-25  4:39     ` kernel test robot
2019-10-25  4:39     ` kernel test robot
2019-10-25  4:39     ` [Cluster-devel] e984eb5108: BUG:kernel_NULL_pointer_dereference, address kernel test robot
2019-10-22 20:44 ` Mark Salyzyn [this message]
2019-10-23  6:17   ` [PATCH v14 2/5] overlayfs: check CAP_DAC_READ_SEARCH before issuing exportfs_decode_fh Amir Goldstein
2019-10-23  8:08   ` Miklos Szeredi
2019-10-27  7:24     ` Amir Goldstein
2019-10-28 16:27       ` J. Bruce Fields
2019-10-22 20:44 ` [PATCH v14 3/5] overlayfs: handle XATTR_NOSECURITY flag for get xattr method Mark Salyzyn
2019-10-22 20:44 ` [PATCH v14 4/5] overlayfs: internal getxattr operations without sepolicy checking Mark Salyzyn
2019-10-23  6:39   ` Amir Goldstein
2019-11-04 21:47     ` Mark Salyzyn
2019-10-22 20:44 ` [PATCH v14 5/5] overlayfs: override_creds=off option bypass creator_cred Mark Salyzyn
2019-10-23  6:54 ` [PATCH v14 0/5] overlayfs override_creds=off & nested get xattr fix Amir Goldstein
2019-10-23 14:13   ` Mark Salyzyn
2019-10-24  5:28     ` Amir Goldstein

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=20191022204453.97058-3-salyzyn@android.com \
    --to=salyzyn@android.com \
    --cc=amir73il@gmail.com \
    --cc=corbet@lwn.net \
    --cc=ebiederm@xmission.com \
    --cc=kernel-team@android.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=rdunlap@infradead.org \
    --cc=sds@tycho.nsa.gov \
    --cc=vgoyal@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.