[PATCH] D34298: [ubsan] Improve diagnostics for return value checks (compiler-rt)

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 10:43:33 PDT 2017


vsk added inline comments.


================
Comment at: lib/ubsan/ubsan_interface.inc:31
 INTERFACE_FUNCTION(__ubsan_handle_nonnull_arg_abort)
-INTERFACE_FUNCTION(__ubsan_handle_nonnull_return)
-INTERFACE_FUNCTION(__ubsan_handle_nonnull_return_abort)
+INTERFACE_FUNCTION(__ubsan_handle_nonnull_return_v1)
+INTERFACE_FUNCTION(__ubsan_handle_nonnull_return_v1_abort)
----------------
filcab wrote:
> arphaman wrote:
> > Just to confirm: We don't care about backwards compatibility, and the old version can be dropped safely?
> The usual reasoning is that we, in open source, always want to have matching clang+compiler-rt. But we don't want mysterious problems when mismatches happen, so I introduced the `_v*` mechanism to force the linker to "yell loudly" when there's a mismatch.
> 
> In the past, the first change to check data I remember (after the check has been in an llvm release) was made by me and we managed to come up with a heuristic to avoid revving the checks. The second change introduced the `_v*` mechanism (and also removed the older symbol).
@arphaman Yes, we're intentionally dropping backwards compatibility here. Xcode's build system knows to package up sanitizer runtimes into app bundles, so back/future-deployment isn't a concern. That is also not the common/supported use case -- runtime tools are generally meant for testing.


================
Comment at: test/ubsan/TestCases/Misc/nonnull.cpp:15
+
+__attribute__((returns_nonnull)) char *bar(int x, char *a) {
+  if (x > 10) {
----------------
filcab wrote:
> Shouldn't you do a similar transformation for the nullability test?
I did update the nullability.c test. If you mean that we should have a function that looks like "bar", but with a _Nonnull return value annotation, I can add that in.


https://reviews.llvm.org/D34298





More information about the llvm-commits mailing list