• C
    powerpc: Add a framework for user access tracking · 9f59cc51
    Christophe Leroy 提交于
    stable inclusion
    from linux-4.19.159
    commit 357a5e6febe8839bd217121baa394b11e8fe4085
    CVE: CVE-2020-4788
    
    --------------------------------
    
    Backported from commit de78a9c4 ("powerpc: Add a framework
    for Kernel Userspace Access Protection"). Here we don't try to
    add the KUAP framework, we just want the helper functions
    because we want to put uaccess flush helpers in them.
    
    In terms of fixes, we don't need commit 1d8f739b ("powerpc/kuap:
    Fix set direction in allow/prevent_user_access()") as we don't have
    real KUAP. Likewise as all our allows are noops and all our prevents
    are just flushes, we don't need commit 9dc086f1 ("powerpc/futex:
    Fix incorrect user access blocking") The other 2 fixes we do need.
    
    The original description is:
    
    This patch implements a framework for Kernel Userspace Access
    Protection.
    
    Then subarches will have the possibility to provide their own
    implementation by providing setup_kuap() and
    allow/prevent_user_access().
    
    Some platforms will need to know the area accessed and whether it is
    accessed from read, write or both. Therefore source, destination and
    size and handed over to the two functions.
    
    mpe: Rename to allow/prevent rather than unlock/lock, and add
    read/write wrappers. Drop the 32-bit code for now until we have an
    implementation for it. Add kuap to pt_regs for 64-bit as well as
    32-bit. Don't split strings, use pr_crit_ratelimited().
    Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
    Signed-off-by: NRussell Currey <ruscur@russell.cc>
    Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: NDaniel Axtens <dja@axtens.net>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Conflicts:
      arch/powerpc/include/asm/uaccess.h
      arch/powerpc/include/asm/futex.h
    [yyl: resolve the conflits, because VERIFY_WRITE is already removed]
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    Reviewed-by: NJason Yan <yanaijie@huawei.com>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    9f59cc51
futex.h 2.4 KB