Hi!

We have some unit tests failing because of `ber_decode` from the 
https://github.com/vlm/asn1c library fails when running with 
`detect_stack_use_after_return=1`. There is no sanitizer output, but the 
function just fails.

It seems to only happen in 64-bit mode and we've previously increased the 
stack size to get around a similar issue, but this time, I can't figure out 
how to either solve the underlying problem - or how to give the sanitizer 
the stack it needs. I simply want to turn `detect_stack_use_after_return` 
off even if provided via `ASAN_OPTIONS`.

My current workaround it rather ugly:
```
extern "C" void __attribute__((constructor)) disable_asan()
{
    if (auto opts = std::getenv("ASAN_OPTIONS"); opts)
    {
        if (std::ifstream is("/proc/self/cmdline"); is)
        {
            if (std::string cmd(std::istreambuf_iterator<char>(is), 
std::istreambuf_iterator<char>{}); not cmd.empty())
            {
                std::clog << "RESTARTING \"" << cmd << "\" WITHOUT 
ASAN_OPTIONS=" << opts << '\n';
                unsetenv("ASAN_OPTIONS");
                exit(system(cmd.c_str()));
            }
        }
    }
}
```
What would be a cleaner way to either prevent this option from being used - 
or get to the root cause (since I don't get any Asan output)?

Br,
Ted

-- 
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/d024c420-6517-44be-ac0d-0fc92b68ab52n%40googlegroups.com.

Reply via email to