Skip to content

ubsan: Introduce wrap-around sanitizers

Kees Cook linux-acpi linux-crypto linux-doc linux-hardening linux-kbuild lkml llvm netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 4 repliesIn review
  2. v16 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- improve CC list
- add reviewed-by tags
- reword some commit logs
v1: https://lore.kernel.org/all/[email protected]/

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6ubsan: Use Clang's -fsanitize-trap=undefined optionscripts/Makefile.ubsan+1 -10 replies
2/6ubsan: Reintroduce signed and unsigned overflow sanitizersinclude/linux/compiler_types.h lib/Kconfig.ubsan lib/test_ubsan.c +3 more+155 -14 replies
3/6ubsan: Introduce CONFIG_UBSAN_POINTER_WRAPinclude/linux/compiler_types.h lib/Kconfig.ubsan lib/test_ubsan.c +3 more+70 -10 replies
4/6ubsan: Remove CONFIG_UBSAN_SANITIZE_ALLDocumentation/dev-tools/ubsan.rst arch/arm/Kconfig arch/arm64/Kconfig +8 more+18 -410 replies
5/6ubsan: Split wrapping sanitizer Makefile rulesscripts/Makefile.lib scripts/Makefile.ubsan+18 -30 replies
6/6ubsan: Get x86_64 booting with unsigned wrap-around sanitizerarch/x86/kernel/Makefile arch/x86/kernel/apic/Makefile arch/x86/mm/Makefile +16 more+22 -20 replies

Reviews trailers per patch

1 of 6 patches has a Reviewed-by or Acked-by.

PatchFangrui SongJustin Stitt
1/6R-b R-b
2/6
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/6] ubsan: Introduce wrap-around sanitizers

Hi,

v2:
- improve CC list
- add reviewed-by tags
- reword some commit logs
v1: https://lore.kernel.org/all/[email protected]/

Lay the ground work for gaining instrumentation for signed[1], unsigned[2], and pointer[3] wrap-around by making all 3 sanitizers available for testing. Additionally gets x86_64 bootable under the unsigned sanitizer for the first time.

The compilers will need work before this can be generally useful, as the signed and pointer sanitizers are effectively a no-op with the kernel's required use of -fno-strict-overflow. The unsigned sanitizer will also need adjustment to deal with the many common code patterns that exist for unsigned wrap-around (e.g. "while (var--)", "-1UL", etc).

-Kees

Kees Cook (6):
ubsan: Use Clang's -fsanitize-trap=undefined option
ubsan: Reintroduce signed and unsigned overflow sanitizers
ubsan: Introduce CONFIG_UBSAN_POINTER_WRAP
ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL
ubsan: Split wrapping sanitizer Makefile rules
ubsan: Get x86_64 booting with unsigned wrap-around sanitizer

 Documentation/dev-tools/ubsan.rst | 28 +++-------
 arch/arm/Kconfig                  |  2 +-
 arch/arm64/Kconfig                |  2 +-
 arch/mips/Kconfig                 |  2 +-
 arch/parisc/Kconfig               |  2 +-
 arch/powerpc/Kconfig              |  2 +-
 arch/riscv/Kconfig                |  2 +-
 arch/s390/Kconfig                 |  2 +-
 arch/x86/Kconfig                  |  2 +-
 arch/x86/kernel/Makefile          |  1 +
 arch/x86/kernel/apic/Makefile     |  1 +
 arch/x86/mm/Makefile              |  1 +
 arch/x86/mm/pat/Makefile          |  1 +
 crypto/Makefile                   |  1 +
 drivers/acpi/Makefile             |  1 +
 include/linux/compiler_types.h    | 19 ++++++-
 kernel/Makefile                   |  1 +
 kernel/locking/Makefile           |  1 +
 kernel/rcu/Makefile               |  1 +
 kernel/sched/Makefile             |  1 +
 lib/Kconfig.ubsan                 | 41 +++++++++-----
 lib/Makefile                      |  1 +
 lib/crypto/Makefile               |  1 +
 lib/crypto/mpi/Makefile           |  1 +
 lib/test_ubsan.c                  | 82 ++++++++++++++++++++++++++++
 lib/ubsan.c                       | 89 +++++++++++++++++++++++++++++++
 lib/ubsan.h                       |  5 ++
 lib/zlib_deflate/Makefile         |  1 +
 lib/zstd/Makefile                 |  2 +
 mm/Makefile                       |  1 +
 net/core/Makefile                 |  1 +
 net/ipv4/Makefile                 |  1 +
 scripts/Makefile.lib              | 11 +++-
 scripts/Makefile.ubsan            | 11 +++-
 34 files changed, 278 insertions(+), 43 deletions(-)
Signature · 1 line
2.34.1