diff options
author | Helge Deller <deller@gmx.de> | 2019-07-04 03:44:17 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-26 09:14:29 +0200 |
commit | a6a0daa775e84d72e292ffd0edb2fa9f246212e5 (patch) | |
tree | 5186a01c8cea4b0a7dda45c34aa02800bb84bc39 /arch | |
parent | ef5c2e165ab0a38c949bd44055fd0384e7d8c235 (diff) | |
download | linux-stable-a6a0daa775e84d72e292ffd0edb2fa9f246212e5.tar.gz linux-stable-a6a0daa775e84d72e292ffd0edb2fa9f246212e5.tar.bz2 linux-stable-a6a0daa775e84d72e292ffd0edb2fa9f246212e5.zip |
parisc: Ensure userspace privilege for ptraced processes in regset functions
commit 34c32fc603311a72cb558e5e337555434f64c27b upstream.
On parisc the privilege level of a process is stored in the lowest two bits of
the instruction pointers (IAOQ0 and IAOQ1). On Linux we use privilege level 0
for the kernel and privilege level 3 for user-space. So userspace should not be
allowed to modify IAOQ0 or IAOQ1 of a ptraced process to change it's privilege
level to e.g. 0 to try to gain kernel privileges.
This patch prevents such modifications in the regset support functions by
always setting the two lowest bits to one (which relates to privilege level 3
for user-space) if IAOQ0 or IAOQ1 are modified via ptrace regset calls.
Link: https://bugs.gentoo.org/481768
Cc: <stable@vger.kernel.org> # v4.7+
Tested-by: Rolf Eike Beer <eike-kernel@sf-tec.de>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/parisc/kernel/ptrace.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index 0964c236e3e5..855ccbca8049 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c @@ -496,7 +496,8 @@ static void set_reg(struct pt_regs *regs, int num, unsigned long val) return; case RI(iaoq[0]): case RI(iaoq[1]): - regs->iaoq[num - RI(iaoq[0])] = val; + /* set 2 lowest bits to ensure userspace privilege: */ + regs->iaoq[num - RI(iaoq[0])] = val | 3; return; case RI(sar): regs->sar = val; return; |