lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 15 Dec 2020 07:04:47 +1100
From:   Stephen Rothwell <sfr@...b.auug.org.au>
To:     "Eric W. Biederman" <ebiederm@...ssion.com>,
        David Miller <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
Cc:     Daniel Borkmann <daniel@...earbox.net>,
        Alexei Starovoitov <ast@...nel.org>,
        Networking <netdev@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux Next Mailing List <linux-next@...r.kernel.org>,
        Song Liu <songliubraving@...com>
Subject: Re: 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@...b.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

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ