This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Sanitizers difference in between GCC and LLVM
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Martin Liška <mliska at suse dot cz>
- Cc: Marek Polacek <polacek at redhat dot com>, Maxim Ostapenko <m dot ostapenko at samsung dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 18 Oct 2017 11:16:16 +0200
- Subject: Re: [RFC] Sanitizers difference in between GCC and LLVM
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jakub at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AAB6813AA6
- References: <20171016185250.GX14653@tucnak> <ca8806b5-a8b2-737f-bed1-e252068d4ceb@suse.cz>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Oct 18, 2017 at 11:00:30AM +0200, Martin Liška wrote:
> Hi.
>
> I would like to use this thread to slightly describe differences in GCC and LLVM.
> I compared options support by both and:
>
> UBSAN:
>
> 1)
> gcc: error: unrecognized argument to -fsanitize= option: ‘nullability-arg’
> gcc: error: unrecognized argument to -fsanitize= option: ‘nullability-assign’
> gcc: error: unrecognized argument to -fsanitize= option: ‘nullability-return’
I believe those are for diagnostic of some Objective-C addition, some
_Nullable and _Nonnull keywords on (pointer) types. Seems LLVM supports it as an
extension even for C/C++.
> I guess it's covered by -fsanitize=nonnull-attribute and -fsanitize=returns-nonnull-attribute.
> One can't have in GCC a local variable with non-null attribute (nullability-assign), right?
>
> 2) unsigned-integer-overflow
>
> As documented, not being a real UBSAN. Do we want that or seen as not useful?
This one is not implemented on purpose, it doesn't make any sense to me.
> 3) function
>
> Indirect function pointer comparison using RTTI in C++. Would it be useful? Ideas?
Dunno what this one is about.
4) builtin
Which I've posted yesterday patch for.
> ASAN:
>
> For ASAN, there's quite up-to-date page: https://github.com/google/sanitizers/wiki/AddressSanitizerClangVsGCC-(5.0-vs-7.1)
>
> The page is quite up-to-date. Currently we should cover all what LLVM supports. Am I right? Or is there any interesting
> feature we miss?
As I said on IRC, we probably should be redirecting at sanopt or asan pass
__builtin_memcpy etc. calls to __asan_memcpy etc.
Jakub