External Symbolizer with ubsan

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

External Symbolizer with ubsan

zapadinsky
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.
Reply | Threaded
Open this post in threaded view
|

Re: External Symbolizer with ubsan

Kostya Serebryany
+ Richard and Alexey


On Tue, Feb 26, 2013 at 12:27 PM, zapadinsky <[hidden email]> wrote:
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.



--
View this message in context: http://clang-developers.42468.n3.nabble.com/External-Symbolizer-with-ubsan-tp4030648.html
Sent from the Clang Developers mailing list archive at Nabble.com.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: External Symbolizer with ubsan

Alexey Samsonov
In reply to this post by zapadinsky
Hi!

On Tue, Feb 26, 2013 at 12:27 PM, zapadinsky <[hidden email]> wrote:
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.
 
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'

For now, you may disregard the warning and take a look at "runtime error" line - it tells
you the location of guilty load instruction in your code (module + offset).
If your binary is built with "-g" you may try running
addr2line -Cfe a.out 0x804bc04


And there is no information about this in manual
 



--
View this message in context: http://clang-developers.42468.n3.nabble.com/External-Symbolizer-with-ubsan-tp4030648.html
Sent from the Clang Developers mailing list archive at Nabble.com.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



--
Alexey Samsonov, MSK

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: External Symbolizer with ubsan

zapadinsky
>> 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?
Reply | Threaded
Open this post in threaded view
|

Re: External Symbolizer with ubsan

Richard Smith
On Tue, Feb 26, 2013 at 5:45 AM, zapadinsky <[hidden email]> wrote:
>> 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. 

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: External Symbolizer with ubsan

zapadinsky
>> -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.
Reply | Threaded
Open this post in threaded view
|

Re: External Symbolizer with ubsan

Richard Smith
On Tue, Feb 26, 2013 at 12:20 PM, zapadinsky <[hidden email]> wrote:
>> -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 :)

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: External Symbolizer with ubsan

zapadinsky
> ? 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
Reply | Threaded
Open this post in threaded view
|

Re: External Symbolizer with ubsan

Alexey Samsonov
In reply to this post by Richard Smith

On Tue, Feb 26, 2013 at 11:29 PM, Richard Smith <[hidden email]> wrote:
On Tue, Feb 26, 2013 at 5:45 AM, zapadinsky <[hidden email]> wrote:
>> 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?
 
 
-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. 

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




--
Alexey Samsonov, MSK

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: External Symbolizer with ubsan

Will Dietz
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


On Wed, Feb 27, 2013 at 7:32 AM, Alexey Samsonov <[hidden email]> wrote:

>
> On Tue, Feb 26, 2013 at 11:29 PM, Richard Smith <[hidden email]>
> wrote:
>>
>> On Tue, Feb 26, 2013 at 5:45 AM, zapadinsky <[hidden email]> wrote:
>>>
>>> >> 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?
>
>>
>>
>>>
>>> -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.
>>
>> _______________________________________________
>> cfe-dev mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>
>
>
> --
> Alexey Samsonov, MSK
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev