linux-IllusionX/scripts
Kees Cook 277a10850f ubsan: split "bounds" checker from other options
In order to do kernel builds with the bounds checker individually
available, introduce CONFIG_UBSAN_BOUNDS, with the remaining options under
CONFIG_UBSAN_MISC.

For example, using this, we can start to expand the coverage syzkaller is
providing.  Right now, all of UBSan is disabled for syzbot builds because
taken as a whole, it is too noisy.  This will let us focus on one feature
at a time.

For the bounds checker specifically, this provides a mechanism to
eliminate an entire class of array overflows with close to zero
performance overhead (I cannot measure a difference).  In my (mostly)
defconfig, enabling bounds checking adds ~4200 checks to the kernel.
Performance changes are in the noise, likely due to the branch predictors
optimizing for the non-fail path.

Some notes on the bounds checker:

- it does not instrument {mem,str}*()-family functions, it only
  instruments direct indexed accesses (e.g. "foo[i]"). Dealing with
  the {mem,str}*()-family functions is a work-in-progress around
  CONFIG_FORTIFY_SOURCE[1].

- it ignores flexible array members, including the very old single
  byte (e.g. "int foo[1];") declarations. (Note that GCC's
  implementation appears to ignore _all_ trailing arrays, but Clang only
  ignores empty, 0, and 1 byte arrays[2].)

[1] https://github.com/KSPP/linux/issues/6
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92589

Suggested-by: Elena Petrova <lenaptr@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Acked-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Link: http://lkml.kernel.org/r/20200227193516.32566-3-keescook@chromium.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-04-07 10:43:44 -07:00
..
atomic
basic SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
coccinelle mm: remove __krealloc 2020-02-04 03:05:24 +00:00
dtc SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
gcc-plugins SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
gdb .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
genksyms .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
kconfig SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
ksymoops
mod Char/Misc driver patches for 5.7-rc1 2020-04-03 13:22:40 -07:00
package kbuild: deb-pkg: fix warning when CONFIG_DEBUG_INFO is unset 2020-03-30 09:23:00 +09:00
selinux SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
tracing
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
adjust_autoksyms.sh kbuild: split adjust_autoksyms.sh in two parts 2020-03-03 20:49:21 +09:00
asn1_compiler.c
bin2c.c
bloat-o-meter
bootgraph.pl
bpf_helpers_doc.py bpf_helpers_doc.py: Fix warning when compiling bpftool 2020-03-13 20:53:40 +01:00
cc-can-link.sh
check-sysctl-docs docs: add a script to check sysctl docs 2020-02-25 03:35:16 -07:00
check_extable.sh
checkincludes.pl
checkkconfigsymbols.py
checkpatch.pl checkpatch: avoid warning about uninitialized_var() 2020-04-07 10:43:44 -07:00
checkstack.pl
checksyscalls.sh
checkversion.pl
clang-version.sh
cleanfile
cleanpatch
coccicheck
config
const_structs.checkpatch
decode_stacktrace.sh
decodecode
depmod.sh
diffconfig
documentation-file-ref-check SCSI misc on 20200402 2020-04-02 17:03:53 -07:00
export_report.pl modpost: move the namespace field in Module.symvers last 2020-03-17 08:59:03 +09:00
extract-cert.c
extract-ikconfig
extract-module-sig.pl
extract-sys-certs.pl
extract-vmlinux
extract_xc3028.pl
faddr2line
file-size.sh
find-unused-docs.sh scripts/find-unused-docs: Fix massive false positives 2020-01-27 14:25:06 -07:00
gcc-goto.sh
gcc-ld
gcc-plugin.sh
gcc-version.sh
gcc-x86_32-has-stack-protector.sh
gcc-x86_64-has-stack-protector.sh
gen_autoksyms.sh kbuild: generate autoksyms.h early 2020-03-03 20:49:21 +09:00
gen_compile_commands.py
gen_ksymdeps.sh
get_abi.pl
get_dvb_firmware
get_maintainer.pl scripts/get_maintainer.pl: deprioritize old Fixes: addresses 2020-02-21 11:22:15 -08:00
gfp-translate
headerdep.pl
headers_check.pl
headers_install.sh
insert-sys-cert.c
jobserver-exec docs, parallelism: Rearrange how jobserver reservations are made 2019-11-22 10:35:18 -07:00
kallsyms.c scripts/kallsyms: fix wrong kallsyms_relative_base 2020-03-19 23:40:20 +09:00
Kbuild.include kbuild: remove *.tmp file when filechk fails 2020-01-16 00:26:22 +09:00
Kconfig.include arm64 updates for 5.7: 2020-03-31 10:05:01 -07:00
kernel-doc scripts/kernel-doc: Add support for named variable macro arguments 2019-11-07 13:17:24 -07:00
ld-version.sh
leaking_addresses.pl
Lindent
link-vmlinux.sh bpf: Support llvm-objcopy for vmlinux BTF 2020-03-19 12:32:38 +01:00
Makefile kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Makefile.asm-generic
Makefile.build kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Makefile.clean kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Makefile.dtbinst kbuild: refactor Makefile.dtbinst more 2020-03-25 10:19:43 +09:00
Makefile.extrawarn kbuild: Disable -Wpointer-to-enum-cast 2020-03-14 10:31:08 +09:00
Makefile.gcc-plugins
Makefile.headersinst kbuild: move headers_check rule to usr/include/Makefile 2019-11-15 00:23:10 +09:00
Makefile.host kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Makefile.kasan
Makefile.kcov
Makefile.lib kbuild: Always validate DT binding examples 2020-03-03 20:49:21 +09:00
Makefile.modfinal
Makefile.modinst
Makefile.modpost modpost: return error if module is missing ns imports and MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=n 2020-03-13 10:04:36 +09:00
Makefile.modsign
Makefile.package kbuild: Add make dir-pkg build option 2019-11-11 20:10:01 +09:00
Makefile.ubsan ubsan: split "bounds" checker from other options 2020-04-07 10:43:44 -07:00
makelst
markup_oops.pl
mkcompile_h kbuild: remove the owner check in mkcompile_h 2020-03-02 21:18:19 +09:00
mkmakefile
mksysmap
mkuboot.sh
module-common.lds
modules-check.sh
namespace.pl namespace: fix namespace.pl script to support relative paths 2019-10-05 15:29:49 +09:00
nsdeps scripts/nsdeps: support nsdeps for external module builds 2019-11-11 20:10:01 +09:00
objdiff
parse-maintainers.pl parse-maintainers: Do not sort section content by default 2020-03-26 15:08:27 -07:00
patch-kernel
profile2linkerlist.pl
prune-kernel
recordmcount.c ARM: 8950/1: ftrace/recordmcount: filter relocation types 2020-01-19 16:08:25 +00:00
recordmcount.h recordmcount: Fix nop_mcount() function 2019-10-12 20:49:33 -04:00
recordmcount.pl
setlocalversion scripts: setlocalversion: replace backquote to dollar parenthesis 2019-11-11 20:10:01 +09:00
show_delta
sign-file.c
sorttable.c scripts/sorttable: Implement build-time ORC unwind table sorting 2019-12-13 10:47:58 +01:00
sorttable.h scripts/sorttable: Implement build-time ORC unwind table sorting 2019-12-13 10:47:58 +01:00
spdxcheck-test.sh
spdxcheck.py
spelling.txt scripts/spelling.txt: add more spellings to spelling.txt 2020-04-02 09:35:25 -07:00
sphinx-pre-install scripts/sphinx-pre-install: add '-p python3' to virtualenv 2020-03-02 13:08:11 -07:00
split-man.pl
stackdelta
stackusage
subarch.include
tags.sh
tools-support-relr.sh scripts/tools-support-relr.sh: un-quote variables 2019-11-13 10:52:05 +00:00
unifdef.c
ver_linux ver_linux: Query ld cache for versions of libc/libcpp run-time 2020-02-10 13:35:15 -08:00
xen-hypercalls.sh
xz_wrap.sh