lkml.org 
[lkml]   [2020]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v2 5/5] exec: Add a exec_update_mutex to replace cred_guard_mutex
    From
    Date
    On 14.03.2020 13:02, Bernd Edlinger wrote:
    > On 3/14/20 10:57 AM, Bernd Edlinger wrote:
    >> On 3/13/20 10:13 AM, Kirill Tkhai wrote:
    >>>
    >>> Despite this should fix the problem, this looks like a broken puzzle.
    >>>
    >>> We can't use bprm->cred as an identifier whether the mutex was locked or not.
    >>> We can check for bprm->cred in regard to cred_guard_mutex, because of there is
    >>> strong rule: "cred_guard_mutex is becomes locked together with bprm->cred assignment
    >>> (see prepare_bprm_creds()), and it becomes unlocked together with bprm->cred zeroing".
    >>> Take attention on modularity of all this: there is no dependencies between anything else.
    >>>
    >>> In regard to newly introduced exec_update_mutex, your fix and source patch way look like
    >>> an obfuscation. The mutex becomes deadly glued to unrelated bprm->cred and bprm->mm,
    >>> and this introduces the problems in the future modifications and support of all involved
    >>> entities. If someone wants to move some functions in relation to each other, there will
    >>> be a pain, and this person will have to go again the same dependencies and bug way,
    >>> Eric stepped on in the original patch.
    >>>
    >>
    >> Okay, yes, valid points you make, thanks.
    >> I just wanted to understand what was exactly wrong with this patch,
    >> since the failure mode looked a lot like it was failing because of
    >> something clobbering the data unexpectedly.
    >>
    >>
    >> So I have posted a few updated patch for the failed one here:
    >>
    >> [PATCH v3 5/5] exec: Add a exec_update_mutex to replace cred_guard_mutex
    >> [PATCH] pidfd: Use new infrastructure to fix deadlocks in execve
    >>
    >> which replaces these:
    >> [PATCH v2 5/5] exec: Add a exec_update_mutex to replace cred_guard_mutex
    >> https://lore.kernel.org/lkml/87zhcq4jdj.fsf_-_@x220.int.ebiederm.org/
    >>
    >> [PATCH] pidfd: Stop taking cred_guard_mutex
    >> https://lore.kernel.org/lkml/87wo7svy96.fsf_-_@x220.int.ebiederm.org/
    >>
    >>
    >> and a new patch series to fix deadlock in ptrace_attach and update doc:
    >> [PATCH 0/2] exec: Fix dead-lock in de_thread with ptrace_attach
    >> [PATCH 1/2] exec: Fix dead-lock in de_thread with ptrace_attach
    >> [PATCH 2/2] doc: Update documentation of ->exec_*_mutex
    >>
    >>
    >> Other patches needed, still valid:
    >>
    >> [PATCH v2 1/5] exec: Only compute current once in flush_old_exec
    >> https://lore.kernel.org/lkml/87pndm5y3l.fsf_-_@x220.int.ebiederm.org/
    >>
    >> [PATCH v2 2/5] exec: Factor unshare_sighand out of de_thread and call it separately
    >> https://lore.kernel.org/lkml/87k13u5y26.fsf_-_@x220.int.ebiederm.org/
    >>
    >
    > Ah, sorry, forgot this one:
    > [PATCH v2 3/5] exec: Move cleanup of posix timers on exec out of de_thread
    > https://lore.kernel.org/lkml/87eeu25y14.fsf_-_@x220.int.ebiederm.org/
    >
    >> [PATCH v2 4/5] exec: Move exec_mmap right after de_thread in flush_old_exec
    >> https://lore.kernel.org/lkml/875zfe5xzb.fsf_-_@x220.int.ebiederm.org/

    1-4/5 look OK for me. You may add my

    Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>

    >> [PATCH 1/4] exec: Fix a deadlock in ptrace
    >> https://lore.kernel.org/lkml/AM6PR03MB517033EAD25BED15CC84E17DE4FF0@AM6PR03MB5170.eurprd03.prod.outlook.com/
    >>
    >> [PATCH 2/4] selftests/ptrace: add test cases for dead-locks
    >> https://lore.kernel.org/lkml/AM6PR03MB51703199741A2C27A78980FFE4FF0@AM6PR03MB5170.eurprd03.prod.outlook.com/
    >>
    >> [PATCH 3/4] mm: docs: Fix a comment in process_vm_rw_core
    >> https://lore.kernel.org/lkml/AM6PR03MB5170ED6D4D216EEEEF400136E4FF0@AM6PR03MB5170.eurprd03.prod.outlook.com/
    >>
    >> [PATCH 4/4] kernel: doc: remove outdated comment cred.c
    >> https://lore.kernel.org/lkml/AM6PR03MB517039DB07AB641C194FEA57E4FF0@AM6PR03MB5170.eurprd03.prod.outlook.com/
    >>
    >> [PATCH 1/4] kernel/kcmp.c: Use new infrastructure to fix deadlocks in execve
    >> https://lore.kernel.org/lkml/AM6PR03MB517057A2269C3A4FB287B76EE4FF0@AM6PR03MB5170.eurprd03.prod.outlook.com/
    >>
    >> [PATCH 2/4] proc: Use new infrastructure to fix deadlocks in execve
    >> https://lore.kernel.org/lkml/AM6PR03MB51705D211EC8E7EA270627B1E4FF0@AM6PR03MB5170.eurprd03.prod.outlook.com/
    >>
    >> [PATCH 3/4] proc: io_accounting: Use new infrastructure to fix deadlocks in execve
    >> https://lore.kernel.org/lkml/AM6PR03MB5170BD2476E35068E182EFA4E4FF0@AM6PR03MB5170.eurprd03.prod.outlook.com/
    >>
    >> [PATCH 4/4] perf: Use new infrastructure to fix deadlocks in execve
    >> https://lore.kernel.org/lkml/AM6PR03MB517035DEEDB9C8699CB6B34EE4FF0@AM6PR03MB5170.eurprd03.prod.outlook.com/
    >>
    >>
    >> I think most of the existing patches are already approved, but if
    >> there are still change requests, please let me know.
    >>
    >>
    >> Thanks
    >> Bernd.
    >>
    >
    > Hope it is correct now.
    > I haven't seen the new patches on the kernel archives yet,
    > so I cannot add URLs for them.
    >
    > Bernd.
    >

    \
     
     \ /
      Last update: 2020-03-17 09:58    [W:3.211 / U:0.196 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site