]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
parisc: Revise __get_user() to probe user read access
authorJohn David Anglin <dave.anglin@bell.net>
Fri, 25 Jul 2025 17:51:32 +0000 (13:51 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:26:08 +0000 (16:26 +0200)
commit28a9b71671fb4a2993ef85b8ef6f117ea63894fe
tree55200ff321a40dcd52c35ccf7c979fa6a4df6d5f
parentc9464d5a06662b067b7fe88b5fe2f89e390f4c5c
parisc: Revise __get_user() to probe user read access

commit 89f686a0fb6e473a876a9a60a13aec67a62b9a7e upstream.

Because of the way read access support is implemented, read access
interruptions are only triggered at privilege levels 2 and 3. The
kernel executes at privilege level 0, so __get_user() never triggers
a read access interruption (code 26). Thus, it is currently possible
for user code to access a read protected address via a system call.

Fix this by probing read access rights at privilege level 3 (PRIV_USER)
and setting __gu_err to -EFAULT (-14) if access isn't allowed.

Note the cmpiclr instruction does a 32-bit compare because COND macro
doesn't work inside asm.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # v5.12+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/parisc/include/asm/uaccess.h