[all-commits] [llvm/llvm-project] 81b4b8: [Sanitizer] Support -fwrapv with -fsanitize=signed...

Justin Stitt via All-commits all-commits at lists.llvm.org
Wed Feb 21 13:00:23 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 81b4b89197a6be5f19f907b558540bb3cb70f064
      https://github.com/llvm/llvm-project/commit/81b4b89197a6be5f19f907b558540bb3cb70f064
  Author: Justin Stitt <jstitt007 at gmail.com>
  Date:   2024-02-21 (Wed, 21 Feb 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/docs/UndefinedBehaviorSanitizer.rst
    M clang/lib/CodeGen/CGExprScalar.cpp
    M clang/test/CodeGen/integer-overflow.c

  Log Message:
  -----------
  [Sanitizer] Support -fwrapv with -fsanitize=signed-integer-overflow (#82432)

Clang has a `signed-integer-overflow` sanitizer to catch arithmetic
overflow; however, most of its instrumentation [fails to
apply](https://godbolt.org/z/ee41rE8o6) when `-fwrapv` is enabled; this
is by design.

The Linux kernel enables `-fno-strict-overflow` which implies `-fwrapv`.
This means we are [currently unable to detect signed-integer
wrap-around](https://github.com/KSPP/linux/issues/26). All the while,
the root cause of many security vulnerabilities in the Linux kernel is
[arithmetic overflow](https://cwe.mitre.org/data/definitions/190.html).

To work around this and enhance the functionality of
`-fsanitize=signed-integer-overflow`, we instrument signed arithmetic
even if the signed overflow behavior is defined.

Co-authored-by: Justin Stitt <justinstitt at google.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list