try to compile some tiny example with -S --emit-llvm some

On Mon, 6 Feb 2023 at 18:37, Renat Idrisov <[email protected]> wrote:

> Hi, I was thinking that it could be too early for printf and I tried
> completely empty runtime as well, but it crashes similarly.
>
> Could you tell more about module constructors? Where do they come from?
> To mention, we are using custom libc and there is no C++ in the code. I
> was thinking that gcc instruments no advanced code, just function calls.
>
> Thank you!
> On Monday, February 6, 2023 at 5:30:19 PM UTC-8 [email protected] wrote:
>
>> Hi,
>>
>> it's hard to tell what is going on with your OS, but with linux and
>> glibc, very likely the first callback will be triggered before glibc is
>> initialized, so printf will crash. E.g on linux we use .preinit_array to
>> call asan.
>> Maybe this is the case for you. Also asan inserts module constructors,
>> maybe they are too early for printf.
>>
>> Thanks,
>> Vitaly
>>
>> On Mon, 6 Feb 2023 at 15:38, Renat Idrisov <[email protected]> wrote:
>>
>>> Hi All,
>>> It is about mips64r6 and gcc-12.2.0.
>>>
>>> I am trying to come up with custom ASAN runtime by implementing methods
>>> like:
>>> __asan_report_load1, asan report, etc.
>>>
>>> I left all methods empty, printing single log line and methods returning
>>> stack allocations are returning NULL, for example:
>>> uptr __asan_stack_malloc_0(size_t s) { printf("%s\n", __func__); return
>>> NULL; }
>>>
>>> Instrumented binary crashes so early that it is hard to reason about
>>> what exactly is happening.
>>>
>>> I do not see any globals that I should have initialized, is there
>>> something obvious that I am missing or binary instrumentation itself is
>>> tightly coupled with Linux so reimplementing callbacks is not enough?
>>>
>>> Thank you!
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "address-sanitizer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/address-sanitizer/b18d564c-84b6-468c-8d3e-12fd93de25c8n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/address-sanitizer/b18d564c-84b6-468c-8d3e-12fd93de25c8n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/address-sanitizer/26aa7458-a9f1-4e2c-aaf1-e7c2293e87abn%40googlegroups.com
> <https://groups.google.com/d/msgid/address-sanitizer/26aa7458-a9f1-4e2c-aaf1-e7c2293e87abn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/address-sanitizer/CAPjTjwtt6btTmUQrrAnc2xqm76dg_oGrnsxTLbY_bPSZvRsMtw%40mail.gmail.com.

Reply via email to