linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the akpm-current tree with the pidfd tree
@ 2019-04-23  8:46 Stephen Rothwell
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Rothwell @ 2019-04-23  8:46 UTC (permalink / raw)
  To: Andrew Morton, Christian Brauner
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Andrea Arcangeli

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

Hi all,

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

  kernel/fork.c

between commit:

  2897d468ea48 ("clone: add CLONE_PIDFD")

from the pidfd tree and commit:

  83e1afab81ac ("userfaultfd: use RCU to free the task struct when fork fails")

from the akpm-current 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 ad2896dd8df2,1c10a912b9b6..000000000000
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@@ -1667,58 -1673,24 +1678,76 @@@ static inline void rcu_copy_process(str
  #endif /* #ifdef CONFIG_TASKS_RCU */
  }
  
 +static int pidfd_release(struct inode *inode, struct file *file)
 +{
 +	struct pid *pid = file->private_data;
 +
 +	file->private_data = NULL;
 +	put_pid(pid);
 +	return 0;
 +}
 +
 +#ifdef CONFIG_PROC_FS
 +static void pidfd_show_fdinfo(struct seq_file *m, struct file *f)
 +{
 +	struct pid_namespace *ns = proc_pid_ns(file_inode(m->file));
 +	struct pid *pid = f->private_data;
 +
 +	seq_put_decimal_ull(m, "Pid:\t", pid_nr_ns(pid, ns));
 +	seq_putc(m, '\n');
 +}
 +#endif
 +
 +const struct file_operations pidfd_fops = {
 +	.release = pidfd_release,
 +#ifdef CONFIG_PROC_FS
 +	.show_fdinfo = pidfd_show_fdinfo,
 +#endif
 +};
 +
 +/**
 + * pidfd_create() - Create a new pid file descriptor.
 + *
 + * @pid:  struct pid that the pidfd will reference
 + *
 + * This creates a new pid file descriptor with the O_CLOEXEC flag set.
 + *
 + * Note, that this function can only be called after the fd table has
 + * been unshared to avoid leaking the pidfd to the new process.
 + *
 + * Return: On success, a cloexec pidfd is returned.
 + *         On error, a negative errno number will be returned.
 + */
 +static int pidfd_create(struct pid *pid)
 +{
 +	int fd;
 +
 +	fd = anon_inode_getfd("[pidfd]", &pidfd_fops, get_pid(pid),
 +			      O_RDWR | O_CLOEXEC);
 +	if (fd < 0)
 +		put_pid(pid);
 +
 +	return fd;
 +}
 +
+ #ifdef CONFIG_MEMCG
+ static void __delayed_free_task(struct rcu_head *rhp)
+ {
+ 	struct task_struct *tsk = container_of(rhp, struct task_struct, rcu);
+ 
+ 	free_task(tsk);
+ }
+ #endif /* CONFIG_MEMCG */
+ 
+ static __always_inline void delayed_free_task(struct task_struct *tsk)
+ {
+ #ifdef CONFIG_MEMCG
+ 	call_rcu(&tsk->rcu, __delayed_free_task);
+ #else /* CONFIG_MEMCG */
+ 	free_task(tsk);
+ #endif /* CONFIG_MEMCG */
+ }
+ 
  /*
   * This creates a new process as a copy of the old one,
   * but does not actually start it yet.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread
* linux-next: manual merge of the akpm-current tree with the pidfd tree
@ 2019-05-15  3:16 Stephen Rothwell
  2019-07-08  2:01 ` Stephen Rothwell
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Rothwell @ 2019-05-15  3:16 UTC (permalink / raw)
  To: Andrew Morton, Christian Brauner
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Joel Fernandes (Google)

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

Hi all,

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

  include/linux/pid.h

between commit:

  51f1b521a515 ("pidfd: add polling support")

from the pidfd tree and commit:

  c02e28a1bb18 ("kernel/pid.c: convert struct pid:count to refcount_t")

from the akpm-current 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 include/linux/pid.h
index 1484db6ca8d1,0be5829ddd80..000000000000
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@@ -3,7 -3,7 +3,8 @@@
  #define _LINUX_PID_H
  
  #include <linux/rculist.h>
 +#include <linux/wait.h>
+ #include <linux/refcount.h>
  
  enum pid_type
  {

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

^ permalink raw reply	[flat|nested] 14+ messages in thread
* linux-next: manual merge of the akpm-current tree with the pidfd tree
@ 2019-05-22  1:43 Stephen Rothwell
  2019-05-24  8:15 ` Joel Fernandes
  2019-07-08 23:12 ` Stephen Rothwell
  0 siblings, 2 replies; 14+ messages in thread
From: Stephen Rothwell @ 2019-05-22  1:43 UTC (permalink / raw)
  To: Andrew Morton, Christian Brauner
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Joel Fernandes (Google)

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

Hi all,

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

  kernel/pid.c

between commit:

  99e9da7f2796 ("pid: add pidfd_open()")

from the pidfd tree and commit:

  51c59c914840 ("kernel/pid.c: convert struct pid:count to refcount_t")

from the akpm-current 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/pid.c
index 39181ccca846,b59681973dd6..000000000000
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@@ -37,8 -36,7 +37,8 @@@
  #include <linux/init_task.h>
  #include <linux/syscalls.h>
  #include <linux/proc_ns.h>
- #include <linux/proc_fs.h>
+ #include <linux/refcount.h>
 +#include <linux/sched/signal.h>
  #include <linux/sched/task.h>
  #include <linux/idr.h>
  

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

^ permalink raw reply	[flat|nested] 14+ messages in thread
* linux-next: manual merge of the akpm-current tree with the pidfd tree
@ 2020-09-22  8:54 Stephen Rothwell
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Rothwell @ 2020-09-22  8:54 UTC (permalink / raw)
  To: Andrew Morton, Christian Brauner
  Cc: Minchan Kim, Christian Brauner, Linux Next Mailing List,
	Linux Kernel Mailing List, David Rientjes

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

Hi all,

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

  kernel/exit.c

between commit:

  ba7d25f3dff6 ("exit: support non-blocking pidfds")

from the pidfd tree and patch:

  "pid: move pidfd_get_pid() to pid.c"

from the akpm-current tree.

I fixed it up (I made the changes from the former to kernel/pid.c - 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.

I also had to add the following fix patch after

  "mm/madvise: introduce process_madvise() syscall: an external memory hinting API"

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Tue, 22 Sep 2020 18:36:35 +1000
Subject: [PATCH] fix up for pidfd_get_pid() API change

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 mm/madvise.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/madvise.c b/mm/madvise.c
index a0ebeb5e2411..51317bd3c69d 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -1189,11 +1189,12 @@ static ssize_t do_process_madvise(int pidfd, struct iov_iter *iter,
 	struct task_struct *task;
 	struct mm_struct *mm;
 	size_t total_len = iov_iter_count(iter);
+	unsigned int pidfd_flags;
 
 	if (flags != 0)
 		return -EINVAL;
 
-	pid = pidfd_get_pid(pidfd);
+	pid = pidfd_get_pid(pidfd, &pidfd_flags);
 	if (IS_ERR(pid))
 		return PTR_ERR(pid);
 
-- 
2.28.0

-- 
Cheers,
Stephen Rothwell

diff --git a/include/linux/pid.h b/include/linux/pid.h
index 176d6cf80e7c..fa10acb8d6a4 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -77,7 +77,7 @@ extern const struct file_operations pidfd_fops;
 struct file;
 
 extern struct pid *pidfd_pid(const struct file *file);
-struct pid *pidfd_get_pid(unsigned int fd);
+struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags);
 
 static inline struct pid *get_pid(struct pid *pid)
 {
diff --git a/kernel/pid.c b/kernel/pid.c
index c791fe63fa36..47466d0bbc5b 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -520,7 +520,7 @@ struct pid *find_ge_pid(int nr, struct pid_namespace *ns)
 	return idr_get_next(&ns->idr, &nr);
 }
 
-struct pid *pidfd_get_pid(unsigned int fd)
+struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags)
 {
 	struct fd f;
 	struct pid *pid;
@@ -530,8 +530,10 @@ struct pid *pidfd_get_pid(unsigned int fd)
 		return ERR_PTR(-EBADF);
 
 	pid = pidfd_pid(f.file);
-	if (!IS_ERR(pid))
+	if (!IS_ERR(pid)) {
 		get_pid(pid);
+		*flags = f.file->f_flags;
+	}
 
 	fdput(f);
 	return pid;

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread
* linux-next: manual merge of the akpm-current tree with the pidfd tree
@ 2021-01-27 11:43 Stephen Rothwell
  2021-01-28  2:04 ` Miaohe Lin
  2021-02-14 21:54 ` Stephen Rothwell
  0 siblings, 2 replies; 14+ messages in thread
From: Stephen Rothwell @ 2021-01-27 11:43 UTC (permalink / raw)
  To: Andrew Morton, Christian Brauner
  Cc: Linux Kernel Mailing List, Linux Next Mailing List, Miaohe Lin

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

Hi all,

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

  fs/hugetlbfs/inode.c

between commit:

  2f221d6f7b88 ("attr: handle idmapped mounts")

from the pidfd tree and commit:

  57d3629b7a9a ("hugetlbfs: remove useless BUG_ON(!inode) in hugetlbfs_setattr()")

from the akpm-current 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/hugetlbfs/inode.c
index c5c32eb59498,ca9e25427f2d..000000000000
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@@ -760,9 -766,7 +767,7 @@@ static int hugetlbfs_setattr(struct use
  	unsigned int ia_valid = attr->ia_valid;
  	struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode);
  
- 	BUG_ON(!inode);
- 
 -	error = setattr_prepare(dentry, attr);
 +	error = setattr_prepare(&init_user_ns, dentry, attr);
  	if (error)
  		return error;
  

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

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

end of thread, other threads:[~2021-02-24 22:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23  8:46 linux-next: manual merge of the akpm-current tree with the pidfd tree Stephen Rothwell
2019-05-15  3:16 Stephen Rothwell
2019-07-08  2:01 ` Stephen Rothwell
2019-07-12 12:53   ` Joel Fernandes
2019-07-12 13:02     ` Christian Brauner
2019-07-12 13:54       ` Joel Fernandes
2019-05-22  1:43 Stephen Rothwell
2019-05-24  8:15 ` Joel Fernandes
2019-07-08 23:12 ` Stephen Rothwell
2020-09-22  8:54 Stephen Rothwell
2021-01-27 11:43 Stephen Rothwell
2021-01-28  2:04 ` Miaohe Lin
2021-02-14 21:54 ` Stephen Rothwell
2021-02-24 22: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).