External Symbolizer with ubsan

I've tried hard to rule it out by myself... but yielded.

-fsanitize=enum require an external symbolizer. This requirement was added
in svn revision 170407. But how to set up an External Symbolizer if I am not
using asan? I've tried env ASAN_FILTER with no success.

Now I am getting this error massage:
==19442== WARNING: Trying to symbolize code, but external symbolizer is not
initialized!
/.../a.out:0x804bc04: runtime error: load of value 5, which is not a valid
value for type 'TEnum'

And there is no information about this in manual.

  • Richard and Alexey

Hi!

I've tried hard to rule it out by myself... but yielded.

-fsanitize=enum require an external symbolizer.

External symbolizer in UBSan tool is not a requirement, but not fully
implemented feature. For now, I can add setting external symbolizer for
ubsan via env
var if Richard tells that's fine.

-fsanitize=integer somehow print the line number and character of an
operator raised an overflow error. Why enum sanitizer needs symbolizer?
There was an idea to print the stack trace?

I’ve tried hard to rule it out by myself… but yielded.

-fsanitize=enum require an external symbolizer.

External symbolizer in UBSan tool is not a requirement, but not fully
implemented feature. For now, I can add setting external symbolizer for
ubsan via env
var if Richard tells that’s fine.

Thank you, that would be great.

-fsanitize=integer somehow print the line number and character of an
operator raised an overflow error. Why enum sanitizer needs symbolizer?
There was an idea to print the stack trace?

Two things: firstly, ubsan can’t currently determine the source location for all checks at build time; for a few, we work out the location based on return address at runtime. That’s just due to incomplete implementation. Secondly, as you suspect, we want to include a stack trace eventually.

-fsanitize=integer somehow print the line number and character of an
operator raised an overflow error. Why enum sanitizer needs symbolizer?
There was an idea to print the stack trace?

Two things: firstly, ubsan can't currently determine the source location
for all checks at build time; for a few, we work out the location based on
return address at runtime. That's just due to incomplete implementation.
Secondly, as you suspect, we want to include a stack trace eventually.

Yes stack trace would be a great feature for all ubsan checks. But now enum
sanitizer signalling a problem line dozen of times. And printing the stack
trace each time will hang debug process...

It is not obvious why it is so different from integer sanitizer which can
determine the source location and signal problem line only once. Integer
sanitizer looks rather mature compared to enum sanitizer.

-fsanitize=integer somehow print the line number and character of an
operator raised an overflow error. Why enum sanitizer needs symbolizer?
There was an idea to print the stack trace?

Two things: firstly, ubsan can’t currently determine the source location
for all checks at build time; for a few, we work out the location based on
return address at runtime. That’s just due to incomplete implementation.
Secondly, as you suspect, we want to include a stack trace eventually.

Yes stack trace would be a great feature for all ubsan checks. But now enum
sanitizer signalling a problem line dozen of times. And printing the stack
trace each time will hang debug process…

? Each location should only be diagnosed once, even though we don’t list a column-accurate location in the diagnostic.

It is not obvious why it is so different from integer sanitizer which can
determine the source location and signal problem line only once. Integer
sanitizer looks rather mature compared to enum sanitizer.

As I said, it’s just due to incomplete implementation. Patches welcome :slight_smile:

? Each location should only be diagnosed once, even though we don't list a
column-accurate location in the diagnostic.

I have clang from trunk as it was on 20-26 January. And Same location
reported many times.
....
/.../lib....so:0x14c5de0: runtime error: load of value 4294967295, which is
not a valid value for type '...'
/.../lib....so:0x14c4b86: runtime error: load of value 4294967295, which is
not a valid value for type '...'
/.../lib....so:0x14c5de0: runtime error: load of value 4294967295, which is
not a valid value for type '...'
/.../lib....so:0x14c4b86: runtime error: load of value 4294967295, which is
not a valid value for type '...'
....

The type is the same and shared library is the same and address and value

>> I've tried hard to rule it out by myself... but yielded.
>>
>> -fsanitize=enum require an external symbolizer.

> External symbolizer in UBSan tool is not a requirement, but not fully
> implemented feature. For now, I can add setting external symbolizer for
> ubsan via env
> var if Richard tells that's fine.

Thank you, that would be great.

Can __ubsan::getCallerLocation() be called from multiple threads?
I've seen no locks in UBSan runtime, can it be the case that ubsan tries to
print reports from
several threads simultaneously?

Ubsan uses atomic operations on the SourceLocation for deduplication[1].

One side effect of this is that sanitizer checks without this location
information don't support deduplication and will print multiple times.

Float cast checks have this problem as well, see the TODO's in
ubsan_handlers.cc[2].

~Will

[1] https://github.com/llvm-mirror/compiler-rt/blob/master/lib/ubsan/ubsan_value.h#L67-L72
[2] https://github.com/llvm-mirror/compiler-rt/blob/master/lib/ubsan/ubsan_handlers.cc#L233