mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-22 00:40:03 +00:00
![Josh Poimboeuf](/assets/img/avatar_default.png)
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>
244 lines
5.2 KiB
Text
244 lines
5.2 KiB
Text
CONFIG_SYSVIPC=y
|
|
CONFIG_POSIX_MQUEUE=y
|
|
CONFIG_USELIB=y
|
|
CONFIG_AUDIT=y
|
|
CONFIG_NO_HZ_IDLE=y
|
|
CONFIG_HIGH_RES_TIMERS=y
|
|
CONFIG_TASKSTATS=y
|
|
CONFIG_TASK_DELAY_ACCT=y
|
|
CONFIG_TASK_XACCT=y
|
|
CONFIG_TASK_IO_ACCOUNTING=y
|
|
CONFIG_IKCONFIG=y
|
|
CONFIG_IKCONFIG_PROC=y
|
|
CONFIG_CGROUPS=y
|
|
CONFIG_MEMCG=y
|
|
CONFIG_MEMCG_SWAP=y
|
|
CONFIG_BLK_CGROUP=y
|
|
CONFIG_CGROUP_SCHED=y
|
|
CONFIG_RT_GROUP_SCHED=y
|
|
CONFIG_CGROUP_PIDS=y
|
|
CONFIG_CGROUP_FREEZER=y
|
|
CONFIG_CGROUP_HUGETLB=y
|
|
CONFIG_CPUSETS=y
|
|
CONFIG_CGROUP_DEVICE=y
|
|
CONFIG_CGROUP_CPUACCT=y
|
|
CONFIG_CGROUP_PERF=y
|
|
CONFIG_CHECKPOINT_RESTORE=y
|
|
CONFIG_NAMESPACES=y
|
|
CONFIG_USER_NS=y
|
|
CONFIG_BLK_DEV_INITRD=y
|
|
CONFIG_EXPERT=y
|
|
CONFIG_BPF_SYSCALL=y
|
|
CONFIG_USERFAULTFD=y
|
|
# CONFIG_COMPAT_BRK is not set
|
|
CONFIG_PROFILING=y
|
|
CONFIG_OPROFILE=y
|
|
CONFIG_KPROBES=y
|
|
CONFIG_JUMP_LABEL=y
|
|
CONFIG_STATIC_KEYS_SELFTEST=y
|
|
CONFIG_MODULES=y
|
|
CONFIG_MODULE_UNLOAD=y
|
|
CONFIG_MODVERSIONS=y
|
|
CONFIG_BLK_DEV_INTEGRITY=y
|
|
CONFIG_PARTITION_ADVANCED=y
|
|
CONFIG_IBM_PARTITION=y
|
|
CONFIG_DEFAULT_DEADLINE=y
|
|
CONFIG_LIVEPATCH=y
|
|
CONFIG_NR_CPUS=256
|
|
CONFIG_NUMA=y
|
|
CONFIG_HZ_100=y
|
|
CONFIG_MEMORY_HOTPLUG=y
|
|
CONFIG_MEMORY_HOTREMOVE=y
|
|
CONFIG_KSM=y
|
|
CONFIG_TRANSPARENT_HUGEPAGE=y
|
|
CONFIG_CLEANCACHE=y
|
|
CONFIG_FRONTSWAP=y
|
|
CONFIG_CMA=y
|
|
CONFIG_ZSWAP=y
|
|
CONFIG_ZBUD=m
|
|
CONFIG_ZSMALLOC=m
|
|
CONFIG_ZSMALLOC_STAT=y
|
|
CONFIG_IDLE_PAGE_TRACKING=y
|
|
CONFIG_CRASH_DUMP=y
|
|
CONFIG_BINFMT_MISC=m
|
|
CONFIG_HIBERNATION=y
|
|
CONFIG_NET=y
|
|
CONFIG_PACKET=y
|
|
CONFIG_UNIX=y
|
|
CONFIG_NET_KEY=y
|
|
CONFIG_INET=y
|
|
CONFIG_IP_MULTICAST=y
|
|
CONFIG_L2TP=m
|
|
CONFIG_L2TP_DEBUGFS=m
|
|
CONFIG_VLAN_8021Q=y
|
|
CONFIG_NET_SCHED=y
|
|
CONFIG_NET_SCH_CBQ=m
|
|
CONFIG_NET_SCH_PRIO=m
|
|
CONFIG_NET_SCH_RED=m
|
|
CONFIG_NET_SCH_SFQ=m
|
|
CONFIG_NET_SCH_TEQL=m
|
|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FIG_DM_UEVENT=y
|
|
CONFIG_DM_VERITY=m
|
|
CONFIG_DM_SWITCH=m
|
|
CONFIG_NETDEVICES=y
|
|
CONFIG_BONDING=m
|
|
CONFIG_DUMMY=m
|
|
CONFIG_EQUALIZER=m
|
|
CONFIG_TUN=m
|
|
CONFIG_VIRTIO_NET=y
|
|
# CONFIG_INPUT is not set
|
|
# CONFIG_SERIO is not set
|
|
CONFIG_RAW_DRIVER=m
|
|
CONFIG_VIRTIO_BALLOON=y
|
|
CONFIG_EXT4_FS=y
|
|
CONFIG_EXT4_FS_POSIX_ACL=y
|
|
CONFIG_EXT4_FS_SECURITY=y
|
|
CONFIG_XFS_FS=y
|
|
CONFIG_XFS_QUOTA=y
|
|
CONFIG_XFS_POSIX_ACL=y
|
|
CONFIG_XFS_RT=y
|
|
CONFIG_BTRFS_FS=y
|
|
CONFIG_BTRFS_FS_POSIX_ACL=y
|
|
CONFIG_FANOTIFY=y
|
|
CONFIG_FUSE_FS=y
|
|
CONFIG_PROC_KCORE=y
|
|
CONFIG_TMPFS=y
|
|
CONFIG_TMPFS_POSIX_ACL=y
|
|
CONFIG_HUGETLBFS=y
|
|
# CONFIG_NETWORK_FILESYSTEMS is not set
|
|
CONFIG_DEBUG_INFO=y
|
|
CONFIG_DEBUG_INFO_DWARF4=y
|
|
CONFIG_GDB_SCRIPTS=y
|
|
CONFIG_UNUSED_SYMBOLS=y
|
|
CONFIG_DEBUG_SECTION_MISMATCH=y
|
|
CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
|
|
CONFIG_MAGIC_SYSRQ=y
|
|
CONFIG_DEBUG_PAGEALLOC=y
|
|
CONFIG_DETECT_HUNG_TASK=y
|
|
CONFIG_PANIC_ON_OOPS=y
|
|
CONFIG_TIMER_STATS=y
|
|
CONFIG_DEBUG_RT_MUTEXES=y
|
|
CONFIG_PROVE_LOCKING=y
|
|
CONFIG_LOCK_STAT=y
|
|
CONFIG_DEBUG_LOCKDEP=y
|
|
CONFIG_DEBUG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|
CONFIG_CRYPTO_ANUBIS=m
|
|
CONFIG_CRYPTO_ARC4=m
|
|
CONFIG_CRYPTO_BLOWFISH=m
|
|
CONFIG_CRYPTO_CAMELLIA=m
|
|
CONFIG_CRYPTO_CAST5=m
|
|
CONFIG_CRYPTO_CAST6=m
|
|
CONFIG_CRYPTO_FCRYPT=m
|
|
CONFIG_CRYPTO_KHAZAD=m
|
|
CONFIG_CRYPTO_SALSA20=m
|
|
CONFIG_CRYPTO_SEED=m
|
|
CONFIG_CRYPTO_SERPENT=m
|
|
CONFIG_CRYPTO_TEA=m
|
|
CONFIG_CRYPTO_TWOFISH=m
|
|
CONFIG_CRYPTO_DEFLATE=m
|
|
CONFIG_CRYPTO_LZ4=m
|
|
CONFIG_CRYPTO_LZ4HC=m
|
|
CONFIG_CRYPTO_ANSI_CPRNG=m
|
|
CONFIG_CRYPTO_USER_API_HASH=m
|
|
CONFIG_CRYPTO_USER_API_SKCIPHER=m
|
|
CONFIG_CRYPTO_USER_API_RNG=m
|
|
CONFIG_ZCRYPT=m
|
|
CONFIG_CRYPTO_SHA1_S390=m
|
|
CONFIG_CRYPTO_SHA256_S390=m
|
|
CONFIG_CRYPTO_SHA512_S390=m
|
|
CONFIG_CRYPTO_DES_S390=m
|
|
CONFIG_CRYPTO_AES_S390=m
|
|
CONFIG_CRYPTO_CRC32_S390=y
|
|
CONFIG_CRC7=m
|
|
# CONFIG_XZ_DEC_X86 is not set
|
|
# CONFIG_XZ_DEC_POWERPC is not set
|
|
# CONFIG_XZ_DEC_IA64 is not set
|
|
# CONFIG_XZ_DEC_ARM is not set
|
|
# CONFIG_XZ_DEC_ARMTHUMB is not set
|
|
# CONFIG_XZ_DEC_SPARC is not set
|
|
CONFIG_CMM=m
|