HomePhabricator

Add an unsigned shift base sanitizer

Authored by jfb on Aug 14 2020, 2:05 PM.

Description

Add an unsigned shift base sanitizer

It's not undefined behavior for an unsigned left shift to overflow (i.e. to
shift bits out), but it has been the source of bugs and exploits in certain
codebases in the past. As we do in other parts of UBSan, this patch adds a
dynamic checker which acts beyond UBSan and checks other sources of errors. The
option is enabled as part of -fsanitize=integer.

The flag is named: -fsanitize=unsigned-shift-base
This matches shift-base and shift-exponent flags.

rdar://problem/46129047

Differential Revision: https://reviews.llvm.org/D86000

Details