[ubsan] nonnull and returns_nonnull sanitization

Jakub Jelinek jakub at redhat.com
Tue Sep 9 04:39:20 PDT 2014


On Mon, Sep 08, 2014 at 01:32:02PM -0700, Alexey Samsonov wrote:
> OK. I've submitted the patches to Clang and UBSan runtime which implement
> -fsanitize=nonnull-attribute and -fsanitize=returns-nonnull-attribute (the
> last
> commit is r217400). I've added source locations of attribute declarations to
> the static data passed in UBSan handlers to print them in the error
> reports: it makes
> sense to actually show user the declaration which forbids passing/returning
> null pointer.
> This location is also added to returns-nonull attribute, because the
> attribute might be
> declared far from the actual function definition with incorrect
> return-statement.

Thanks.  BTW, the recent changes to move Die() call out of the
__ubsan_*_abort handlers look wrong to me, the functions are no longer
noreturn if for whatever reason isDisabled would return true on the
location, but the compiler rightfully assumes those functions never return.
If you want to avoid dying without emitting messages, you could e.g. ignore
isDisabled if abort is set in the opts.

	Jakub



More information about the llvm-commits mailing list