linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the userns tree with the bpf-next tree
@ 2020-11-26  5:22 Stephen Rothwell
  2020-11-26 13:41 ` Eric W. Biederman
  2020-12-14 20:04 ` Stephen Rothwell
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Rothwell @ 2020-11-26  5:22 UTC (permalink / raw)
  To: Eric W. Biederman, Daniel Borkmann, Alexei Starovoitov, Networking
  Cc: Linux Kernel Mailing List, Linux Next Mailing List, Song Liu

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

Hi all,

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

  kernel/bpf/task_iter.c

between commit:

  91b2db27d3ff ("bpf: Simplify task_file_seq_get_next()")

from the bpf-next tree and commit:

  edc52f17257a ("bpf/task_iter: In task_file_seq_get_next use task_lookup_next_fd_rcu")

from the userns tree.

I fixed it up (I think, 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/bpf/task_iter.c
index 0458a40edf10,4ec63170c741..000000000000
--- a/kernel/bpf/task_iter.c
+++ b/kernel/bpf/task_iter.c
@@@ -136,41 -135,29 +135,30 @@@ struct bpf_iter_seq_task_file_info 
  };
  
  static struct file *
 -task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info,
 -		       struct task_struct **task)
 +task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info)
  {
  	struct pid_namespace *ns = info->common.ns;
- 	u32 curr_tid = info->tid, max_fds;
- 	struct files_struct *curr_files;
+ 	u32 curr_tid = info->tid;
  	struct task_struct *curr_task;
- 	int curr_fd = info->fd;
+ 	unsigned int curr_fd = info->fd;
  
  	/* If this function returns a non-NULL file object,
- 	 * it held a reference to the task/files_struct/file.
+ 	 * it held a reference to the task/file.
  	 * Otherwise, it does not hold any reference.
  	 */
  again:
 -	if (*task) {
 -		curr_task = *task;
 +	if (info->task) {
 +		curr_task = info->task;
- 		curr_files = info->files;
  		curr_fd = info->fd;
  	} else {
  		curr_task = task_seq_get_next(ns, &curr_tid, true);
 -		if (!curr_task)
 +		if (!curr_task) {
 +			info->task = NULL;
- 			info->files = NULL;
  			return NULL;
 +		}
  
- 		curr_files = get_files_struct(curr_task);
- 		if (!curr_files) {
- 			put_task_struct(curr_task);
- 			curr_tid = ++(info->tid);
- 			info->fd = 0;
- 			goto again;
- 		}
- 
- 		info->files = curr_files;
+ 		/* set *task and info->tid */
 -		*task = curr_task;
 +		info->task = curr_task;
  		if (curr_tid == info->tid) {
  			curr_fd = info->fd;
  		} else {
@@@ -198,10 -183,8 +184,8 @@@
  
  	/* the current task is done, go to the next task */
  	rcu_read_unlock();
- 	put_files_struct(curr_files);
  	put_task_struct(curr_task);
 -	*task = NULL;
 +	info->task = NULL;
- 	info->files = NULL;
  	info->fd = 0;
  	curr_tid = ++(info->tid);
  	goto again;
@@@ -210,13 -193,18 +194,12 @@@
  static void *task_file_seq_start(struct seq_file *seq, loff_t *pos)
  {
  	struct bpf_iter_seq_task_file_info *info = seq->private;
 -	struct task_struct *task = NULL;
  	struct file *file;
  
 -	file = task_file_seq_get_next(info, &task);
 -	if (!file) {
 -		info->task = NULL;
 -		return NULL;
 -	}
 -
 -	if (*pos == 0)
 +	info->task = NULL;
- 	info->files = NULL;
 +	file = task_file_seq_get_next(info);
 +	if (file && *pos == 0)
  		++*pos;
 -	info->task = task;
  
  	return file;
  }

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

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

* Re: linux-next: manual merge of the userns tree with the bpf-next tree
  2020-11-26  5:22 linux-next: manual merge of the userns tree with the bpf-next tree Stephen Rothwell
@ 2020-11-26 13:41 ` Eric W. Biederman
  2020-12-14 20:04 ` Stephen Rothwell
  1 sibling, 0 replies; 3+ messages in thread
From: Eric W. Biederman @ 2020-11-26 13:41 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Daniel Borkmann, Alexei Starovoitov, Networking,
	Linux Kernel Mailing List, Linux Next Mailing List, Song Liu

Stephen Rothwell <sfr@canb.auug.org.au> writes:

> Hi all,
>
> Today's linux-next merge of the userns tree got a conflict in:
>
>   kernel/bpf/task_iter.c
>
> between commit:
>
>   91b2db27d3ff ("bpf: Simplify task_file_seq_get_next()")
>
> from the bpf-next tree and commit:
>
>   edc52f17257a ("bpf/task_iter: In task_file_seq_get_next use task_lookup_next_fd_rcu")
>
> from the userns tree.
>
> I fixed it up (I think, 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.

Thanks.  Reading through the diff that looks right, and it has been already
reported.

Eric


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

* Re: linux-next: manual merge of the userns tree with the bpf-next tree
  2020-11-26  5:22 linux-next: manual merge of the userns tree with the bpf-next tree Stephen Rothwell
  2020-11-26 13:41 ` Eric W. Biederman
@ 2020-12-14 20:04 ` Stephen Rothwell
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2020-12-14 20:04 UTC (permalink / raw)
  To: Eric W. Biederman, David Miller, Jakub Kicinski
  Cc: Daniel Borkmann, Alexei Starovoitov, Networking,
	Linux Kernel Mailing List, Linux Next Mailing List, Song Liu

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

Hi all,

On Thu, 26 Nov 2020 16:22:48 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Today's linux-next merge of the userns tree got a conflict in:
> 
>   kernel/bpf/task_iter.c
> 
> between commit:
> 
>   91b2db27d3ff ("bpf: Simplify task_file_seq_get_next()")
> 
> from the bpf-next tree and commit:
> 
>   edc52f17257a ("bpf/task_iter: In task_file_seq_get_next use task_lookup_next_fd_rcu")
> 
> from the userns tree.
> 
> I fixed it up (I think, 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/bpf/task_iter.c
> index 0458a40edf10,4ec63170c741..000000000000
> --- a/kernel/bpf/task_iter.c
> +++ b/kernel/bpf/task_iter.c
> @@@ -136,41 -135,29 +135,30 @@@ struct bpf_iter_seq_task_file_info 
>   };
>   
>   static struct file *
>  -task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info,
>  -		       struct task_struct **task)
>  +task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info)
>   {
>   	struct pid_namespace *ns = info->common.ns;
> - 	u32 curr_tid = info->tid, max_fds;
> - 	struct files_struct *curr_files;
> + 	u32 curr_tid = info->tid;
>   	struct task_struct *curr_task;
> - 	int curr_fd = info->fd;
> + 	unsigned int curr_fd = info->fd;
>   
>   	/* If this function returns a non-NULL file object,
> - 	 * it held a reference to the task/files_struct/file.
> + 	 * it held a reference to the task/file.
>   	 * Otherwise, it does not hold any reference.
>   	 */
>   again:
>  -	if (*task) {
>  -		curr_task = *task;
>  +	if (info->task) {
>  +		curr_task = info->task;
> - 		curr_files = info->files;
>   		curr_fd = info->fd;
>   	} else {
>   		curr_task = task_seq_get_next(ns, &curr_tid, true);
>  -		if (!curr_task)
>  +		if (!curr_task) {
>  +			info->task = NULL;
> - 			info->files = NULL;
>   			return NULL;
>  +		}
>   
> - 		curr_files = get_files_struct(curr_task);
> - 		if (!curr_files) {
> - 			put_task_struct(curr_task);
> - 			curr_tid = ++(info->tid);
> - 			info->fd = 0;
> - 			goto again;
> - 		}
> - 
> - 		info->files = curr_files;
> + 		/* set *task and info->tid */
>  -		*task = curr_task;
>  +		info->task = curr_task;
>   		if (curr_tid == info->tid) {
>   			curr_fd = info->fd;
>   		} else {
> @@@ -198,10 -183,8 +184,8 @@@
>   
>   	/* the current task is done, go to the next task */
>   	rcu_read_unlock();
> - 	put_files_struct(curr_files);
>   	put_task_struct(curr_task);
>  -	*task = NULL;
>  +	info->task = NULL;
> - 	info->files = NULL;
>   	info->fd = 0;
>   	curr_tid = ++(info->tid);
>   	goto again;
> @@@ -210,13 -193,18 +194,12 @@@
>   static void *task_file_seq_start(struct seq_file *seq, loff_t *pos)
>   {
>   	struct bpf_iter_seq_task_file_info *info = seq->private;
>  -	struct task_struct *task = NULL;
>   	struct file *file;
>   
>  -	file = task_file_seq_get_next(info, &task);
>  -	if (!file) {
>  -		info->task = NULL;
>  -		return NULL;
>  -	}
>  -
>  -	if (*pos == 0)
>  +	info->task = NULL;
> - 	info->files = NULL;
>  +	file = task_file_seq_get_next(info);
>  +	if (file && *pos == 0)
>   		++*pos;
>  -	info->task = task;
>   
>   	return file;
>   }

Just a reminder that this conflict still exists.  Commit 91b2db27d3ff
is now in the net-next tree.

-- 
Cheers,
Stephen Rothwell

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

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

end of thread, other threads:[~2020-12-14 20:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26  5:22 linux-next: manual merge of the userns tree with the bpf-next tree Stephen Rothwell
2020-11-26 13:41 ` Eric W. Biederman
2020-12-14 20:04 ` 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).