linux/arch/tile/include/asm
Josh Poimboeuf 0d025d271e mm/usercopy: get rid of CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
There are three usercopy warnings which are currently being silenced for
gcc 4.6 and newer:

1) "copy_from_user() buffer size is too small" compile warning/error

   This is a static warning which happens when object size and copy size
   are both const, and copy size > object size.  I didn't see any false
   positives for this one.  So the function warning attribute seems to
   be working fine here.

   Note this scenario is always a bug and so I think it should be
   changed to *always* be an error, regardless of
   CONFIG_DEBUG_STRICT_USER_COPY_CHECKS.

2) "copy_from_user() buffer size is not provably correct" compile warning

   This is another static warning which happens when I enable
   __compiletime_object_size() for new compilers (and
   CONFIG_DEBUG_STRICT_USER_COPY_CHECKS).  It happens when object size
   is const, but copy size is *not*.  In this case there's no way to
   compare the two at build time, so it gives the warning.  (Note the
   warning is a byproduct of the fact that gcc has no way of knowing
   whether the overflow function will be called, so the call isn't dead
   code and the warning attribute is activated.)

   So this warning seems to only indicate "this is an unusual pattern,
   maybe you should check it out" rather than "this is a bug".

   I get 102(!) of these warnings with allyesconfig and the
   __compiletime_object_size() gcc check removed.  I don't know if there
   are any real bugs hiding in there, but from looking at a small
   sample, I didn't see any.  According to Kees, it does sometimes find
   real bugs.  But the false positive rate seems high.

3) "Buffer overflow detected" runtime warning

   This is a runtime warning where object size is const, and copy size >
   object size.

All three warnings (both static and runtime) were completely disabled
for gcc 4.6 with the following commit:

  2fb0815c9e ("gcc4: disable __compiletime_object_size for GCC 4.6+")

That commit mistakenly assumed that the false positives were caused by a
gcc bug in __compiletime_object_size().  But in fact,
__compiletime_object_size() seems to be working fine.  The false
positives were instead triggered by #2 above.  (Though I don't have an
explanation for why the warnings supposedly only started showing up in
gcc 4.6.)

So remove warning #2 to get rid of all the false positives, and re-enable
warnings #1 and #3 by reverting the above commit.

Furthermore, since #1 is a real bug which is detected at compile time,
upgrade it to always be an error.

Having done all that, CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is no longer
needed.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Byungchul Park <byungchul.park@lge.com>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-08-30 10:10:21 -07:00
..
asm-offsets.h
atomic_32.h locking/atomic, arch/tile: Fix tilepro build 2016-06-24 08:17:04 +02:00
atomic_64.h locking/atomic, arch/tile: Implement atomic{,64}_fetch_{add,sub,and,or,xor}() 2016-06-16 10:48:30 +02:00
atomic.h locking/atomic: Remove linux/atomic.h:atomic_fetch_or() 2016-06-16 10:48:32 +02:00
backtrace.h
barrier.h locking/barriers, tile: Provide TILE specific smp_acquire__after_ctrl_dep() 2016-06-14 11:55:15 +02:00
bitops_32.h locking/atomic, arch/tile: Implement atomic{,64}_fetch_{add,sub,and,or,xor}() 2016-06-16 10:48:30 +02:00
bitops_64.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
cache.h tile: make __write_once a synonym for __read_mostly 2013-09-03 14:53:32 -04:00
cacheflush.h tile: convert uses of "inv" to "finv" 2013-07-31 11:51:19 -04:00
checksum.h
cmpxchg.h locking/cmpxchg, arch: Remove tas() definitions 2015-12-04 11:39:51 +01:00
compat.h tile: Use get_signal() signal_setup_done() 2014-08-06 13:03:20 +02:00
current.h
delay.h
device.h tile PCI RC: make default consistent DMA mask 32-bit 2013-09-03 14:53:37 -04:00
dma-mapping.h dma-mapping: always provide the dma_map_ops based implementation 2016-01-20 17:09:18 -08:00
dma.h
elf.h tile: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO 2016-07-25 12:15:06 -04: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 locking/atomic, arch/tile: Fix tilepro build 2016-06-24 08:17:04 +02:00
hardirq.h hardirq: Make hardirq bits generic 2013-11-13 20:21:46 +01:00
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 tile: remove support for TILE64 2013-09-03 14:53:29 -04:00
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
insn.h tile/jump_label: add jump label support for TILE-Gx 2016-01-04 15:09:31 -05:00
io.h tile: fix tilepro casts for readl, writel, etc 2016-01-18 14:49:23 -05:00
irq_work.h tile: support arch_irq_work_raise 2015-04-17 12:58:44 -04:00
irq.h tile: support delivering NMIs for multicore backtrace 2015-05-11 11:22:31 -04:00
irqflags.h tile: Replace __get_cpu_var uses 2014-08-26 13:45:54 -04:00
jump_label.h tile/jump_label: add jump label support for TILE-Gx 2016-01-04 15:09:31 -05:00
Kbuild word-at-a-time.h: fix some Kbuild files 2015-10-06 14:52:48 -04:00
kdebug.h tile: support kprobes on tilegx 2013-08-30 11:55:53 -04:00
kexec.h
kgdb.h tilegx: support KGDB 2013-09-03 14:51:26 -04:00
kmap_types.h
kprobes.h tile: support kprobes on tilegx 2013-08-30 11:55:53 -04:00
linkage.h
mmu_context.h tile: Replace __get_cpu_var uses 2014-08-26 13:45:54 -04:00
mmu.h tile: implement gettimeofday() via vDSO 2013-08-13 16:26:21 -04:00
mmzone.h tile: fix some -Wsign-compare warnings 2013-08-30 11:56:50 -04:00
module.h
page.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2016-01-18 12:57:18 -08:00
pci.h PCI: Move pci_dma_* helpers to common code 2016-03-07 10:40:02 -06:00
percpu.h tile: use a more conservative __my_cpu_offset in CONFIG_PREEMPT 2013-09-30 10:34:41 -04:00
perf_event.h tile/perf: Support perf_events on tilegx and tilepro 2014-03-07 11:19:48 -05:00
pgalloc.h
pgtable_32.h tile: remove HUGE_VMAP dead code 2013-09-13 11:15:24 -04:00
pgtable_64.h tile: Use the more common pr_warn instead of pr_warning 2014-11-11 15:51:42 -05:00
pgtable.h arch: fix has_transparent_hugepage() 2016-05-19 19:12:14 -07:00
pmc.h tile: Add support for handling PMC hardware 2014-03-07 11:19:47 -05:00
processor.h arch/tile: adopt prepare_exit_to_usermode() model from x86 2016-01-18 14:49:09 -05:00
ptrace.h tile: don't assume user privilege is zero 2013-09-03 14:45:52 -04:00
sections.h tile: Remove tile-specific _sinitdata and _einitdata 2014-10-02 10:19:33 -04:00
setup.h tile: allow disabling CONFIG_EARLY_PRINTK 2016-06-07 16:55:20 -04:00
sigframe.h
signal.h
smp.h tile: support arch_irq_work_raise 2015-04-17 12:58:44 -04:00
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
spinlock.h
stack.h tile: improve stack backtrace 2015-05-11 11:22:40 -04:00
string.h tile: optimize strnlen using SIMD instructions 2013-08-01 20:08:51 -04:00
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 signal: consolidate {TS,TLF}_RESTORE_SIGMASK code 2016-08-02 19:35:23 -04:00
tile-desc_32.h
tile-desc_64.h
tile-desc.h
timex.h
tlb.h
tlbflush.h
topology.h numa: remove stale node_has_online_mem() define 2016-01-18 14:49:33 -05:00
traps.h tile: support delivering NMIs for multicore backtrace 2015-05-11 11:22:31 -04:00
uaccess.h mm/usercopy: get rid of CONFIG_DEBUG_STRICT_USER_COPY_CHECKS 2016-08-30 10:10:21 -07:00
unaligned.h tile: improve big-endian support 2013-08-13 16:26:05 -04:00
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