1
0
Fork 0
alistair23-linux/arch/powerpc/kernel
Masami Hiramatsu cce188bd58 bpf/error-inject/kprobes: Clear current_kprobe and enable preempt in kprobe
Clear current_kprobe and enable preemption in kprobe
even if pre_handler returns !0.

This simplifies function override using kprobes.

Jprobe used to require to keep the preemption disabled and
keep current_kprobe until it returned to original function
entry. For this reason kprobe_int3_handler() and similar
arch dependent kprobe handers checks pre_handler result
and exit without enabling preemption if the result is !0.

After removing the jprobe, Kprobes does not need to
keep preempt disabled even if user handler returns !0
anymore.

But since the function override handler in error-inject
and bpf is also returns !0 if it overrides a function,
to balancing the preempt count, it enables preemption
and reset current kprobe by itself.

That is a bad design that is very buggy. This fixes
such unbalanced preempt-count and current_kprobes setting
in kprobes, bpf and error-inject.

Note: for powerpc and x86, this removes all preempt_disable
from kprobe_ftrace_handler because ftrace callbacks are
called under preempt disabled.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: James Hogan <jhogan@kernel.org>
Cc: Josef Bacik <jbacik@fb.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: linux-arch@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-ia64@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-s390@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: sparclinux@vger.kernel.org
Link: https://lore.kernel.org/lkml/152942494574.15209.12323837825873032258.stgit@devbox
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-06-21 12:33:19 +02:00
..
trace powerpc/kprobes: Remove jprobe powerpc implementation 2018-06-21 12:33:08 +02:00
vdso32 powerpc/kbuild: Remove CROSS32 defines from top level powerpc Makefile 2018-06-01 23:08:06 +10:00
vdso64 powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE 2017-12-04 15:01:09 +11:00
.gitignore
Makefile powerpc updates for 4.17 2018-04-07 12:08:19 -07:00
align.c powerpc/sstep: Introduce GETTYPE macro 2018-06-03 21:19:40 +10:00
asm-offsets.c Merge tag 'kvm-ppc-next-4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc into HEAD 2018-06-14 17:42:54 +02:00
audit.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
btext.c powerpc: Make function btext_initialize static 2018-05-25 12:04:44 +10:00
cacheinfo.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
cacheinfo.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
compat_audit.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cpu_setup_6xx.S powerpc: Free up CPU feature bits on 64-bit machines 2018-03-24 00:38:51 +11:00
cpu_setup_44x.S
cpu_setup_fsl_booke.S powerpc: Free up CPU feature bits on 64-bit machines 2018-03-24 00:38:51 +11:00
cpu_setup_pa6t.S
cpu_setup_power.S powerpc/64s: Clear PCR on boot 2018-05-18 16:05:15 +10:00
cpu_setup_ppc970.S
cputable.c powerpc/64s: Remove POWER4 support 2018-04-01 00:47:50 +11:00
crash.c powerpc/64: Use array of paca pointers and allocate pacas individually 2018-03-30 23:34:23 +11:00
crash_dump.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
dbell.c powerpc: Introduce msgsnd/doorbell barrier primitives 2017-04-13 23:34:33 +10:00
dma-iommu.c powerpc: rename dma_direct_ to dma_nommu_ 2018-01-10 16:41:14 +01:00
dma-swiotlb.c swiotlb: rename swiotlb_free to swiotlb_exit 2018-01-15 09:35:39 +01:00
dma.c powerpc updates for 4.18 2018-06-07 10:23:33 -07:00
dt_cpu_ftrs.c powerpc: Add TIDR CPU feature for POWER9 2018-06-03 20:40:31 +10:00
eeh.c powerpc updates for 4.18 2018-06-07 10:23:33 -07:00
eeh_cache.c powerpc/eeh: Fix misleading comment in __eeh_addr_cache_get_device() 2018-03-27 23:44:58 +11:00
eeh_dev.c powerpc/eeh: Create PHB PEs after EEH is initialized 2017-09-21 14:56:00 +10:00
eeh_driver.c powerpc/eeh: Refactor report functions 2018-06-03 20:43:41 +10:00
eeh_event.c powerpc/eeh: Manage EEH_PE_RECOVERING inside eeh_handle_normal_event() 2018-03-27 23:44:58 +11:00
eeh_pe.c powerpc/eeh: Introduce eeh_for_each_pe() 2018-06-03 20:43:39 +10:00
eeh_sysfs.c powerpc/eeh: Add EEH notify resume sysfs 2018-01-27 20:02:52 +11:00
entry_32.S powerpc: Add syscall detection for restartable sequences 2018-06-06 11:58:33 +02:00
entry_64.S Merge branch 'core-rseq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-06-10 10:17:09 -07:00
epapr_hcalls.S ppc: move exports to definitions 2016-08-07 23:50:09 -04:00
epapr_paravirt.c
exceptions-64e.S powerpc/64s: Fix may_hard_irq_enable() for PMI soft masking 2018-02-08 23:56:10 +11:00
exceptions-64s.S powerpc updates for 4.18 2018-06-07 10:23:33 -07:00
fadump.c powerpc/fadump: Unregister fadump on kexec down path. 2018-05-03 23:19:30 +10:00
firmware.c
fpu.S Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2016-10-14 14:26:58 -07:00
fsl_booke_entry_mapping.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
head_8xx.S powerpc/8xx: fix invalid register expression in head_8xx.S 2018-05-25 00:08:26 +10:00
head_32.S powerpc: Fix DABR match on hash based systems 2017-11-13 22:12:48 +11:00
head_40x.S ppc: move exports to definitions 2016-08-07 23:50:09 -04:00
head_44x.S ppc: move exports to definitions 2016-08-07 23:50:09 -04:00
head_64.S powerpc/64: Use array of paca pointers and allocate pacas individually 2018-03-30 23:34:23 +11:00
head_booke.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
head_fsl_booke.S ppc: move exports to definitions 2016-08-07 23:50:09 -04:00
hw_breakpoint.c powerpc/ptrace: Fix enforcement of DAWR constraints 2018-05-21 14:47:44 +10:00
idle.c
idle_6xx.S
idle_book3e.S powerpc/64: Rename soft_enabled to irq_soft_mask 2018-01-19 22:37:01 +11:00
idle_book3s.S powerpc/kvm: Fix lockups when running KVM guests on Power8 2018-04-19 16:22:20 +10:00
idle_e500.S powerpc/e500mc: Remove dead L2 flushing code in idle_e500.S 2015-06-02 21:37:19 -05:00
idle_power4.S powerpc/64: Rename soft_enabled to irq_soft_mask 2018-01-19 22:37:01 +11:00
ima_kexec.c powerpc: ima: send the kexec buffer to the next kernel 2016-12-20 09:48:44 -08:00
io-workarounds.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
io.c
iomap.c powerpc: iomap.c: introduce io{read|write}64_{lo_hi|hi_lo} 2018-04-05 14:59:26 +10:00
iommu.c powerpc/iommu: Use permission-specific DEVICE_ATTR variants 2017-09-01 16:42:54 +10:00
irq.c powerpc/time: account broadcast timer event interrupts separately 2018-06-03 20:40:29 +10:00
isa-bridge.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
jump_label.c jump_label: Rename JUMP_LABEL_{EN,DIS}ABLE to JUMP_LABEL_{JMP,NOP} 2015-08-03 11:34:12 +02:00
kexec_elf_64.c kernel/kexec_file.c: allow archs to set purgatory load address 2018-04-13 17:10:28 -07:00
kgdb.c powerpc/8xx: Getting rid of remaining use of CONFIG_8xx 2017-08-10 23:32:12 +10:00
kprobes-ftrace.c bpf/error-inject/kprobes: Clear current_kprobe and enable preempt in kprobe 2018-06-21 12:33:19 +02:00
kprobes.c bpf/error-inject/kprobes: Clear current_kprobe and enable preempt in kprobe 2018-06-21 12:33:19 +02:00
kvm.c powerpc/kvm: Prefer fault_in_pages_readable function 2018-05-17 14:12:40 +10:00
kvm_emul.S
l2cr_6xx.S powerpc/l2cr_6xx: Fix invalid use of register expressions 2017-08-15 21:04:32 +10:00
legacy_serial.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
machine_kexec.c powerpc64/kexec: Hard disable ftrace before switching to the new kernel 2018-05-03 22:32:27 +10:00
machine_kexec_32.c
machine_kexec_64.c powerpc/64/kexec: fix race in kexec when XIVE is shutdown 2018-05-10 23:25:08 +10:00
machine_kexec_file_64.c kexec_file,x86,powerpc: factor out kexec_file_ops functions 2018-04-13 17:10:27 -07:00
mce.c powerpc updates for 4.16 2018-02-02 10:01:04 -08:00
mce_power.c powerpc/mce: Fix a bug where mce loops on memory UE. 2018-04-24 13:54:51 +10:00
misc.S powerpc/misc: merge reloc_offset() and add_reloc_offset() 2018-06-04 00:39:17 +10:00
misc_32.S powerpc/40x: Clear MSR_DR in one insn instead of two 2017-06-02 19:20:43 +10:00
misc_64.S powerpc: Remove unused flush_dcache_phys_range() 2018-03-20 16:47:53 +11:00
module.c powerpc/64s: Patch barrier_nospec in modules 2018-06-03 20:43:44 +10:00
module.lds powerpc/modules: Fix alignment of .toc section in kernel modules 2017-12-11 13:03:35 +11:00
module_32.c powerpc/sparse: Fix plain integer as NULL pointer warning 2018-05-25 12:04:38 +10:00
module_64.c powerpc/kbuild: move -mprofile-kernel check to Kconfig 2018-06-11 09:16:29 +09:00
msi.c powerpc: Remove MSI-related PCI controller ops from ppc_md 2015-06-02 11:47:45 +10:00
nvram_64.c powerpc/64: Fix strncpy() related build failures with GCC 8.1 2018-06-03 20:40:24 +10:00
of_platform.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
optprobes.c powerpc/kprobes: Do not disable interrupts for optprobes and kprobes_on_ftrace 2017-11-12 23:51:41 +11:00
optprobes_head.S powerpc/64: Rename soft_enabled to irq_soft_mask 2018-01-19 22:37:01 +11:00
paca.c Merge branch 'topic/paca' into next 2018-03-31 09:09:36 +11:00
pci-common.c powerpc/pci: Use generic pci_mmap_resource_range() 2018-02-28 16:18:53 -06:00
pci-hotplug.c powerpc/pci: Unroll two pass loop when scanning bridges 2017-12-18 23:05:52 -06:00
pci_32.c powerpc: fix build failure by disabling attribute-alias warning in pci_32 2018-06-05 21:34:20 +10:00
pci_64.c powerpc: Fix build by disabling attribute-alias warning for SYSCALL_DEFINEx 2018-06-03 20:40:24 +10:00
pci_dn.c powerpc/pci: Separate SR-IOV Calls 2017-12-11 13:03:35 +11:00
pci_of_scan.c pci-v4.16-changes 2018-02-06 09:59:40 -08:00
pmc.c
ppc32.h
ppc_save_regs.S powerpc/32: Use stmw/lmw for registers save/restore in asm 2018-05-18 00:09:06 +10:00
proc_powerpc.c powerpc: Use octal numbers for file permissions 2018-01-22 05:48:33 +11:00
process.c powerpc updates for 4.18 2018-06-07 10:23:33 -07:00
prom.c powerpc/prom: Drop support for old FDT versions 2018-05-11 23:29:04 +10:00
prom_init.c powerpc/prom: Fix %u/%llx usage since prom_printf() change 2018-06-02 01:48:11 +10:00
prom_init_check.sh powerpc/mm/radix: Update command line parsing for disable_radix 2018-04-04 16:59:50 +10:00
prom_parse.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ptrace.c powerpc/ptrace: Use copy_{from, to}_user() rather than open-coding 2018-06-03 20:43:41 +10:00
ptrace32.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
reloc_32.S
reloc_64.S powerpc/asm: Convert .llong directives to .8byte 2017-08-31 14:26:47 +10:00
rtas-proc.c powerpc updates for 4.18 2018-06-07 10:23:33 -07:00
rtas-rtc.c powerpc: use time64_t in read_persistent_clock 2018-06-03 20:43:33 +10:00
rtas.c powerpc: Fix build by disabling attribute-alias warning for SYSCALL_DEFINEx 2018-06-03 20:40:24 +10:00
rtas_flash.c powerpc: Use octal numbers for file permissions 2018-01-22 05:48:33 +11:00
rtas_pci.c powerpc/kernel: Change retrieval of pci_dn 2017-08-31 14:26:40 +10:00
rtasd.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
security.c powerpc updates for 4.18 2018-06-07 10:23:33 -07:00
setup-common.c powerpc/tau: Synchronize function prototypes and body 2018-05-25 12:04:43 +10:00
setup.h powerpc/tau: Synchronize function prototypes and body 2018-05-25 12:04:43 +10:00
setup_32.c powerpc/32: Add missing prototypes for (early|machine)_init() 2018-03-13 15:50:42 +11:00
setup_64.c powerpc64/ftrace: Delay enabling ftrace on secondary cpus 2018-05-03 22:32:26 +10:00
signal.c Merge branch 'core-rseq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-06-10 10:17:09 -07:00
signal.h powerpc/syscalls: signal_{32, 64} - switch to SYSCALL_DEFINE 2018-05-10 23:25:13 +10:00
signal_32.c powerpc/signal32: Use fault_in_pages_readable() to prefault user context 2018-06-04 00:39:18 +10:00
signal_64.c powerpc: Fix build by disabling attribute-alias warning for SYSCALL_DEFINEx 2018-06-03 20:40:24 +10:00
smp-tbsync.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
smp.c powerpc/nmi: Add an API for sending "safe" NMIs 2018-06-03 20:43:43 +10:00
stacktrace.c powerpc/stacktrace: Update copyright 2018-06-03 20:43:43 +10:00
suspend.c
swsusp.c powerpc/swsusp: Include suspend.h to silence sparse warnings 2017-03-20 19:02:49 +11:00
swsusp_32.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
swsusp_64.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/nmi.h> 2017-03-02 08:42:30 +01:00
swsusp_asm64.S powerpc: Fix invalid use of register expressions 2017-08-10 22:29:41 +10:00
swsusp_booke.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sys_ppc32.c powerpc/syscalls: kill ppc32_select() 2018-05-10 23:25:15 +10:00
syscalls.c powerpc: Fix build by disabling attribute-alias warning for SYSCALL_DEFINEx 2018-06-03 20:40:24 +10:00
sysfs.c Merge branch 'topic/paca' into next 2018-03-31 09:09:36 +11:00
systbl.S powerpc/syscalls: Add COMPAT_SPU_NEW() macro 2018-05-10 23:25:14 +10:00
systbl_chk.c powerpc/syscalls: Add COMPAT_SPU_NEW() macro 2018-05-10 23:25:14 +10:00
systbl_chk.sh powerpc: Make it clearer that systbl check errors are errors 2018-05-10 23:25:16 +10:00
tau_6xx.c powerpc/tau: Make some function static 2018-05-25 12:04:44 +10:00
time.c powerpc/time: inline arch_vtime_task_switch() 2018-06-04 00:39:20 +10:00
tm.S powerpc: Export tm_enable()/tm_disable/tm_abort() APIs 2018-05-24 16:04:02 +10:00
traps.c signal/powerpc: Replace TRAP_FIXME with TRAP_UNK 2018-04-25 10:40:58 -05:00
udbg.c
udbg_16550.c
uprobes.c powerpc/uprobes: Implement arch_uretprobe_is_alive() 2017-08-24 16:19:21 +10:00
vdso.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
vecemu.c powerpc: Add a missing include header 2018-05-25 12:04:46 +10:00
vector.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vmlinux.lds.S powerpc updates for 4.18 2018-06-07 10:23:33 -07:00
watchdog.c powerpc/watchdog: provide more data in watchdog messages 2018-05-10 23:25:11 +10:00