mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 00/10] Add initial support for -fsanitize={ubsan,asan}
@ 2019-08-27 15:09 Ahmad Fatoum
  2019-08-27 15:09 ` [PATCH v2 01/10] Kconfig: create Kconfig symbol for ARCH_HAS_STACK_DUMP Ahmad Fatoum
                   ` (10 more replies)
  0 siblings, 11 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2019-08-27 15:09 UTC (permalink / raw)
  To: barebox

This series adds undefined behavior and address sanitizer support to
barebox. Both are fully functional on sandbox, where they are also used
to implement dump_stack() now.

I haven't yet read about how Kernel AddressSanitizer works, so this one
only works on sandbox via libasan for now.

The undefined behavior sanitizer depends on the compiler instrumenting
potential pitfalls and then calling the routines in lib/ubsan.c if it
catches something undefined, so that should readily work on other arches
as well. I tested it on sandbox and the i.MX6Q so far.

Eventually, it should be possible to enable it for all the non-PBL stuff
with a single Kconfig option, but for now you need to explicitly add a

	UBSAN_SANITIZE_myfile.o := y

in the respective Makefile. Enabling it wholesale doesn't yet work on
ARM, I suspect it might be due to binary size.

Changes in v2:
	v1 was incomplete and sent our more by mistake,
	so no changelog.

Ahmad Fatoum (10):
  Kconfig: create Kconfig symbol for ARCH_HAS_STACK_DUMP
  Kconfig: create Kconfig symbol for ARCH_HAS_DATA_ABORT_MASK
  blackfin: delete unused <asm/barebox.h> definitions
  Kconfig: retire empty <asm/barebox.h>
  lib: add HAVE_EFFICIENT_UNALIGNED_ACCESS Kconfig option
  common: add generic CONFIG_UBSAN plumbing
  commands: add intentionally UB triggering ubsan command
  sandbox: use sanitizer unwind for dump_stack if available
  common: add generic CONFIG_KASAN option
  sandbox: support Address and UndefinedBehavior sanitizers

 Makefile                            |   4 +
 arch/arm/Kconfig                    |   2 +
 arch/arm/cpu/Kconfig                |   1 +
 arch/arm/include/asm/barebox.h      |  16 -
 arch/blackfin/include/asm/barebox.h |  43 ---
 arch/mips/Kconfig                   |   1 +
 arch/mips/include/asm/barebox.h     |   8 -
 arch/nios2/include/asm/barebox.h    |   4 -
 arch/openrisc/include/asm/barebox.h |   4 -
 arch/ppc/include/asm/barebox.h      |  27 --
 arch/ppc/include/asm/common.h       |   2 -
 arch/riscv/include/asm/barebox.h    |   1 -
 arch/sandbox/Kconfig                |   8 +
 arch/sandbox/Makefile               |  14 +-
 arch/sandbox/include/asm/barebox.h  |   1 -
 arch/sandbox/lib/Makefile           |   1 +
 arch/sandbox/lib/unwind.c           |  11 +
 arch/x86/include/asm/barebox.h      |  17 --
 commands/Kconfig                    |   7 +
 commands/Makefile                   |   3 +
 commands/ubsan.c                    | 152 ++++++++++
 common/Kconfig                      |  12 +
 include/abort.h                     |   4 +-
 include/common.h                    |   4 +-
 lib/Kconfig                         |   9 +
 lib/Kconfig.ubsan                   |  35 +++
 lib/Makefile                        |   2 +
 lib/ubsan.c                         | 442 ++++++++++++++++++++++++++++
 lib/ubsan.h                         |  89 ++++++
 scripts/Makefile.lib                |   8 +
 scripts/Makefile.ubsan              |  19 ++
 31 files changed, 820 insertions(+), 131 deletions(-)
 delete mode 100644 arch/arm/include/asm/barebox.h
 delete mode 100644 arch/blackfin/include/asm/barebox.h
 delete mode 100644 arch/mips/include/asm/barebox.h
 delete mode 100644 arch/nios2/include/asm/barebox.h
 delete mode 100644 arch/openrisc/include/asm/barebox.h
 delete mode 100644 arch/ppc/include/asm/barebox.h
 delete mode 100644 arch/riscv/include/asm/barebox.h
 delete mode 100644 arch/sandbox/include/asm/barebox.h
 create mode 100644 arch/sandbox/lib/Makefile
 create mode 100644 arch/sandbox/lib/unwind.c
 delete mode 100644 arch/x86/include/asm/barebox.h
 create mode 100644 commands/ubsan.c
 create mode 100644 lib/Kconfig.ubsan
 create mode 100644 lib/ubsan.c
 create mode 100644 lib/ubsan.h
 create mode 100644 scripts/Makefile.ubsan

-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-09-05  6:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27 15:09 [PATCH v2 00/10] Add initial support for -fsanitize={ubsan,asan} Ahmad Fatoum
2019-08-27 15:09 ` [PATCH v2 01/10] Kconfig: create Kconfig symbol for ARCH_HAS_STACK_DUMP Ahmad Fatoum
2019-08-27 15:09 ` [PATCH v2 02/10] Kconfig: create Kconfig symbol for ARCH_HAS_DATA_ABORT_MASK Ahmad Fatoum
2019-08-27 15:09 ` [PATCH v2 03/10] blackfin: delete unused <asm/barebox.h> definitions Ahmad Fatoum
2019-08-27 15:09 ` [PATCH v2 04/10] Kconfig: retire empty <asm/barebox.h> Ahmad Fatoum
2019-08-27 15:09 ` [PATCH v2 05/10] lib: add HAVE_EFFICIENT_UNALIGNED_ACCESS Kconfig option Ahmad Fatoum
2019-08-27 15:09 ` [PATCH v2 06/10] common: add generic CONFIG_UBSAN plumbing Ahmad Fatoum
2019-08-27 15:09 ` [PATCH v2 07/10] commands: add intentionally UB triggering ubsan command Ahmad Fatoum
2019-08-27 15:09 ` [PATCH v2 08/10] sandbox: use sanitizer unwind for dump_stack if available Ahmad Fatoum
2019-08-27 15:09 ` [PATCH v2 09/10] common: add generic CONFIG_KASAN option Ahmad Fatoum
2019-08-27 15:09 ` [PATCH v2 10/10] sandbox: support Address and UndefinedBehavior sanitizers Ahmad Fatoum
2019-09-04  6:53 ` [PATCH v2 00/10] Add initial support for -fsanitize={ubsan,asan} Sascha Hauer
2019-09-04  7:52   ` Ahmad Fatoum
2019-09-05  6:02     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox