linux/arch
James Hogan c584e5333a MIPS: Fix buffer overflow in syscall_get_arguments()
commit f4dce1ffd2 upstream.

Since commit 4c21b8fd8f ("MIPS: seccomp: Handle indirect system calls
(o32)"), syscall_get_arguments() attempts to handle o32 indirect syscall
arguments by incrementing both the start argument number and the number
of arguments to fetch. However only the start argument number needs to
be incremented. The number of arguments does not change, they're just
shifted up by one, and in fact the output array is provided by the
caller and is likely only n entries long, so reading more arguments
overflows the output buffer.

In the case of seccomp, this results in it fetching 7 arguments starting
at the 2nd one, which overflows the unsigned long args[6] in
populate_seccomp_data(). This clobbers the $s0 register from
syscall_trace_enter() which __seccomp_phase1_filter() saved onto the
stack, into which syscall_trace_enter() had placed its syscall number
argument. This caused Chromium to crash.

Credit goes to Milko for tracking it down as far as $s0 being clobbered.

Fixes: 4c21b8fd8f ("MIPS: seccomp: Handle indirect system calls (o32)")
Reported-by: Milko Leporis <milko.leporis@imgtec.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/12213/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
History 2016-02-25 00:18:41 +00:00
..
alpha vm: add VM_FAULT_SIGSEGV handling support 2015-02-04 10:58:27 +00:00
arc ARC: dw2 unwind: Ignore CIE version !=1 gracefully instead of bailing 2016-01-25 10:43:41 +00:00
arm net: filter: make JITs zero A for SKF_AD_ALU_XOR_X 2016-01-25 10:44:05 +00:00
arm64 arm64: errata: Add -mpc-relative-literal-loads to build flags 2016-02-17 10:22:40 +00:00
avr32 avr32: handle NULL as a valid clock object 2015-08-25 10:13:52 +01:00
blackfin blackfin: vmlinux.lds.S: reserve 32 bytes space at the end of data section for XIP kernel 2014-07-26 08:32:50 +08:00
c6x C6x: time: Ensure consistency in __init 2015-05-06 11:33:02 +01:00
cris vm: add VM_FAULT_SIGSEGV handling support 2015-02-04 10:58:27 +00:00
frv vm: add VM_FAULT_SIGSEGV handling support 2015-02-04 10:58:27 +00:00
hexagon Hexagon: Delete stale barrier.h 2014-05-01 10:09:47 -07:00
ia64 efi/reboot: Add generic wrapper around EfiResetSystem() 2015-05-12 09:36:34 +01:00
m32r m32r: fix m32104ut_defconfig build fail 2016-02-02 19:09:43 +00:00
m68k m68k: Define asmlinkage_protect 2015-10-19 14:31:37 +01:00
metag metag: Fix KSTK_EIP() and KSTK_ESP() macros 2015-03-18 09:58:55 +00:00
microblaze vm: add VM_FAULT_SIGSEGV handling support 2015-02-04 10:58:27 +00:00
mips MIPS: Fix buffer overflow in syscall_get_arguments() 2016-02-25 00:18:41 +00:00
mn10300 mn10300: Select CONFIG_HAVE_UID16 to fix build failure 2016-02-03 00:09:10 +00:00
openrisc openrisc: fix CONFIG_UID16 setting 2016-02-03 09:51:34 +00:00
parisc parisc: Fix __ARCH_SI_PREAMBLE_SIZE 2016-02-02 19:09:34 +00:00
powerpc powerpc/perf: Remove PPMU_HAS_SSLOT flag for Power8 2016-02-17 10:22:48 +00:00
s390 s390: fix normalization bug in exception table sorting 2016-02-02 19:09:26 +00:00
score vm: add VM_FAULT_SIGSEGV handling support 2015-02-04 10:58:27 +00:00
sh sh64: fix __NR_fgetxattr 2016-01-25 10:43:29 +00:00
sparc sparc64: fix incorrect sign extension in sys_sparc64_personality 2016-02-02 19:09:41 +00:00
tile tile: use free_bootmem_late() for initrd 2015-08-11 09:57:43 +01:00
um uml: flush stdout before forking 2016-02-02 19:09:23 +00:00
unicore32 nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 10:24:18 +01:00
x86 x86/mm/pat: Avoid truncation when converting cpa->numpages to address 2016-02-17 10:22:46 +00:00
xtensa xtensa: nommu: provide _PAGE_CHG_MASK definition 2015-12-13 17:49:46 +00:00
.gitignore arch: Ignore arch/i386 and arch/x86_64 2008-01-19 21:29:39 -08:00
Kconfig uprobes: Kconfig dependency fix 2014-03-18 16:39:33 -04:00