linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the fsverity tree with the f2fs tree
@ 2019-07-31  0:47 Stephen Rothwell
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Rothwell @ 2019-07-31  0:47 UTC (permalink / raw)
  To: Eric Biggers, Theodore Y. Ts'o, Jaegeuk Kim
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Daniel Rosenberg, Chao Yu

[-- Attachment #1: Type: text/plain, Size: 5586 bytes --]

Hi all,

Today's linux-next merge of the fsverity tree got conflicts in:

  fs/f2fs/file.c
  fs/f2fs/inode.c

between commits:

  cf3dbe1481d1 ("f2fs: support FS_IOC_{GET,SET}FSLABEL")
  01ff2b3740a6 ("f2fs: Support case-insensitive file name lookups")

from the f2fs tree and commit:

  60d7bf0f790f ("f2fs: add fs-verity support")

from the fsverity tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/f2fs/file.c
index eb1aa9b75eda,838bfeecbd86..000000000000
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@@ -1721,7 -1721,7 +1729,8 @@@ static const struct 
  		FS_ENCRYPT_FL |		\
  		FS_INLINE_DATA_FL |	\
  		FS_NOCOW_FL |		\
- 		FS_CASEFOLD_FL)
++		FS_CASEFOLD_FL |	\
+ 		FS_VERITY_FL)
  
  #define F2FS_SETTABLE_FS_FL (		\
  		FS_SYNC_FL |		\
@@@ -3080,86 -3088,34 +3091,110 @@@ static int f2fs_ioc_resize_fs(struct fi
  	return ret;
  }
  
 +static int f2fs_get_volume_name(struct file *filp, unsigned long arg)
 +{
 +	struct inode *inode = file_inode(filp);
 +	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 +	char *vbuf;
 +	int count;
 +	int err = 0;
 +
 +	vbuf = f2fs_kzalloc(sbi, MAX_VOLUME_NAME, GFP_KERNEL);
 +	if (!vbuf)
 +		return -ENOMEM;
 +
 +	down_read(&sbi->sb_lock);
 +	count = utf16s_to_utf8s(sbi->raw_super->volume_name,
 +			sizeof(sbi->raw_super->volume_name),
 +			UTF16_LITTLE_ENDIAN, vbuf, MAX_VOLUME_NAME);
 +	up_read(&sbi->sb_lock);
 +
 +	if (copy_to_user((char __user *)arg, vbuf,
 +				min(FSLABEL_MAX, count)))
 +		err = -EFAULT;
 +
 +	kvfree(vbuf);
 +	return err;
 +}
 +
 +static int f2fs_set_volume_name(struct file *filp, unsigned long arg)
 +{
 +	struct inode *inode = file_inode(filp);
 +	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 +	char *vbuf;
 +	int len;
 +	int err = 0;
 +
 +	vbuf = f2fs_kzalloc(sbi, MAX_VOLUME_NAME, GFP_KERNEL);
 +	if (!vbuf)
 +		return -ENOMEM;
 +
 +	if (copy_from_user(vbuf, (char __user *)arg, FSLABEL_MAX)) {
 +		err = -EFAULT;
 +		goto out;
 +	}
 +
 +	len = strnlen(vbuf, FSLABEL_MAX);
 +	if (len > FSLABEL_MAX - 1) {
 +		err = -EINVAL;
 +		goto out;
 +	}
 +
 +	err = mnt_want_write_file(filp);
 +	if (err)
 +		goto out;
 +
 +	down_write(&sbi->sb_lock);
 +
 +	memset(sbi->raw_super->volume_name, 0,
 +			sizeof(sbi->raw_super->volume_name));
 +	utf8s_to_utf16s(vbuf, MAX_VOLUME_NAME, UTF16_LITTLE_ENDIAN,
 +			sbi->raw_super->volume_name,
 +			sizeof(sbi->raw_super->volume_name));
 +
 +	err = f2fs_commit_super(sbi, false);
 +
 +	up_write(&sbi->sb_lock);
 +
 +	mnt_drop_write_file(filp);
 +out:
 +	kvfree(vbuf);
 +	return err;
 +}
 +
+ static int f2fs_ioc_enable_verity(struct file *filp, unsigned long arg)
+ {
+ 	struct inode *inode = file_inode(filp);
+ 
+ 	f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
+ 
+ 	if (!f2fs_sb_has_verity(F2FS_I_SB(inode))) {
+ 		f2fs_warn(F2FS_I_SB(inode),
+ 			  "Can't enable fs-verity on inode %lu: the verity feature is not enabled on this filesystem.\n",
+ 			  inode->i_ino);
+ 		return -EOPNOTSUPP;
+ 	}
+ 
+ 	return fsverity_ioctl_enable(filp, (const void __user *)arg);
+ }
+ 
+ static int f2fs_ioc_measure_verity(struct file *filp, unsigned long arg)
+ {
+ 	if (!f2fs_sb_has_verity(F2FS_I_SB(file_inode(filp))))
+ 		return -EOPNOTSUPP;
+ 
+ 	return fsverity_ioctl_measure(filp, (void __user *)arg);
+ }
+ 
  long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
  {
 +	int ret;
 +
  	if (unlikely(f2fs_cp_error(F2FS_I_SB(file_inode(filp)))))
  		return -EIO;
 +	ret = f2fs_is_checkpoint_ready(F2FS_I_SB(file_inode(filp)));
 +	if (ret)
 +		return ret;
  
  	switch (cmd) {
  	case F2FS_IOC_GETFLAGS:
@@@ -3214,10 -3170,10 +3249,14 @@@
  		return f2fs_ioc_precache_extents(filp, arg);
  	case F2FS_IOC_RESIZE_FS:
  		return f2fs_ioc_resize_fs(filp, arg);
 +	case F2FS_IOC_GET_VOLUME_NAME:
 +		return f2fs_get_volume_name(filp, arg);
 +	case F2FS_IOC_SET_VOLUME_NAME:
 +		return f2fs_set_volume_name(filp, arg);
+ 	case FS_IOC_ENABLE_VERITY:
+ 		return f2fs_ioc_enable_verity(filp, arg);
+ 	case FS_IOC_MEASURE_VERITY:
+ 		return f2fs_ioc_measure_verity(filp, arg);
  	default:
  		return -ENOTTY;
  	}
@@@ -3332,8 -3288,8 +3371,10 @@@ long f2fs_compat_ioctl(struct file *fil
  	case F2FS_IOC_SET_PIN_FILE:
  	case F2FS_IOC_PRECACHE_EXTENTS:
  	case F2FS_IOC_RESIZE_FS:
 +	case F2FS_IOC_GET_VOLUME_NAME:
 +	case F2FS_IOC_SET_VOLUME_NAME:
+ 	case FS_IOC_ENABLE_VERITY:
+ 	case FS_IOC_MEASURE_VERITY:
  		break;
  	default:
  		return -ENOIOCTLCMD;
diff --cc fs/f2fs/inode.c
index 5d78f2db7a67,06da75d418e0..000000000000
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@@ -46,11 -46,11 +46,13 @@@ void f2fs_set_inode_flags(struct inode 
  		new_fl |= S_DIRSYNC;
  	if (file_is_encrypt(inode))
  		new_fl |= S_ENCRYPTED;
 +	if (flags & F2FS_CASEFOLD_FL)
 +		new_fl |= S_CASEFOLD;
+ 	if (file_is_verity(inode))
+ 		new_fl |= S_VERITY;
  	inode_set_flags(inode, new_fl,
  			S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|
- 			S_ENCRYPTED|S_CASEFOLD);
 -			S_ENCRYPTED|S_VERITY);
++			S_ENCRYPTED|S_CASEFOLD|S_VERITY);
  }
  
  static void __get_inode_rdev(struct inode *inode, struct f2fs_inode *ri)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* linux-next: manual merge of the fsverity tree with the f2fs tree
@ 2019-08-19  0:41 Stephen Rothwell
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Rothwell @ 2019-08-19  0:41 UTC (permalink / raw)
  To: Eric Biggers, Theodore Y. Ts'o, Jaegeuk Kim
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Daniel Rosenberg, Chao Yu

[-- Attachment #1: Type: text/plain, Size: 4740 bytes --]

Hi all,

Today's linux-next merge of the fsverity tree got a conflict in:

  fs/f2fs/file.c

between commits:

  d9a94abb3380 ("f2fs: support FS_IOC_{GET,SET}FSLABEL")
  546155f73637 ("f2fs: Support case-insensitive file name lookups")

from the f2fs tree and commit:

  95ae251fe828 ("f2fs: add fs-verity support")

from the fsverity tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/f2fs/file.c
index 32e2cf9d4b07,838bfeecbd86..000000000000
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@@ -1721,7 -1721,7 +1729,8 @@@ static const struct 
  		FS_ENCRYPT_FL |		\
  		FS_INLINE_DATA_FL |	\
  		FS_NOCOW_FL |		\
- 		FS_CASEFOLD_FL)
++		FS_CASEFOLD_FL |	\
+ 		FS_VERITY_FL)
  
  #define F2FS_SETTABLE_FS_FL (		\
  		FS_SYNC_FL |		\
@@@ -3125,77 -3088,34 +3136,101 @@@ static int f2fs_ioc_resize_fs(struct fi
  	return ret;
  }
  
 +static int f2fs_get_volume_name(struct file *filp, unsigned long arg)
 +{
 +	struct inode *inode = file_inode(filp);
 +	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 +	char *vbuf;
 +	int count;
 +	int err = 0;
 +
 +	vbuf = f2fs_kzalloc(sbi, MAX_VOLUME_NAME, GFP_KERNEL);
 +	if (!vbuf)
 +		return -ENOMEM;
 +
 +	down_read(&sbi->sb_lock);
 +	count = utf16s_to_utf8s(sbi->raw_super->volume_name,
 +			ARRAY_SIZE(sbi->raw_super->volume_name),
 +			UTF16_LITTLE_ENDIAN, vbuf, MAX_VOLUME_NAME);
 +	up_read(&sbi->sb_lock);
 +
 +	if (copy_to_user((char __user *)arg, vbuf,
 +				min(FSLABEL_MAX, count)))
 +		err = -EFAULT;
 +
 +	kvfree(vbuf);
 +	return err;
 +}
 +
 +static int f2fs_set_volume_name(struct file *filp, unsigned long arg)
 +{
 +	struct inode *inode = file_inode(filp);
 +	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 +	char *vbuf;
 +	int err = 0;
 +
 +	if (!capable(CAP_SYS_ADMIN))
 +		return -EPERM;
 +
 +	vbuf = strndup_user((const char __user *)arg, FSLABEL_MAX);
 +	if (IS_ERR(vbuf))
 +		return PTR_ERR(vbuf);
 +
 +	err = mnt_want_write_file(filp);
 +	if (err)
 +		goto out;
 +
 +	down_write(&sbi->sb_lock);
 +
 +	memset(sbi->raw_super->volume_name, 0,
 +			sizeof(sbi->raw_super->volume_name));
 +	utf8s_to_utf16s(vbuf, strlen(vbuf), UTF16_LITTLE_ENDIAN,
 +			sbi->raw_super->volume_name,
 +			ARRAY_SIZE(sbi->raw_super->volume_name));
 +
 +	err = f2fs_commit_super(sbi, false);
 +
 +	up_write(&sbi->sb_lock);
 +
 +	mnt_drop_write_file(filp);
 +out:
 +	kfree(vbuf);
 +	return err;
 +}
 +
+ static int f2fs_ioc_enable_verity(struct file *filp, unsigned long arg)
+ {
+ 	struct inode *inode = file_inode(filp);
+ 
+ 	f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
+ 
+ 	if (!f2fs_sb_has_verity(F2FS_I_SB(inode))) {
+ 		f2fs_warn(F2FS_I_SB(inode),
+ 			  "Can't enable fs-verity on inode %lu: the verity feature is not enabled on this filesystem.\n",
+ 			  inode->i_ino);
+ 		return -EOPNOTSUPP;
+ 	}
+ 
+ 	return fsverity_ioctl_enable(filp, (const void __user *)arg);
+ }
+ 
+ static int f2fs_ioc_measure_verity(struct file *filp, unsigned long arg)
+ {
+ 	if (!f2fs_sb_has_verity(F2FS_I_SB(file_inode(filp))))
+ 		return -EOPNOTSUPP;
+ 
+ 	return fsverity_ioctl_measure(filp, (void __user *)arg);
+ }
+ 
  long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
  {
 +	int ret;
 +
  	if (unlikely(f2fs_cp_error(F2FS_I_SB(file_inode(filp)))))
  		return -EIO;
 +	ret = f2fs_is_checkpoint_ready(F2FS_I_SB(file_inode(filp)));
 +	if (ret)
 +		return ret;
  
  	switch (cmd) {
  	case F2FS_IOC_GETFLAGS:
@@@ -3260,10 -3170,10 +3295,14 @@@
  		return f2fs_ioc_precache_extents(filp, arg);
  	case F2FS_IOC_RESIZE_FS:
  		return f2fs_ioc_resize_fs(filp, arg);
 +	case F2FS_IOC_GET_VOLUME_NAME:
 +		return f2fs_get_volume_name(filp, arg);
 +	case F2FS_IOC_SET_VOLUME_NAME:
 +		return f2fs_set_volume_name(filp, arg);
+ 	case FS_IOC_ENABLE_VERITY:
+ 		return f2fs_ioc_enable_verity(filp, arg);
+ 	case FS_IOC_MEASURE_VERITY:
+ 		return f2fs_ioc_measure_verity(filp, arg);
  	default:
  		return -ENOTTY;
  	}
@@@ -3378,8 -3288,8 +3417,10 @@@ long f2fs_compat_ioctl(struct file *fil
  	case F2FS_IOC_SET_PIN_FILE:
  	case F2FS_IOC_PRECACHE_EXTENTS:
  	case F2FS_IOC_RESIZE_FS:
 +	case F2FS_IOC_GET_VOLUME_NAME:
 +	case F2FS_IOC_SET_VOLUME_NAME:
+ 	case FS_IOC_ENABLE_VERITY:
+ 	case FS_IOC_MEASURE_VERITY:
  		break;
  	default:
  		return -ENOIOCTLCMD;

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2019-08-19  0:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-31  0:47 linux-next: manual merge of the fsverity tree with the f2fs tree Stephen Rothwell
2019-08-19  0:41 Stephen Rothwell

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).