linux-stable/arch/mips
James Hogan de8cd0dc83 MIPS/ptrace: Update syscall nr on register changes
Update the thread_info::syscall field when registers are modified via
ptrace to change or cancel the system call being entered.

This is important to allow seccomp and the syscall entry and exit trace
events to observe the new syscall number changed by the normal ptrace
hook or seccomp. That includes allowing seccomp's recheck of the system
call number after SECCOMP_RET_TRACE to notice if the syscall is changed
to a denied one, which happens in seccomp since commit ce6526e8af
("seccomp: recheck the syscall after RET_TRACE") in v4.8.

In the process of doing this, the logic to determine whether an indirect
system call is in progress (i.e. the O32 ABI's syscall()) is abstracted
into mips_syscall_is_indirect(), and a new mips_syscall_update_nr() is
used to update the thread_info::syscall based on the register state.

The following ptrace operations are updated:
 - PTRACE_SETREGS (ptrace_setregs()).
 - PTRACE_SETREGSET with NT_PRSTATUS (gpr32_set() and gpr64_set()).
 - PTRACE_POKEUSR with 2/v0 or 4/a0 for indirect syscall
   ([compat_]arch_ptrace()).

Fixes: c2d9f17757 ("MIPS: Fix syscall_get_nr for the syscall exit tracing.")
Signed-off-by: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Lars Persson <larper@axis.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Will Drewry <wad@chromium.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16995/
2017-11-09 15:13:58 +00:00
..
alchemy MIPS: Alchemy: make clk_ops const 2017-11-07 18:33:16 +00:00
ar7 MIPS: AR7: allow NULL clock for clk_get_rate 2017-09-06 12:35:21 +02:00
ath25
ath79 MIPS: PCI: Move map_irq() hooks out of initdata 2017-09-19 14:55:26 -05:00
bcm47xx MIPS: BCM47XX: Fix LED inversion for WRT54GSv1 2017-11-07 22:40:31 +00:00
bcm63xx MIPS: BCM63XX: split out swpkt_sar/usb clocks 2017-11-07 18:33:20 +00:00
bmips
boot MIPS: generic: Add support for MIPSfpga 2017-11-08 22:53:44 +00:00
cavium-octeon MIPS: Octeon: Remove usage of cvmx_wait() everywhere. 2017-11-07 18:33:14 +00:00
cobalt
configs MIPS: Xilfpga: Switch to using generic defconfigs 2017-11-08 22:54:14 +00:00
dec
emma
fw
generic MIPS: generic: Add support for MIPSfpga 2017-11-08 22:53:44 +00:00
include MIPS/ptrace: Update syscall nr on register changes 2017-11-09 15:13:58 +00:00
jazz
jz4740
kernel MIPS/ptrace: Update syscall nr on register changes 2017-11-09 15:13:58 +00:00
kvm kvm,mips: Fix potential swait_active() races 2017-09-15 16:57:13 +02:00
lantiq MIPS: Lantiq: Fix ASC0/ASC1 clocks 2017-11-07 22:40:15 +00:00
lasat MIPS: Lasat: Use setup_timer() helper 2017-11-08 22:12:15 +00:00
lib MIPS: Add __ioread64_copy 2017-09-04 13:53:14 +02:00
loongson32
loongson64 MIPS: Loongson 2F: allow NULL clock for clk_get_rate 2017-09-06 12:36:59 +02:00
math-emu MIPS: math-emu: Use preferred flavor of unsigned integer declarations 2017-11-07 18:33:16 +00:00
mm MIPS: Remove unused variable 'lastpfn' 2017-10-09 14:53:57 +02:00
mti-malta irqchip: mips-gic: Move gic_get_c0_*_int() to asm/mips-gic.h 2017-09-04 13:53:14 +02:00
net
netlogic Merge branch '4.14-features' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2017-09-15 20:43:33 -07:00
oprofile MIPS: Abstract CPU core & VP(E) ID access through accessor functions 2017-08-30 00:57:26 +02:00
paravirt MIPS: SMP: Allow boot_secondary SMP op to return errors 2017-08-30 00:57:27 +02:00
pci MIPS: Octeon: Remove usage of cvmx_wait() everywhere. 2017-11-07 18:33:14 +00:00
pic32
pistachio MIPS: Remove unnecessary inclusions of linux/irqchip/mips-gic.h 2017-09-04 13:53:14 +02:00
pmcs-msp71xx MIPS: MSP71xx: Include asm/setup.h 2017-09-21 16:15:17 +02:00
pnx833x
power
ralink MIPS: ralink: Drop obsolete USB_ARCH_HAS_HCD select 2017-11-08 10:23:36 +00:00
rb532
sgi-ip22
sgi-ip27 MIPS: SMP: Allow boot_secondary SMP op to return errors 2017-08-30 00:57:27 +02:00
sgi-ip32
sibyte MIPS: SMP: Allow boot_secondary SMP op to return errors 2017-08-30 00:57:27 +02:00
sni
tools MIPS: generic: Allow filtering enabled boards by requirements 2017-08-30 00:57:28 +02:00
txx9 MIPS: PCI: Move map_irq() hooks out of initdata 2017-09-19 14:55:26 -05:00
vdso MIPS: Add DWARF unwinding to assembly 2017-09-06 11:01:52 +02:00
vr41xx
Kbuild
Kbuild.platforms MIPS: Xilfpga: Switch to using generic defconfigs 2017-11-08 22:54:14 +00:00
Kconfig MIPS: Xilfpga: Switch to using generic defconfigs 2017-11-08 22:54:14 +00:00
Kconfig.debug
Makefile MIPS: Xilfpga: Switch to using generic defconfigs 2017-11-08 22:54:14 +00:00
Makefile.postlink