]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
powerpc: Add a framework for user access tracking
authorChristophe Leroy <christophe.leroy@c-s.fr>
Thu, 19 Nov 2020 23:41:59 +0000 (10:41 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Nov 2020 09:02:25 +0000 (10:02 +0100)
commit357a5e6febe8839bd217121baa394b11e8fe4085
treefa0df127be541b0d08f38f1d775d888aff4dbb4d
parentf69bb4e51f41973fb7594be1479fa689831efe1a
powerpc: Add a framework for user access tracking

Backported from commit de78a9c42a79 ("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 1d8f739b07bd ("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 9dc086f1e9ef ("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: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/include/asm/futex.h
arch/powerpc/include/asm/kup.h [new file with mode: 0644]
arch/powerpc/include/asm/uaccess.h
arch/powerpc/lib/checksum_wrappers.c