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

From: Stephen Rothwell <[email-masked]>
Date: Mon, 1 Jul 2019 20:35:13 +1000

Hi all,

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

  kernel/fork.c

between commits:

  9014143bab2f ("fork: don't check parent_tidptr with CLONE_PIDFD")
  6fd2fe494b17 ("copy_process(): don't use ksys_close() on cleanups")

from Linus' tree and commit:

  7f192e3cd316 ("fork: add clone3")

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 kernel/fork.c
index 947bc0161f9c,4114a044822c..000000000000
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@@ -1755,7 -1794,7 +1776,8 @@@ static __latent_entropy struct task_str
  	int pidfd = -1, retval;
  	struct task_struct *p;
  	struct multiprocess_signals delayed;
 +	struct file *pidfile = NULL;
+ 	u64 clone_flags = args->flags;
  
  	/*
  	 * Don't allow sharing the root directory with processes in a different
@@@ -2030,16 -2070,7 +2050,16 @@@
  			goto bad_fork_free_pid;
  
  		pidfd = retval;
 +
 +		pidfile = anon_inode_getfile("[pidfd]", &pidfd_fops, pid,
 +					      O_RDWR | O_CLOEXEC);
 +		if (IS_ERR(pidfile)) {
 +			put_unused_fd(pidfd);
 +			goto bad_fork_free_pid;
 +		}
 +		get_pid(pid);	/* held by pidfile now */
 +
- 		retval = put_user(pidfd, parent_tidptr);
+ 		retval = put_user(pidfd, args->pidfd);
  		if (retval)
  			goto bad_fork_put_pidfd;
  	}