Teach UBSan's bounds check to opportunistically use pass_object_size
information to check array accesses.
rdar://33272922
Differential D40940
[ubsan] Use pass_object_size info in bounds checks vsk on Dec 6 2017, 7:45 PM. Authored by
Details
Teach UBSan's bounds check to opportunistically use pass_object_size rdar://33272922
Diff Detail Event TimelineComment Actions Thanks for this! It's interesting to me that these array-bound checks don't seem to use @llvm.objectsize in some form already. I can't find any notes about it grepping through git/source, so I'm happy with it.
Comment Actions Thanks for your feedback.
Comment Actions
That would be a cool experiment. That said, one of the upsides of the current ubsan is that whether it will produce a diagnostic is predictable (as long as you don't use uninitialized data); you lose that to some extent with llvm.objectsize because it depends on the optimizer.
Comment Actions I backed out the part of this patch which deals with array parameters declared like p[10] or p[static 10]: r320185.
Comment Actions
True. If that's not desirable to have in array-bounds, we could potentially move these checks under -fsanitize=object-size instead. We'd just have to be careful about not emitting object-size and array-bounds checks for the same array access.
|
nit: would IgnoreParenImpCasts be better?