Status: Accepted
Owner: [email protected]
Labels: Type-Defect Priority-Medium

New issue 363 by [email protected]: Mixing instrumented and non-instrumented runtime initializers can cause segfaults
https://code.google.com/p/address-sanitizer/issues/detail?id=363

This is probably a known thing/limitation, but I haven't found an open bug about it.

When linking together instrumented and non-instrumented object files, if the non-instrumented code contains C++ global runtime initialization, these initializers can be invoked before ASan's runtime is initialized. Such a initializer can call a function from an *instrumented* file, which can crash because the runtime is not initialized (there's no shadow memory). Example:

Instrumented:

    void func(char *ptr) {
        *ptr = 'X';
    }

Not instrumented:

    struct C1 {
        C1() {
            char buffer[10];
            func(buffer);
        }
    };

    C1 *obj = new C1();

This will segfault in func() because it will try to read from the shadow memory.

Attached a test case for this, that reproduces the segfault (at least on OS X).


Attachments:
        mixing-global-constructors.cc  662 bytes

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to