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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 16 Dec 2020 12:02:21 +1100
From:   Stephen Rothwell <sfr@...b.auug.org.au>
To:     "Eric W. Biederman" <ebiederm@...ssion.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...e.hu>,
        "H. Peter Anvin" <hpa@...or.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux Next Mailing List <linux-next@...r.kernel.org>
Subject: Re: linux-next: manual merge of the userns tree with the tip tree

Hi all,

On Fri, 11 Dec 2020 18:24:53 +1100 Stephen Rothwell <sfr@...b.auug.org.au> wrote:
>
> Today's linux-next merge of the userns tree got a conflict in:
> 
>   kernel/events/core.c
> 
> between commit:
> 
>   78af4dc949da ("perf: Break deadlock involving exec_update_mutex")
> 
> from the tip tree and commit:
> 
>   f7cfd871ae0c ("exec: Transform exec_update_mutex into a rw_semaphore")
> 
> from the userns 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.
> 
> diff --cc kernel/events/core.c
> index 19ae6c931c52,55b2330b556c..000000000000
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@@ -11958,24 -11864,6 +11958,24 @@@ SYSCALL_DEFINE5(perf_event_open
>   		goto err_context;
>   	}
>   
>  +	if (task) {
> - 		err = mutex_lock_interruptible(&task->signal->exec_update_mutex);
> ++		err = down_read_interruptible(&task->signal->exec_update_lock);
>  +		if (err)
>  +			goto err_file;
>  +
>  +		/*
>  +		 * Preserve ptrace permission check for backwards compatibility.
>  +		 *
> - 		 * We must hold exec_update_mutex across this and any potential
> ++		 * We must hold exec_update_lock across this and any potential
>  +		 * perf_install_in_context() call for this new event to
>  +		 * serialize against exec() altering our credentials (and the
>  +		 * perf_event_exit_task() that could imply).
>  +		 */
>  +		err = -EACCES;
>  +		if (!perfmon_capable() && !ptrace_may_access(task, PTRACE_MODE_READ_REALCREDS))
>  +			goto err_cred;
>  +	}
>  +
>   	if (move_group) {
>   		gctx = __perf_event_ctx_lock_double(group_leader, ctx);
>   
> @@@ -12151,10 -12039,7 +12151,10 @@@ err_locked
>   	if (move_group)
>   		perf_event_ctx_unlock(group_leader, gctx);
>   	mutex_unlock(&ctx->mutex);
>  -/* err_file: */
>  +err_cred:
>  +	if (task)
> - 		mutex_unlock(&task->signal->exec_update_mutex);
> ++		up_read(&task->signal->exec_update_lock);
>  +err_file:
>   	fput(event_file);
>   err_context:
>   	perf_unpin_context(ctx);

This is now a conflict between the userns tree and Linus's tree.

-- 
Cheers,
Stephen Rothwell

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists