linux_dsm_epyc7002/arch/arm64/include/asm
Jiri Slaby 30d6e0a419 futex: Remove duplicated code and fix undefined behaviour
There is code duplicated over all architecture's headers for
futex_atomic_op_inuser. Namely op decoding, access_ok check for uaddr,
and comparison of the result.

Remove this duplication and leave up to the arches only the needed
assembly which is now in arch_futex_atomic_op_inuser.

This effectively distributes the Will Deacon's arm64 fix for undefined
behaviour reported by UBSAN to all architectures. The fix was done in
commit 5f16a046f8 (arm64: futex: Fix undefined behaviour with
FUTEX_OP_OPARG_SHIFT usage). Look there for an example dump.

And as suggested by Thomas, check for negative oparg too, because it was
also reported to cause undefined behaviour report.

Note that s390 removed access_ok check in d12a29703 ("s390/uaccess:
remove pointless access_ok() checks") as access_ok there returns true.
We introduce it back to the helper for the sake of simplicity (it gets
optimized away anyway).

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> [s390]
Acked-by: Chris Metcalf <cmetcalf@mellanox.com> [for tile]
Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org>
Reviewed-by: Will Deacon <will.deacon@arm.com> [core/arm64]
Cc: linux-mips@linux-mips.org
Cc: Rich Felker <dalias@libc.org>
Cc: linux-ia64@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: peterz@infradead.org
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: sparclinux@vger.kernel.org
Cc: Jonas Bonn <jonas@southpole.se>
Cc: linux-s390@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: linux-hexagon@vger.kernel.org
Cc: Helge Deller <deller@gmx.de>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: linux-snps-arc@lists.infradead.org
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-xtensa@linux-xtensa.org
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: openrisc@lists.librecores.org
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Stafford Horne <shorne@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Richard Henderson <rth@twiddle.net>
Cc: Chris Zankel <chris@zankel.net>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-parisc@vger.kernel.org
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: linux-alpha@vger.kernel.org
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: "David S. Miller" <davem@davemloft.net>
Link: http://lkml.kernel.org/r/20170824073105.3901-1-jslaby@suse.cz
2017-08-25 22:49:59 +02:00
..
xen arm/arm64: xen: Move shared architecture headers to include/xen/arm 2016-12-02 11:49:55 -08:00
acenv.h
acpi.h ARM64/ACPI: Fix BAD_MADT_GICC_ENTRY() macro implementation 2017-06-02 15:13:52 +01:00
alternative.h arm64: Fix circular include of asm/lse.h through linux/jump_label.h 2016-11-05 20:59:06 +00:00
arch_gicv3.h arm64/kvm: sysreg: fix typo'd SYS_ICC_IGRPEN*_EL1 2017-06-15 09:45:07 +01:00
arch_timer.h clocksource/drivers/arm_arch_timer: Avoid infinite recursion when ftrace is enabled 2017-08-11 16:01:43 +02:00
arm-cci.h
asm-offsets.h
asm-uaccess.h arm64: entry: improve data abort handling of tagged pointers 2017-05-09 17:26:59 +01:00
assembler.h arm64 updates for 4.11: 2017-02-22 10:46:44 -08:00
atomic_ll_sc.h arm64: Remove redundant mov from LL/SC cmpxchg 2017-05-15 18:30:10 +01:00
atomic_lse.h arm64: atomics: Remove '&' from '+&' asm constraint in lse atomics 2017-07-20 10:20:54 +01:00
atomic.h locking/atomic: Remove linux/atomic.h:atomic_fetch_or() 2016-06-16 10:48:32 +02:00
barrier.h arm64: ensure extension of smp_store_release value 2017-05-09 17:45:04 +01:00
bitops.h
bitrev.h
boot.h
brk-imm.h
bug.h debug: Fix WARN_ON_ONCE() for modules 2017-07-20 12:31:04 +02:00
cache.h arm64: cache: Identify VPIPT I-caches 2017-03-20 16:17:02 +00:00
cacheflush.h treewide: decouple cacheflush.h and set_memory.h 2017-05-08 17:15:14 -07:00
checksum.h arm64: add missing conversion to __wsum in ip_fast_csum() 2017-06-29 16:32:43 +01:00
clocksource.h arm/arm64: arch_timer: Use archdata to indicate vdso suitability 2016-09-23 17:19:25 +01:00
cmpxchg.h arm64: xchg: hazard against entire exchange variable 2017-05-09 17:44:50 +01:00
compat.h sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h> 2017-03-02 08:42:36 +01:00
compiler.h
cpu_ops.h
cpu.h arm64: cpuinfo: Expose MIDR_EL1 and REVIDR_EL1 to sysfs 2016-07-12 16:09:37 +01:00
cpucaps.h arm64: Add workaround for Cavium Thunder erratum 30115 2017-06-15 09:45:04 +01:00
cpufeature.h arm64/cpufeature: don't use mutex in bringup path 2017-05-17 17:00:29 +01:00
cpuidle.h
cputype.h arm64: Add MIDR values for Cavium cn83XX SoCs 2017-06-15 09:45:04 +01:00
current.h arm64: remove redundant header file in current.h 2017-03-30 19:15:37 +01:00
dcc.h arm64: dcc: simplify accessors 2016-09-09 11:41:13 +01:00
debug-monitors.h arm64: Add uprobe support 2016-11-07 18:15:21 +00:00
device.h xen/arm,arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..." 2017-05-02 11:14:42 +02:00
dma-mapping.h This is the first pull request for the new dma-mapping subsystem 2017-07-06 19:20:54 -07:00
dmi.h
efi.h efi/arm-stub: Round up FDT allocation to mapping size 2017-04-05 12:27:24 +02:00
elf.h mm: revert x86_64 and arm64 ELF_ET_DYN_BASE base changes 2017-08-18 15:32:02 -07:00
esr.h PPC: 2017-07-06 18:38:31 -07:00
exception.h
exec.h arm64: suspend: Reconfigure PSTATE after resume from idle 2016-10-20 09:50:54 +01:00
extable.h arm64: add extable.h 2017-03-28 18:23:23 -04:00
fb.h
fixmap.h
fpsimd.h
fpsimdmacros.h
ftrace.h
futex.h futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
hardirq.h arm64: kdump: implement machine_crash_shutdown() 2017-04-05 18:29:15 +01:00
hugetlb.h mm/hugetlb: clean up ARCH_HAS_GIGANTIC_PAGE 2017-07-06 16:24:33 -07:00
hw_breakpoint.h arm64: cpufeature: Make ID reg accessor naming less counterintuitive 2017-04-04 16:55:41 +01:00
hwcap.h
hypervisor.h
insn.h arm64: Prevent cpu hotplug rwsem recursion 2017-05-26 10:10:45 +02:00
io.h ARM64: Implement pci_remap_cfgspace() interface 2017-04-24 13:53:13 -05:00
irq_work.h
irq.h
irqflags.h arm64: debug: remove unused local_dbg_{enable, disable} macros 2016-07-19 16:59:40 +01:00
jump_label.h
kasan.h
Kbuild arm64: move generic-y of exported headers to uapi/asm/Kbuild 2017-07-10 03:43:20 +09:00
kernel-pgtable.h arm64: Introduce uaccess_{disable,enable} functionality based on TTBR0_EL1 2016-11-21 18:48:53 +00:00
kexec.h arm64: kdump: implement machine_crash_shutdown() 2017-04-05 18:29:15 +01:00
kgdb.h arm64: kgdb: Match pstate size with gdbserver protocol 2016-06-16 19:20:51 +01:00
kprobes.h kprobes: move kprobe declarations to asm-generic/kprobes.h 2017-02-27 18:43:45 -08:00
kvm_arm.h arm/arm64: KVM: add guest SEA support 2017-06-22 18:22:05 +01:00
kvm_asm.h arm64: KVM: Convert __cpu_reset_hyp_mode to using __hyp_reset_vectors 2017-04-09 07:49:22 -07:00
kvm_coproc.h
kvm_emulate.h arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses 2017-05-02 09:53:46 +02:00
kvm_host.h KVM/ARM updates for 4.13 2017-06-30 12:38:26 +02:00
kvm_hyp.h KVM: arm64: vgic-v3: Add hook to handle guest GICv3 sysreg accesses at EL2 2017-06-15 09:44:59 +01:00
kvm_mmio.h KVM: arm/arm64: Export mmio_read/write_bus 2016-05-20 15:39:42 +02:00
kvm_mmu.h * ARM: HYP mode stub supports kexec/kdump on 32-bit; improved PMU 2017-05-08 12:37:56 -07:00
kvm_psci.h
linkage.h
lse.h arm64: do not trace atomic operations 2017-02-06 19:00:23 +00:00
memblock.h
memory.h arm64: avoid overflow in VA_START and PAGE_OFFSET 2017-08-04 15:06:35 +01:00
mmu_context.h sched/headers: Prepare to remove the <linux/mm_types.h> dependency from <linux/sched.h> 2017-03-02 08:42:37 +01:00
mmu.h arm64: alternatives: apply boot time fixups via the linear mapping 2017-03-23 13:54:19 +00:00
mmzone.h arm64, numa: Add NUMA support for arm64 platforms. 2016-04-15 18:06:09 +01:00
module.h arm64: ftrace: add support for far branches to dynamic ftrace 2017-06-07 11:52:02 +01:00
neon.h arm64: Support systems without FP/ASIMD 2016-11-16 18:05:10 +00:00
numa.h ACPI/NUMA: Do not map pxm to node when NUMA is turned off 2016-12-15 11:32:32 +01:00
page.h arm64: move {PAGE,CONT}_SHIFT into Kconfig 2016-06-03 10:57:18 +01:00
paravirt.h
pci.h PCI: Add pci_mmap_resource_range() and use it for ARM64 2017-04-20 08:47:47 -05:00
percpu.h arm64: factor out current_stack_pointer 2016-11-11 18:25:43 +00:00
perf_event.h arm64 updates for 4.10: 2016-12-13 16:39:21 -08:00
pgalloc.h arm64: get rid of superfluous __GFP_REPEAT 2016-06-24 17:23:52 -07:00
pgtable-hwdef.h arm64: simplify sysreg manipulation 2016-09-09 11:43:50 +01:00
pgtable-prot.h arm64: Introduce execute-only page access permissions 2016-08-25 18:00:29 +01:00
pgtable-types.h arch, mm: convert all architectures to use 5level-fixup.h 2017-03-09 11:48:47 -08:00
pgtable.h arm64: hugetlb: Fix huge_pte_offset to return poisoned page table entries 2017-06-12 16:04:28 +01:00
probes.h arm64: Remove reference to asm/opcodes.h 2016-12-05 10:42:34 +00:00
proc-fns.h
processor.h arm64: ptrace: Flush user-RW TLS reg to thread_struct before reading 2017-06-22 15:58:20 +01:00
ptdump.h arm64: dump: Add checking for writable and exectuable pages 2016-11-07 18:15:04 +00:00
ptrace.h arm64: ptrace: add XZR-safe regs accessors 2017-02-15 12:20:29 +00:00
seccomp.h
sections.h arm64: mmu: apply strict permissions to .init.text and .init.data 2017-03-23 13:54:50 +00:00
shmparam.h
signal32.h
smp_plat.h
smp.h arm64: kdump: implement machine_crash_shutdown() 2017-04-05 18:29:15 +01:00
sparsemem.h
spinlock_types.h
spinlock.h locking: Remove smp_mb__before_spinlock() 2017-08-10 12:29:03 +02:00
stack_pointer.h arm64: factor out current_stack_pointer 2016-11-11 18:25:43 +00:00
stackprotector.h arm64: ascii armor the arm64 boot init stack canary 2017-07-12 16:26:03 -07:00
stacktrace.h arm64: Add dump_backtrace() in show_regs 2017-05-30 11:07:42 +01:00
stage2_pgtable-nopmd.h kvm: arm64: Get rid of fake page table levels 2016-04-21 14:58:21 +02:00
stage2_pgtable-nopud.h kvm: arm64: Get rid of fake page table levels 2016-04-21 14:58:21 +02:00
stage2_pgtable.h kvm: arm64: Get rid of fake page table levels 2016-04-21 14:58:21 +02:00
stat.h
string.h include/linux/string.h: add the option of fortified string.h functions 2017-07-12 16:26:03 -07:00
suspend.h arm64: move sp_el0 and tpidr_el1 into cpu_suspend_ctx 2016-11-11 18:25:44 +00:00
sync_bitops.h
syscall.h
sysreg.h arm64: sysreg: Fix unprotected macro argmuent in write_sysreg 2017-07-26 09:28:18 +01:00
system_misc.h Merge branch 'aarch64/for-next/ras-apei' into aarch64/for-next/core 2017-06-26 10:54:27 +01:00
thread_info.h arm64: Introduce uaccess_{disable,enable} functionality based on TTBR0_EL1 2016-11-21 18:48:53 +00:00
timex.h
tlb.h
tlbflush.h arm64: Work around Falkor erratum 1009 2017-02-01 15:41:50 +00:00
topology.h arm64, numa: Add NUMA support for arm64 platforms. 2016-04-15 18:06:09 +01:00
traps.h arm64: Create sections.h 2016-08-25 18:00:29 +01:00
uaccess.h arm64: uaccess: Remove redundant __force from addr cast in __range_ok 2017-07-20 10:20:48 +01:00
unistd32.h Remove compat_sys_getdents64() 2017-04-17 12:52:22 -04:00
unistd.h Remove compat_sys_getdents64() 2017-04-17 12:52:22 -04:00
uprobes.h arm64: Add uprobe support 2016-11-07 18:15:21 +00:00
vdso_datapage.h arm64: Add support for CLOCK_MONOTONIC_RAW in clock_gettime() vDSO 2016-07-12 16:06:32 +01:00
vdso.h
virt.h arm64: hyp-stub/KVM: Kill __hyp_get_vectors 2017-04-09 07:49:34 -07:00
word-at-a-time.h Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00