lkml.org 
[lkml]   [2020]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: linux-next: manual merge of the userns tree with the bpf-next tree
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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-12-14 21:08    [W:0.049 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site