1
0
Fork 0
alistair23-linux/arch/s390/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
..
syscalls s390/kexec_file: Add kexec_file_load system call 2018-04-16 09:10:22 +02:00
vdso32 s390/vdso: revise CFI annotations of vDSO functions 2017-12-13 10:51:36 +01:00
vdso64 s390/vdso: revise CFI annotations of vDSO functions 2017-12-13 10:51:36 +01:00
.gitignore s390: add various .gitignore files. 2012-05-16 14:42:41 +02:00
Makefile s390: introduce compile time check for empty .bss section 2018-05-09 10:55:01 +02:00
als.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
alternative.c s390: add automatic detection of the spectre defense 2018-03-28 08:38:24 +02:00
asm-offsets.c s390/ftrace: use expoline for indirect branches 2018-05-07 21:12:38 +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
audit.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
base.S s390/kernel: use expoline for indirect branches 2018-05-07 21:12:39 +02:00
cache.c 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
compat_linux.c mm: add ksys_readahead() helper; remove in-kernel calls to sys_readahead() 2018-04-02 20:16:12 +02:00
compat_linux.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
compat_ptrace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
compat_signal.c s390/compat: fix setup_frame32 2018-04-10 07:38:54 +02:00
compat_wrapper.c s390/kexec_file: Add kexec_file_load system call 2018-04-16 09:10:22 +02:00
cpcmd.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
crash_dump.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
debug.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
diag.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dis.c s390: kernel: add SPDX identifiers to the remaining files 2017-11-24 15:37:12 +01:00
dumpstack.c s390: kernel: add SPDX identifiers to the remaining files 2017-11-24 15:37:12 +01:00
early.c s390/early: move functions which may not access bss section to extra file 2018-05-09 10:55:01 +02:00
early_nobss.c s390/early: move functions which may not access bss section to extra file 2018-05-09 10:55:01 +02:00
early_printk.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ebcdic.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
entry.S s390: move expoline assembler macros to a header 2018-05-07 09:07:32 +02:00
entry.h s390/early: move functions which may not access bss section to extra file 2018-05-09 10:55:01 +02:00
fpu.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ftrace.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
guarded_storage.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2017-11-13 11:47:01 -08:00
head.S s390/head: replace hard coded values with constants 2018-01-23 07:36:46 +01:00
head64.S s390/early: move functions which may not access bss section to extra file 2018-05-09 10:55:01 +02:00
head_kdump.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
idle.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ipl.c s390/ipl: remove reipl_method and dump_method 2018-04-10 07:39:00 +02:00
irq.c s390: remove indirect branch from do_softirq_own_stack 2018-05-07 21:12:42 +02:00
jump_label.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kdebugfs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kexec_elf.c s390/kexec_file: Add ELF loader 2018-04-16 09:10:23 +02:00
kexec_image.c s390/kexec_file: Add crash support to image loader 2018-04-16 09:10:22 +02:00
kprobes.c bpf/error-inject/kprobes: Clear current_kprobe and enable preempt in kprobe 2018-06-21 12:33:19 +02:00
lgr.c s390: kernel: add SPDX identifiers to the remaining files 2017-11-24 15:37:12 +01:00
machine_kexec.c s390/ipl: correct kdump reipl block checksum calculation 2018-04-10 07:39:00 +02:00
machine_kexec_file.c s390/kexec_file: Add ELF loader 2018-04-16 09:10:23 +02:00
mcount.S s390/ftrace: use expoline for indirect branches 2018-05-07 21:12:38 +02:00
module.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
nmi.c headers: untangle kmemleak.h from mm.h 2018-04-05 21:36:27 -07:00
nospec-branch.c s390: remove closung punctuation from spectre messages 2018-05-09 10:55:01 +02:00
nospec-sysfs.c s390: move spectre sysfs attribute code 2018-05-07 21:12:41 +02:00
os_info.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf_cpum_cf.c s390: kernel: Remove redundant license text 2017-11-24 15:37:20 +01:00
perf_cpum_cf_events.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
perf_cpum_sf.c s390/cpum_sf: ensure sample frequency of perf event attributes is non-zero 2018-05-08 15:56:36 +02:00
perf_event.c s390: kernel: Remove redundant license text 2017-11-24 15:37:20 +01:00
perf_regs.c s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
pgm_check.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
process.c s390: update sampling tag after task pid change 2018-04-23 07:57:17 +02:00
processor.c s390: run user space and KVM guests with modified branch prediction 2018-02-05 14:48:50 +01:00
ptrace.c s390/gs: add compat regset for the guarded storage broadcast control block 2017-11-28 17:33:15 +01:00
reipl.S s390/kernel: use expoline for indirect branches 2018-05-07 21:12:39 +02:00
relocate_kernel.S s390: assume diag308 set always works 2018-04-10 07:38:59 +02:00
runtime_instr.c s390/runtime_instrumentation: re-add signum system call parameter 2018-02-05 07:34:50 +01:00
setup.c s390: add support for IBM z14 Model ZR1 2018-04-16 09:10:24 +02:00
signal.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 headers: untangle kmemleak.h from mm.h 2018-04-05 21:36:27 -07:00
stacktrace.c s390: kernel: add SPDX identifiers to the remaining files 2017-11-24 15:37:12 +01:00
sthyi.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
suspend.c s390: unify linker symbols usage 2018-02-27 08:05:23 +01:00
swsusp.S s390/kernel: use expoline for indirect branches 2018-05-07 21:12:39 +02:00
sys_s390.c mm: add ksys_mmap_pgoff() helper; remove in-kernel calls to sys_mmap_pgoff() 2018-04-02 20:16:11 +02:00
sysinfo.c proc: introduce proc_create_single{,_data} 2018-05-16 07:23:35 +02:00
time.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2017-11-30 08:13:36 -08:00
topology.c treewide: Use DEVICE_ATTR_RW 2018-01-09 16:33:31 +01:00
trace.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
traps.c signal/s390: Use force_sig_fault where appropriate 2018-04-25 10:44:08 -05:00
uprobes.c s390/uprobes: implement arch_uretprobe_is_alive() 2018-04-23 07:57:16 +02:00
vdso.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
vmlinux.lds.S s390: remove no-op macro VMLINUX_SYMBOL() 2018-05-23 08:06:55 +02:00
vtime.c s390: kernel: add SPDX identifiers to the remaining files 2017-11-24 15:37:12 +01:00