From: Christian Brauner <brauner@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>, Jeff Layton <jlayton@kernel.org>
Cc: Christian Brauner <brauner@kernel.org>,
Erin Shepherd <erin.shepherd@e43.eu>,
Chuck Lever <chuck.lever@oracle.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-nfs@vger.kernel.org
Subject: [PATCH 3/4] ovl: restrict to exportable file handles
Date: Sun, 1 Dec 2024 14:12:27 +0100 [thread overview]
Message-ID: <20241201-work-exportfs-v1-3-b850dda4502a@kernel.org> (raw)
In-Reply-To: <20241201-work-exportfs-v1-0-b850dda4502a@kernel.org>
Ensure that overlayfs only allows decoding exportable file handles.
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
fs/overlayfs/util.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 9aa7493b1e10365cbcc97fceab26d614a319727f..b498c74084f3950d8e4d9f63a804d1abe08258fc 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -83,10 +83,15 @@ void ovl_revert_creds(const struct cred *old_cred)
*/
int ovl_can_decode_fh(struct super_block *sb)
{
+ const struct export_operations *nop = sb->s_export_op;
+
if (!capable(CAP_DAC_READ_SEARCH))
return 0;
- if (!exportfs_can_decode_fh(sb->s_export_op))
+ if (!exportfs_can_decode_fh(nop))
+ return 0;
+
+ if (nop && nop->flags & EXPORT_OP_LOCAL_FILE_HANDLE)
return 0;
return sb->s_export_op->encode_fh ? -1 : FILEID_INO32_GEN;
--
2.45.2
next prev parent reply other threads:[~2024-12-01 13:13 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-01 13:12 [PATCH 0/4] exportfs: add flag to allow marking export operations as only supporting file handles Christian Brauner
2024-12-01 13:12 ` [PATCH 1/4] exportfs: add flag to indicate local " Christian Brauner
2024-12-01 13:44 ` Amir Goldstein
2024-12-01 23:12 ` Dave Chinner
2024-12-02 9:19 ` Christian Brauner
2024-12-01 13:12 ` [PATCH 2/4] kernfs: restrict to " Christian Brauner
2024-12-01 13:12 ` Christian Brauner [this message]
2024-12-01 13:12 ` [PATCH 4/4] pidfs: " Christian Brauner
2024-12-01 13:28 ` [PATCH 0/4] exportfs: add flag to allow marking export operations as only supporting " Jeff Layton
2024-12-01 16:22 ` Chuck Lever III
2024-12-03 9:08 ` Christian Brauner
2024-12-03 14:32 ` Jeff Layton
2024-12-01 13:44 ` Amir Goldstein
2024-12-05 0:38 ` Christoph Hellwig
2024-12-05 10:53 ` Christian Brauner
2024-12-05 11:57 ` Amir Goldstein
2024-12-06 16:03 ` Darrick J. Wong
2024-12-07 8:49 ` Amir Goldstein
2024-12-09 7:49 ` Christoph Hellwig
2024-12-09 8:58 ` Amir Goldstein
2024-12-09 9:16 ` Greg KH
2024-12-09 10:02 ` Amir Goldstein
2024-12-09 13:45 ` Christoph Hellwig
2024-12-09 13:46 ` Christoph Hellwig
2024-12-09 16:30 ` Amir Goldstein
2024-12-09 16:35 ` Chuck Lever
2024-12-09 17:15 ` Jeff Layton
2024-12-09 17:20 ` Chuck Lever
2024-12-10 10:13 ` Christian Brauner
2024-12-10 10:34 ` Christian Brauner
2024-12-10 11:10 ` Christoph Hellwig
2024-12-10 12:44 ` Jeff Layton
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=20241201-work-exportfs-v1-3-b850dda4502a@kernel.org \
--to=brauner@kernel.org \
--cc=amir73il@gmail.com \
--cc=chuck.lever@oracle.com \
--cc=erin.shepherd@e43.eu \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@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