Subject: linux-next: manual merge of the pidfd tree with the overlayfs tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 25 Jan 2021 17:04:26 +1100

Hi all,

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

  fs/overlayfs/copy_up.c

between commit:

  06896fa3193d ("ovl: skip getxattr of security labels")

from the overlayfs tree and commit:

  c7c7a1a18af4 ("xattr: handle idmapped mounts")

from the pidfd 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/overlayfs/copy_up.c
index 0fed532efa68,f81b836c2256..000000000000
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@@ -84,18 -84,10 +84,18 @@@ int ovl_copy_xattr(struct super_block *
  
  		if (ovl_is_private_xattr(sb, name))
  			continue;
 +
 +		error = security_inode_copy_up_xattr(name);
 +		if (error < 0 && error != -EOPNOTSUPP)
 +			break;
 +		if (error == 1) {
 +			error = 0;
 +			continue; /* Discard */
 +		}
  retry:
- 		size = vfs_getxattr(old, name, value, value_size);
+ 		size = vfs_getxattr(&init_user_ns, old, name, value, value_size);
  		if (size == -ERANGE)
- 			size = vfs_getxattr(old, name, NULL, 0);
+ 			size = vfs_getxattr(&init_user_ns, old, name, NULL, 0);
  
  		if (size < 0) {
  			error = size;
@@@ -115,7 -107,14 +115,7 @@@
  			goto retry;
  		}
  
- 		error = vfs_setxattr(new, name, value, size, 0);
 -		error = security_inode_copy_up_xattr(name);
 -		if (error < 0 && error != -EOPNOTSUPP)
 -			break;
 -		if (error == 1) {
 -			error = 0;
 -			continue; /* Discard */
 -		}
+ 		error = vfs_setxattr(&init_user_ns, new, name, value, size, 0);
  		if (error) {
  			if (error != -EOPNOTSUPP || ovl_must_copy_xattr(name))
  				break;