Star64_linux/arch/sparc/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
..
.gitignore
adi_64.c sparc64: Add support for ADI (Application Data Integrity) 2018-03-18 07:38:48 -07:00
apc.c
asm-offsets.c
audit.c
auxio_32.c
auxio_64.c
btext.c
central.c
cherrs.S
chmc.c
compat_audit.c
cpu.c
cpumap.c
cpumap.h
devices.c
ds.c
dtlb_miss.S
dtlb_prot.S
ebus.c
entry.h sparc64: Add support for ADI register fields, ASIs and traps 2018-03-18 07:38:45 -07:00
entry.S sparc: get rid of asm wrapper for nis_syscall() 2018-03-20 12:05:17 -04:00
etrap_32.S
etrap_64.S sparc64: Add support for ADI (Application Data Integrity) 2018-03-18 07:38:48 -07:00
fpu_traps.S
ftrace.c
getsetcc.S
head_32.S
head_64.S sparc64: Add support for ADI register fields, ASIs and traps 2018-03-18 07:38:45 -07:00
helpers.S
hvapi.c sparc64: Oracle DAX infrastructure 2018-01-22 08:17:15 -08:00
hvcalls.S sparc64: Oracle DAX infrastructure 2018-01-22 08:17:15 -08:00
hvtramp.S
idprom.c
iommu-common.c iommu-common: move to arch/sparc 2018-05-09 06:54:27 +02:00
iommu.c iommu-common: move to arch/sparc 2018-05-09 06:54:27 +02:00
iommu_common.h
ioport.c proc: introduce proc_create_single{,_data} 2018-05-16 07:23:35 +02:00
irq.h
irq_32.c
irq_64.c headers: untangle kmemleak.h from mm.h 2018-04-05 21:36:27 -07:00
itlb_miss.S
ivec.S
jump_label.c
kernel.h
kgdb_32.c
kgdb_64.c
kprobes.c bpf/error-inject/kprobes: Clear current_kprobe and enable preempt in kprobe 2018-06-21 12:33:19 +02:00
kstack.h
ktlb.S
ldc.c iommu-common: move to arch/sparc 2018-05-09 06:54:27 +02:00
led.c
leon_kernel.c
leon_pci.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
leon_pci_grpci1.c
leon_pci_grpci2.c
leon_pmc.c
leon_smp.c
Makefile iommu-common: move to arch/sparc 2018-05-09 06:54:27 +02:00
mdesc.c sparc64: Add auxiliary vectors to report platform ADI properties 2018-03-18 07:38:46 -07:00
misctrap.S
module.c
nmi.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
of_device_32.c
of_device_64.c
of_device_common.c
of_device_common.h
pci.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pci_common.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pci_fire.c
pci_impl.h sparc/PCI: Support arbitrary host bridge address offset 2018-02-15 15:07:30 -06:00
pci_msi.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pci_psycho.c
pci_sabre.c
pci_schizo.c
pci_sun4v.c iommu-common: move to arch/sparc 2018-05-09 06:54:27 +02:00
pci_sun4v.h
pci_sun4v_asm.S
pcic.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pcr.c
perf_event.c perf: Fix sibling iteration 2018-03-16 20:44:12 +01:00
pmc.c
power.c
process_32.c
process_64.c signal/sparc: Use force_sig_fault where appropriate 2018-04-25 10:44:10 -05:00
prom.h
prom_32.c
prom_64.c
prom_common.c
prom_irqtrans.c
psycho_common.c
psycho_common.h
ptrace_32.c
ptrace_64.c
reboot.c
rtrap_32.S
rtrap_64.S sparc64: Add support for ADI (Application Data Integrity) 2018-03-18 07:38:48 -07:00
sbus.c
setup_32.c fs: add ksys_sync() helper; remove in-kernel calls to sys_sync() 2018-04-02 20:16:05 +02:00
setup_64.c sparc64: Add support for ADI (Application Data Integrity) 2018-03-18 07:38:48 -07:00
signal32.c signal: Unify and correct copy_siginfo_to_user32 2018-01-15 19:56:20 -06:00
signal_32.c
signal_64.c sparc64: drop unneeded compat include 2018-01-22 08:37:00 -08:00
sigutil.h
sigutil_32.c
sigutil_64.c
smp_32.c
smp_64.c mm: fix races between swapoff and flush dcache 2018-04-05 21:36:26 -07:00
sparc_ksyms.c
spiterrs.S
sstate.c
stacktrace.c
starfire.c
sun4d_irq.c
sun4d_smp.c
sun4m_irq.c
sun4m_smp.c
sun4v_ivec.S
sun4v_mcd.S sparc64: Add support for ADI register fields, ASIs and traps 2018-03-18 07:38:45 -07:00
sun4v_tlb_miss.S
sys32.S sparc: get rid of remaining SIGN... wrappers 2018-03-20 12:01:23 -04:00
sys_sparc32.c Merge branch 'misc.sparc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-04-07 14:30:28 -07:00
sys_sparc_32.c signal/sparc: Use force_sig_fault where appropriate 2018-04-25 10:44:10 -05:00
sys_sparc_64.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
syscalls.S sparc: get rid of asm wrapper for nis_syscall() 2018-03-20 12:05:17 -04:00
sysfs.c
systbls.h sparc: get rid of asm wrapper for nis_syscall() 2018-03-20 12:05:17 -04:00
systbls_32.S switch sparc_remap_file_pages() to SYSCALL_DEFINE 2018-03-20 12:04:00 -04:00
systbls_64.S sparc: switch compat {f,}truncate64() to COMPAT_SYSCALL_DEFINE 2018-03-20 12:05:17 -04:00
time_32.c
time_64.c
trampoline_32.S
trampoline_64.S
traps_32.c signal/sparc: Use force_sig_fault where appropriate 2018-04-25 10:44:10 -05:00
traps_64.c signal/sparc: Use force_sig_fault where appropriate 2018-04-25 10:44:10 -05:00
tsb.S
ttable_32.S
ttable_64.S sparc64: Add support for ADI register fields, ASIs and traps 2018-03-18 07:38:45 -07:00
una_asm_32.S
una_asm_64.S
unaligned_32.c signal/sparc: Use send_sig_fault where appropriate 2018-04-25 10:44:09 -05:00
unaligned_64.c
uprobes.c
urtt_fill.S sparc64: Add support for ADI (Application Data Integrity) 2018-03-18 07:38:48 -07:00
utrap.S
vdso.c
vio.c sparc: vio: use put_device() instead of kfree() 2018-04-30 16:09:34 -04:00
viohs.c
visemul.c
vmlinux.lds.S sparc64: Add support for ADI (Application Data Integrity) 2018-03-18 07:38:48 -07:00
windows.c
winfixup.S
wof.S
wuf.S