Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [RFC PATCH] btrfs: drop file privileges in btrfs_clone_files
@ 2018-11-28  3:07 Lu Fengqi
  2018-11-28  7:44 ` Nikolay Borisov
  0 siblings, 1 reply; 6+ messages in thread
From: Lu Fengqi @ 2018-11-28  3:07 UTC (permalink / raw)
  To: linux-btrfs

The generic/513 tell that cloning into a file did not strip security
privileges (suid, capabilities) like a regular write would.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
The xfs and ocfs2 call generic_remap_file_range_prep to drop file
privileges, I'm not sure whether btrfs should do the same thing.

Any suggestion?

 fs/btrfs/ioctl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 410c7e007ba8..bc33c480603b 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4312,6 +4312,10 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src,
 			goto out_unlock;
 	}
 
+	ret = file_remove_privs(file);
+	if (ret)
+		goto out_unlock;
+
 	if (destoff > inode->i_size) {
 		ret = btrfs_cont_expand(inode, inode->i_size, destoff);
 		if (ret)
-- 
2.19.2




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-28 10:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-28  3:07 [RFC PATCH] btrfs: drop file privileges in btrfs_clone_files Lu Fengqi
2018-11-28  7:44 ` Nikolay Borisov
2018-11-28  7:46   ` Christoph Hellwig
2018-11-28  7:48     ` Nikolay Borisov
2018-11-28  9:24       ` Lu Fengqi
2018-11-28 10:34         ` Filipe Manana

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox