Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to show full stack trace in TySan findings #121697

Closed
firewave opened this issue Jan 5, 2025 · 2 comments
Closed

Make it possible to show full stack trace in TySan findings #121697

firewave opened this issue Jan 5, 2025 · 2 comments
Labels
compiler-rt:tysan Type sanitizer

Comments

@firewave
Copy link

firewave commented Jan 5, 2025

When encountering an issue within an application built with TySan the resulting message makes it difficult to pinpoint the actual code which is causing this:

==8766==ERROR: TypeSanitizer: type-aliasing-violation on address 0x7f1ca6ceb110 (pc 0x7f1ca5b442ca bp 0x7fffe21df150 sp 0x7fffe21df0f8 tid 8766)
READ of size 8 at 0x7f1ca6ceb110 with type long accesses part of an existing object of type std::__1::unordered_set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> that starts at offset -8
    #0 0x7f1ca5b442c9 in std::__1::__bucket_list_deallocator<std::__1::allocator<std::__1::__hash_node_base<std::__1::__hash_node<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, void*>*>*>>::size[abi:de190106]() const /usr/include/c++/v1/__hash_table:576:75

Other sanitizers provide the print_stacktrace option which can be set via their respective *_OPTIONS environment variables to show the full stacktrace. It would be great if TySan could provide such an option as well.

@firewave
Copy link
Author

Fixed by #121756.

But unfortunately I still do not get any full stack traces. Looking into it.

@firewave
Copy link
Author

firewave commented Jan 10, 2025

Nevermind. It works:

==353==ERROR: TypeSanitizer: type-aliasing-violation on address 0x7f5dfbd4bcb0 (pc 0x7f5dfb3e29d2 bp 0x7ffff5178360 sp 0x7ffff51782f0 tid 353)
READ of size 8 at 0x7f5dfbd4bcb0 with type p1 _ZTSNSt3__116__hash_node_baseIPNS_11__hash_nodeIiPvEEEE (in std::__1::__hash_node_base<std::__1::__hash_node<int, void*>*> at offset 0) accesses part of an existing object of type std::__1::unordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int>> that starts at offset -16
    #0 0x7f5dfb3e29d1 in std::__1::__hash_table<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int>>::~__hash_table() /usr/include/c++/v1/__hash_table:1107:35
    #1 0x7f5dfb3da239 in std::__1::unordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int>>::~unordered_set[abi:ne190106]() /usr/include/c++/v1/unordered_set:718:3
    #2 0x7f5dfae668a6 in __run_exit_handlers /build/glibc-LcI20x/glibc-2.31/stdlib/exit.c:108:8

Edit: updated with debug information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler-rt:tysan Type sanitizer
Projects
None yet
Development

No branches or pull requests

1 participant