Skip to content

Detect unsigned integer wrap-around (overflow and underflow) #27

Description

@kees

This is nearly identical to issue #26, except that it is for unsigned wrap around (i.e. overflow and underflow). This is a distinct problem, though, because GCC's Undefined Behavior Sanitizer (UBSan) does not support the unsigned overflow checker (it is only present in Clang). Additionally, there are many more cases of intentional wrap (especially with pointer values), so it will be more work for find and mark each of these true positives.

To avoid Undefined Behavior, the kernel must keep -fno-strict-overflow.

So, things to do:

  • make unsigned integer sanitizer work even with -fno-strict-overflow.
  • add unsigned integer sanitizer to GCC
  • create "expected unsigned overflow" helper inline functions marked with __attribute__((no_sanitize("unsigned-integer-overflow")))..
  • find all true positives and replace with helper calls.
  • add note to "deprecated.rst" with something like "open coded unsigned integer wrap around without a helper".
  • add back unsigned integer overflow as a UBSan Kconfig

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    compilerNeeds compiler supportenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions