[llvm-bugs] [Bug 45379] New: Implement -fsanitize=bounds-strict
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Mar 31 14:04:19 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45379
Bug ID: 45379
Summary: Implement -fsanitize=bounds-strict
Product: compiler-rt
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: ubsan
Assignee: unassignedbugs at nondot.org
Reporter: keescook at chromium.org
CC: llvm-bugs at lists.llvm.org
Created attachment 23300
--> https://bugs.llvm.org/attachment.cgi?id=23300&action=edit
bounds checking PoC
I'd like Clang's UBSan bounds checker to disallow the old-style 0-byte and
1-byte array declarations as being seen as a variant of a flexible array
member.
As it turns out, GCC has "-fsanitize=bounds-strict" which gets me close to what
I'd like (it still allows 0-byte):
(Built with gcc -fsanitize=bounds)
$ ./bounds-gcc abc
flex (should always be okay): ok (no trap!)
zero (should be okay, treated as flex): ok (no trap!)
one (should fail): FAIL (this should have trapped!)
non_flex (should fail): FAIL (this should have trapped!)
non_trailing (absolutely should fail): Illegal instruction (core dumped)
(Built with gcc -fsanitize=bounds-strict)
$ ./bounds-gcc abc
flex (should always be okay): ok (no trap!)
zero (should be okay, treated as flex): ok (no trap!)
one (should fail): Illegal instruction (core dumped)
(Built with clang -fsanitize=bounds)
$ ./bounds-clang abc
flex (should always be okay): ok (no trap!)
zero (should be okay, treated as flex): ok (no trap!)
one (should fail): FAIL (this should have trapped!)
non_flex (should fail): Illegal instruction (core dumped)
Could Clang's UBSan grow the "strict" version of this to check 1-byte arrays?
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200331/5b354a48/attachment.html>
More information about the llvm-bugs
mailing list