Skip to content

Commit 34c32fc

Browse files
committed
parisc: Ensure userspace privilege for ptraced processes in regset functions
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: <[email protected]> # v4.7+ Tested-by: Rolf Eike Beer <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 10835c8 commit 34c32fc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/parisc/kernel/ptrace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@ static void set_reg(struct pt_regs *regs, int num, unsigned long val)
504504
return;
505505
case RI(iaoq[0]):
506506
case RI(iaoq[1]):
507-
regs->iaoq[num - RI(iaoq[0])] = val;
507+
/* set 2 lowest bits to ensure userspace privilege: */
508+
regs->iaoq[num - RI(iaoq[0])] = val | 3;
508509
return;
509510
case RI(sar): regs->sar = val;
510511
return;

0 commit comments

Comments
 (0)