Skip to content

strict_init_order=false mode of init-order checking doesn't work on Darwin #186

Open
@ramosian-glider

Description

@ramosian-glider

Originally reported on Google Code with ID 186

The non-strict order mode relies on the fact that all __asan_register_globals() calls
will occur before the dynamic initialization of the globals, so that the tool will
know about every global before trying to initialize anything.
This assumption is broken on Darwin, because the linker does not support static constructor
priorities across translation units, and usually _all_ the static constructors from
a certain module will be executed before moving on to a next module.

This means that the only way to use the init-order checker on Darwin is to run it in
the strict_init_order=true mode, which is prone to false positives (Alexey, please
correct me if I'm wrong)

There are several things we can do about this:

1. Declare strict_init_order=true the default (or the only possible) option on Darwin.
2. Declare the init-order-checker broken on Darwin.
3. Create a section with appending linkage that contains pointers to ASan's per-module
constructors. Once any of those is executed, it calls every other constructors. This
way we'll make sure ASan constructors are executed before others (we still won't have
full support for constructor priorities, but we don't actually need it).

Reported by ramosian.glider on 2013-05-17 12:53:07

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions