Hi all,

On Fri, 11 Dec 2020 18:24:53 +1100 Stephen Rothwell <s...@canb.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

Attachment: pgpjh2nkojkEe.pgp
Description: OpenPGP digital signature

Reply via email to