android_kernel_oneplus_msm8998/arch/tile/include/asm
Jiri Slaby 177a981885 futex: Remove duplicated code and fix undefined behaviour
commit 30d6e0a4190d37740e9447e4e4815f06992dd8c3 upstream.

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 5f16a046f8e1 (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
Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-26 08:48:50 +02:00
..
asm-offsets.h
atomic.h atomic, arch: Audit atomic_{read,set}() 2015-09-23 09:54:28 +02:00
atomic_32.h atomic: Provide atomic_{or,xor,and} 2015-07-27 14:06:24 +02:00
atomic_64.h atomic, arch: Audit atomic_{read,set}() 2015-09-23 09:54:28 +02:00
backtrace.h
barrier.h arch,tile: Convert smp_mb__*() 2014-04-18 14:20:45 +02:00
bitops.h arch,tile: Convert smp_mb__*() 2014-04-18 14:20:45 +02:00
bitops_32.h arch,tile: Convert smp_mb__*() 2014-04-18 14:20:45 +02:00
bitops_64.h arch,tile: Convert smp_mb__*() 2014-04-18 14:20:45 +02:00
cache.h
cacheflush.h
checksum.h
cmpxchg.h
compat.h tile: Use get_signal() signal_setup_done() 2014-08-06 13:03:20 +02:00
current.h
delay.h
device.h
dma-mapping.h dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
dma.h
elf.h tile: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO 2016-10-07 15:23:44 +02:00
fixmap.h tile: use generic fixmap.h 2014-01-23 16:36:54 -08:00
ftrace.h tile: ftrace: fix function_graph tracer issues 2015-04-17 14:01:38 -04:00
futex.h futex: Remove duplicated code and fix undefined behaviour 2018-05-26 08:48:50 +02:00
hardirq.h
hardwall.h proc: convert /proc/$PID/hardwall to seq_file interface 2014-08-08 15:57:23 -07:00
highmem.h kmap_atomic_to_page() has no users, remove it 2015-11-09 15:11:24 -08:00
homecache.h
hugetlb.h mm/hugetlb: remove arch_prepare/release_hugepage from arch headers 2015-06-25 17:00:35 -07:00
hv_driver.h
ide.h
io.h arch/*/io.h: Add ioremap_uc() to all architectures 2015-07-29 10:02:36 +02:00
irq.h tile: support delivering NMIs for multicore backtrace 2015-05-11 11:22:31 -04:00
irq_work.h tile: support arch_irq_work_raise 2015-04-17 12:58:44 -04:00
irqflags.h tile: Replace __get_cpu_var uses 2014-08-26 13:45:54 -04:00
Kbuild word-at-a-time.h: fix some Kbuild files 2015-10-06 14:52:48 -04:00
kdebug.h
kexec.h
kgdb.h
kmap_types.h
kprobes.h
linkage.h
mmu.h
mmu_context.h tile: Replace __get_cpu_var uses 2014-08-26 13:45:54 -04:00
mmzone.h
module.h
page.h tile: provide CONFIG_PAGE_SIZE_64KB etc for tilepro 2016-01-05 08:16:09 -05:00
pci.h
percpu.h
perf_event.h tile/perf: Support perf_events on tilegx and tilepro 2014-03-07 11:19:48 -05:00
pgalloc.h
pgtable.h mm: clarify that the function operates on hugepage pte 2015-06-24 17:49:44 -07:00
pgtable_32.h
pgtable_64.h tile: Use the more common pr_warn instead of pr_warning 2014-11-11 15:51:42 -05:00
pmc.h tile: Add support for handling PMC hardware 2014-03-07 11:19:47 -05:00
processor.h tile: improve stack backtrace 2015-05-11 11:22:40 -04:00
ptrace.h
sections.h tile: Remove tile-specific _sinitdata and _einitdata 2014-10-02 10:19:33 -04:00
setup.h
sigframe.h
signal.h
smp.h tile: support arch_irq_work_raise 2015-04-17 12:58:44 -04:00
spinlock.h
spinlock_32.h tile: use READ_ONCE() in arch_spin_is_locked() 2015-04-28 22:43:16 -04:00
spinlock_64.h tile: use READ_ONCE() in arch_spin_is_locked() 2015-04-28 22:43:16 -04:00
spinlock_types.h
stack.h tile: improve stack backtrace 2015-05-11 11:22:40 -04:00
string.h
switch_to.h tile: Reorganize _switch_to() 2015-08-08 10:29:21 +02:00
syscall.h tile: enable full SECCOMP support 2015-07-30 12:32:16 -04:00
syscalls.h
thread_info.h tile: improve stack backtrace 2015-05-11 11:22:40 -04:00
tile-desc.h
tile-desc_32.h
tile-desc_64.h
timex.h
tlb.h
tlbflush.h
topology.h sched/topology: Rename topology_thread_cpumask() to topology_sibling_cpumask() 2015-05-27 15:22:15 +02:00
traps.h tile: support delivering NMIs for multicore backtrace 2015-05-11 11:22:31 -04:00
uaccess.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2015-06-30 21:47:12 -07:00
unaligned.h
unistd.h
user.h
vdso.h tile: add clock_gettime support to vDSO 2014-10-02 13:56:07 -04:00
vga.h
word-at-a-time.h word-at-a-time.h: support zero_bytemask() on alpha and tile 2015-10-06 14:53:16 -04:00