• Christian Brauner's avatar
    timens: make vdso_join_timens() always succeed · 42815808
    Christian Brauner authored
    As discussed on-list (cf. [1]), in order to make setns() support time
    namespaces when attaching to multiple namespaces at once properly we
    need to tweak vdso_join_timens() to always succeed. So switch
    vdso_join_timens() to using a read lock and replacing
    mmap_write_lock_killable() to mmap_read_lock() as we discussed.
    
    Last cycle setns() was changed to support attaching to multiple namespaces
    atomically. This requires all namespaces to have a point of no return where
    they can't fail anymore. Specifically, <namespace-type>_install() is
    allowed to perform permission checks and install the namespace into the new
    struct nsset that it has been given but it is not allowed to make visible
    changes to the affected task. Once <namespace-type>_install() returns
    anything that the given namespace type requires to be setup in addition
    needs to ideally be done in a function that can't fail or if it fails the
    failure is not fatal. For time namespaces the relevant functions that fall
    into this category are timens_set_vvar_page() and vdso_join_timens().
    Currently the latter can fail but doesn't need to. With this we can go on
    to implement a timens_commit() helper in a follow up patch to be used by
    setns().
    
    [1]: https://lore.kernel.org/lkml/20200611110221.pgd3r5qkjrjmfqa2@wittgensteinSigned-off-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
    Reviewed-by: default avatarAndrei Vagin <avagin@gmail.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Dmitry Safonov <dima@arista.com>
    Cc: linux-arm-kernel@lists.infradead.org
    Link: https://lore.kernel.org/r/20200706154912.3248030-2-christian.brauner@ubuntu.com
    42815808
vma.c 11.6 KB