[PATCH 3.18 v2 5/5] MIPS: Disallow outsized PTRACE_SETREGSET NT_PRFPREG regset accesses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Complement commit c23b3d1a5311 ("MIPS: ptrace: Change GP regset to use
correct core dump register layout") and also reject outsized
PTRACE_SETREGSET requests to the NT_PRFPREG regset, like with the
NT_PRSTATUS regset.

Signed-off-by: Maciej W. Rozycki <macro@xxxxxxxx>
Fixes: c23b3d1a5311 ("MIPS: ptrace: Change GP regset to use correct core dump register layout")
Cc: James Hogan <james.hogan@xxxxxxxx>
Cc: Paul Burton <Paul.Burton@xxxxxxxx>
Cc: Alex Smith <alex@xxxxxxxxxxxxxxxx>
Cc: Dave Martin <Dave.Martin@xxxxxxx>
Cc: linux-mips@xxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: stable@xxxxxxxxxxxxxxx # v3.17+
Patchwork: https://patchwork.linux-mips.org/patch/17930/
Signed-off-by: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
---
Hi,

 This is a (mechanically regenerated) version of commit c8c5a3a24d39 for 
3.18-stable and before.  No functional changes.  Please apply.

  Maciej

---
 arch/mips/kernel/ptrace.c |    3 +++
 1 file changed, 3 insertions(+)

linux-mips-nt-prfpreg-size.diff
Index: linux-stable-el/arch/mips/kernel/ptrace.c
===================================================================
--- linux-stable-el.orig/arch/mips/kernel/ptrace.c	2018-01-10 20:11:52.000000000 +0000
+++ linux-stable-el/arch/mips/kernel/ptrace.c	2018-01-10 20:13:16.212944000 +0000
@@ -530,6 +530,9 @@ static int fpr_set(struct task_struct *t
 
 	BUG_ON(count % sizeof(elf_fpreg_t));
 
+	if (pos + count > sizeof(elf_fpregset_t))
+		return -EIO;
+
 	if (sizeof(target->thread.fpu.fpr[0]) == sizeof(elf_fpreg_t))
 		err = fpr_set_fpa(target, &pos, &count, &kbuf, &ubuf);
 	else



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]