linux/arch/sparc/kernel
David S. Miller 2f6c9bf31a sparc: Improve VDSO instruction patching.
The current VDSO patch mechanism has several problems:

1) It assumes how gcc will emit a function, with a register
   window, an initial save instruction and then immediately
   the %tick read when compiling vread_tick().

   There is no such guarantees, code generation could change
   at any time, gcc could put a nop between the save and
   the %tick read, etc.

   So this is extremely fragile and would fail some day.

2) It disallows us to properly inline vread_tick() into the callers
   and thus get the best possible code sequences.

So fix this to patch properly, with location based annotations.

We have to be careful because we cannot do it the way we do
patches elsewhere in the kernel.  Those use a sequence like:

	1:
	insn
	.section	.whatever_patch, "ax"
	.word		1b
	replacement_insn
	.previous

This is a dynamic shared object, so that .word cannot be resolved at
build time, and thus cannot be used to execute the patches when the
kernel initializes the images.

Even trying to use label difference equations doesn't work in the
above kind of scheme:

	1:
	insn
	.section	.whatever_patch, "ax"
	.word		. - 1b
	replacement_insn
	.previous

The assembler complains that it cannot resolve that computation.
The issue is that this is contained in an executable section.

Borrow the sequence used by x86 alternatives, which is:

	1:
	insn
	.pushsection	.whatever_patch, "a"
	.word		. - 1b, . - 1f
	.popsection
	.pushsection	.whatever_patch_replacements, "ax"
	1:
	replacement_insn
	.previous

This works, allows us to inline vread_tick() as much as we like, and
can be used for arbitrary kinds of VDSO patching in the future.

Also, reverse the condition for patching.  Most systems are %stick
based, so if we only patch on %tick systems the patching code will
get little or no testing.

Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-22 15:22:14 -07:00
..
.gitignore
adi_64.c sparc64: Add support for ADI (Application Data Integrity) 2018-03-18 07:38:48 -07:00
apc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
asm-offsets.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01: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
auxio_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
auxio_64.c Revert "sparc: Convert to using %pOFn instead of device_node.name" 2018-10-15 18:32:54 -07:00
btext.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
central.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cherrs.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
chmc.c sparc: kernel: drop owner assignment from platform_drivers 2014-10-20 16:20:15 +02: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.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cpumap.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cpumap.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
devices.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ds.c sparc64: Fix build warnings with gcc 7. 2017-06-01 09:42:46 -07:00
dtlb_miss.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dtlb_prot.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ebus.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
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 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
etrap_64.S sparc64: Add support for ADI (Application Data Integrity) 2018-03-18 07:38:48 -07:00
fpu_traps.S 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
getsetcc.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
head_32.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
head_64.S sparc64: Add support for ADI register fields, ASIs and traps 2018-03-18 07:38:45 -07:00
helpers.S sparc: move exports to definitions 2016-08-07 23:55:43 -04:00
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 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
idprom.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
iommu_common.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
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
ioport.c sparc: use generic dma_noncoherent_ops 2018-08-21 12:37:16 -07:00
irq_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
irq_64.c headers: untangle kmemleak.h from mm.h 2018-04-05 21:36:27 -07:00
irq.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
itlb_miss.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ivec.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01: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
kernel.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kgdb_32.c sparc32: fix fall-through annotation 2018-10-07 22:42:02 -07:00
kgdb_64.c sparc64: fix fall-through annotation 2018-10-07 22:42:02 -07:00
kprobes.c bpf/error-inject/kprobes: Clear current_kprobe and enable preempt in kprobe 2018-06-21 12:33:19 +02:00
kstack.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ktlb.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ldc.c iommu-common: move to arch/sparc 2018-05-09 06:54:27 +02:00
led.c sparc/led: Convert timers to use timer_setup() 2017-11-15 14:27:50 +09:00
leon_kernel.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
leon_pci_grpci1.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
leon_pci_grpci2.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
leon_pci.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
leon_pmc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
leon_smp.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
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 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
module.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nmi.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
of_device_32.c sparc: set a default 32-bit dma mask for OF devices 2018-09-02 10:02:04 +02:00
of_device_64.c sparc: set a default 32-bit dma mask for OF devices 2018-09-02 10:02:04 +02:00
of_device_common.c sparc: fix sparse warnings in of_device_common.c 2014-04-29 01:12:27 -04:00
of_device_common.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci_common.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pci_fire.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
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 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci_sabre.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci_schizo.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci_sun4v_asm.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci_sun4v.c iommu-common: move to arch/sparc 2018-05-09 06:54:27 +02:00
pci_sun4v.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pcic.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pcr.c sparc: perf: Add support M7 processor 2015-03-19 18:54:49 -07:00
perf_event.c sparc: Throttle perf events properly. 2018-10-12 10:33:20 -07:00
pmc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
power.c Revert "sparc: Convert to using %pOFn instead of device_node.name" 2018-10-15 18:32:54 -07:00
process_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
process_64.c signal/sparc: Use force_sig_fault where appropriate 2018-04-25 10:44:10 -05:00
prom_32.c Revert "sparc: Convert to using %pOFn instead of device_node.name" 2018-10-15 18:32:54 -07:00
prom_64.c Revert "sparc: Convert to using %pOFn instead of device_node.name" 2018-10-15 18:32:54 -07:00
prom_common.c
prom_irqtrans.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
prom.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
psycho_common.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
psycho_common.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ptrace_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ptrace_64.c sparc64: Fill in rest of HAVE_REGS_AND_STACK_ACCESS_API 2017-04-23 17:15:51 -07:00
reboot.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rtrap_32.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rtrap_64.S sparc64: Set %l4 properly on trap return after handling signals. 2018-10-14 20:22:28 -07:00
sbus.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
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 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
signal_64.c sparc64: drop unneeded compat include 2018-01-22 08:37:00 -08:00
sigutil_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sigutil_64.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sigutil.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
smp_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
smp_64.c mm: fix races between swapoff and flush dcache 2018-04-05 21:36:26 -07:00
sparc_ksyms.c sparc: move exports to definitions 2016-08-07 23:55:43 -04:00
spiterrs.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sstate.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stacktrace.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/debug.h> 2017-03-02 08:42:34 +01:00
starfire.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sun4d_irq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sun4d_smp.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sun4m_irq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sun4m_smp.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sun4v_ivec.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
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 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
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 sys: don't hold uts_sem while accessing userspace memory 2018-08-11 02:05:53 -05:00
sys_sparc_64.c sys: don't hold uts_sem while accessing userspace memory 2018-08-11 02:05:53 -05:00
syscalls.S sparc: get rid of asm wrapper for nis_syscall() 2018-03-20 12:05:17 -04:00
sysfs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
systbls_32.S sparc: Wire up io_pgetevents system call. 2018-10-09 16:52:38 -07:00
systbls_64.S sparc: Wire up io_pgetevents system call. 2018-10-09 16:52:38 -07:00
systbls.h sparc: get rid of asm wrapper for nis_syscall() 2018-03-20 12:05:17 -04:00
time_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
time_64.c sparc: Improve VDSO instruction patching. 2018-10-22 15:22:14 -07:00
trampoline_32.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
trampoline_64.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
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 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ttable_32.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
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 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
una_asm_64.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
unaligned_32.c signal/sparc: Use send_sig_fault where appropriate 2018-04-25 10:44:09 -05:00
unaligned_64.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
uprobes.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
urtt_fill.S sparc64: Add support for ADI (Application Data Integrity) 2018-03-18 07:38:48 -07:00
utrap.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vdso.c vDSO for sparc 2017-11-15 14:21:03 +09:00
vio.c sparc: vio: use put_device() instead of kfree() 2018-04-30 16:09:34 -04:00
viohs.c sparc64: viohs: Remove VLA usage 2018-10-07 22:42:00 -07:00
visemul.c 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 sparc64: Add support for ADI (Application Data Integrity) 2018-03-18 07:38:48 -07:00
windows.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
winfixup.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
wof.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
wuf.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00