[cfe-commits] [patch] UBSAN darwin support

Richard Smith richard at metafoo.co.uk
Tue Nov 13 16:19:51 PST 2012


In r167888, r167889, r167890.

We're still missing float formatting for sanitizer_common's Printf.
For the time being, I'm using the platform's snprintf, but I've put
together a float formatting routine for sanitizer_common, which I'll
be mailing out for review when I've had time to do some more testing
of it.

On Fri, Nov 2, 2012 at 8:24 AM, Alexey Samsonov <samsonov at google.com> wrote:
>
>
> On Wed, Oct 31, 2012 at 12:38 AM, Richard Smith <richard at metafoo.co.uk>
> wrote:
>>
>> This LGTM for the short term, but I'd like someone with more
>>
>> familiarity with the sanitizer_common pieces to look over it too (see
>> attached ubsan.patch).
>>
>>
>> Slightly longer-term, we should move away from using fprintf and over
>> to sanitizer_common's Printf implementation. There are four format
>> specifiers which ubsan uses which Printf doesn't yet provide:
>>
>>   %08x
>>   %lld
>>   %llu
>>   %Lg
>>
>> The attached patch implements the first three and ports ubsan over to
>> using sanitizer_common's Printf. Two more things need doing before we
>> can switch to this:
>>
>>  1) Implement Printf support for formatting of long double
>>  2) Move the 'isatty' check into sanitizer_common, so it can do the
>> right platform-specific magic and can respect calls to
>> __sanitizer_set_report_path
>
>
> I've moved unit test for Printf to sanitizer_common/tests/
> and added PrintsToTty() function which respects current report file to
> sanitizer_common.h
>
>>
>> Once those are done, ubsan won't need to include any system headers
>> any more. Seem reasonable?
>
>
> Sure. The patch looks fine too.
>
> @@ -23,7 +26,10 @@
>  endif()
>
>  if(CAN_TARGET_I386)
> -  add_library(clang_rt.ubsan-i386 STATIC ${UBSAN_SOURCES})
> +  add_library(clang_rt.ubsan-i386 STATIC
> +    ${UBSAN_SOURCES}
> +    $<TARGET_OBJECTS:RTSanitizerCommon.x86_64>
>
> RTSanitizerCommon.i386
>
> +    )
>    set_target_compile_flags(clang_rt.ubsan-i386
>      ${UBSAN_CFLAGS} ${TARGET_I386_CFLAGS}
>
>
>>
>>
>> On Tue, Oct 30, 2012 at 10:22 AM, Jean-Daniel Dupas
>> <devlists at shadowlab.org> wrote:
>> > Ping
>> >
>> > Le 22 oct. 2012 à 12:51, Jean-Daniel Dupas <devlists at shadowlab.org> a
>> > écrit :
>> >
>> >> Thanks.
>> >>
>> >> Look like you forget to "svn add" the new Makefile and unistd.h though.
>> >>
>> >> Here is a rebased svn patch that include these files.
>> >>
>> >> Le 22 oct. 2012 à 12:31, Jonathan Sauer <jonathan.sauer at gmx.de> a écrit
>> >> :
>> >>
>> >>> Hello,
>> >>>
>> >>> I applied the patch to compiler-rt r166410 (darwin-ubsan.patch did not
>> >>> apply cleanly, most likely due
>> >>> to changes made in the meantime), and compiler-rt compiles
>> >>> successfully as part of LLVM (i.e. as
>> >>> described at <http://clang.llvm.org/get_started.html>) on OS X 10.6. I
>> >>> rebased your patches to r166410
>> >>> and attached the new one (made from svn instead of git, though).
>> >>>
>> >>>
>> >>> Jonathan
>> >>>
>> >>> <ubsan.diff>
>> >>>
>> >>> _______________________________________________
>> >>> cfe-commits mailing list
>> >>> cfe-commits at cs.uiuc.edu
>> >>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> >>
>> >> -- Jean-Daniel
>> >>
>> >>
>> >>
>> >> <ubsan.diff>_______________________________________________
>> >> cfe-commits mailing list
>> >> cfe-commits at cs.uiuc.edu
>> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> >
>> > -- Jean-Daniel
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > cfe-commits mailing list
>> > cfe-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> >
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>
>
> --
> Alexey Samsonov, MSK
>




More information about the cfe-commits mailing list