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

[???] Add UBSAN #369

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

MartinFlores751
Copy link
Contributor

Add UBSan to CMake options.

@MartinFlores751
Copy link
Contributor Author

There are more options that can be used (e.g., for unsigned integer overflow and implicit conversions), but they were left out as the logs became very noisy.

Docs for clang 13: https://releases.llvm.org/13.0.0/tools/clang/docs/UndefinedBehaviorSanitizer.html

@trel
Copy link
Member

trel commented Nov 15, 2024

Is noisy... bad? Are they real UB? Isn't that what we want to see? All the noise, aka 'signal'?

@korydraughn
Copy link
Contributor

Yes. If it found things, we need to open issues for them and address them.

We should review the results together first though.

@MartinFlores751
Copy link
Contributor Author

Here's what I have saved. Context for the first part, running non OIDC tests. Context for second part, stopping a server with ctrl^c after a successful start.

$ cat /tmp/run.txt.4174 
/opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/field.ipp:70:19: runtime error: unsigned integer overflow: 1701012321 * 5 cannot be represented in type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/field.ipp:70:19 in 
/opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/field.ipp:62:20: runtime error: unsigned integer overflow: 1701012321 * 5 cannot be represented in type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/field.ipp:62:20 in 
/opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/field.ipp:62:24: runtime error: unsigned integer overflow: 4210094309 + 1630368880 cannot be represented in type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/field.ipp:62:24 in 
/opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/core/impl/string.ipp:33:12: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/core/impl/string.ipp:33:12 in 
/opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/core/detail/string.hpp:37:39: runtime error: unsigned integer overflow: 45 - 65 cannot be represented in type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/core/detail/string.hpp:37:39 in 
/opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/impl/signal_set_service.ipp:142:12: runtime error: implicit conversion from type 'ssize_t' (aka 'long') of value -1 (64-bit, signed) to type 'unsigned long' changed the value to 18446744073709551615 (64-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/impl/signal_set_service.ipp:142:12 in 
$ cat /tmp/run.txt.4368 
/opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/impl/signal_set_service.ipp:142:12: runtime error: implicit conversion from type 'ssize_t' (aka 'long') of value -1 (64-bit, signed) to type 'unsigned long' changed the value to 18446744073709551615 (64-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/impl/signal_set_service.ipp:142:12 in

@korydraughn
Copy link
Contributor

Looks like it's complaining about Boost.Beast, not our code.

Can it be configured to ignore Boost.Beast code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants