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

[#390] Add UBSAN #369

Merged
merged 1 commit into from
Dec 13, 2024
Merged

[#390] Add UBSAN #369

merged 1 commit into from
Dec 13, 2024

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?

@MartinFlores751
Copy link
Contributor Author

Took a look at the listed files that have unsigned overflow. They all seem to be intentionally designed to do so.

Just so it's not lost, following is an example of one unsigned integer overflow, using trap to produce the following core dump:

(gdb) bt
#0  0x00000000006fd083 in boost::beast::http::detail::field_table::digest (s=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/field.ipp:74
#1  0x00000000006fcdaf in boost::beast::http::detail::field_table::field_table (this=0x1c31ae0 <boost::beast::http::detail::get_field_table()::tab>) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/field.ipp:482
#2  0x0000000000844027 in boost::beast::http::detail::get_field_table () at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/field.ipp:548
#3  boost::beast::http::string_to_field (s=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/field.ipp:572
#4  boost::beast::http::basic_parser<true>::parse_fields (this=this@entry=0xc605c20, in=@0x7fffd911d6f8: 0xc696632 "Host: localhost:9000\r\nUser-Agent: python-requests/2.32.3\r\nAccept-Encoding: gzip, deflate, br\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-Length: 0\r\nAuthorization: Basic cm9kczpyb2Rz\r\n\r\n", last=<optimized out>, last@entry=0xc6966ed "", ec=...)
    at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/basic_parser.ipp:437
#5  0x0000000000842509 in boost::beast::http::basic_parser<true>::put (this=this@entry=0xc605c20, buffer=..., ec=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/basic_parser.ipp:149
#6  0x0000000000841867 in boost::beast::http::basic_parser<true>::put<boost::asio::mutable_buffer> (this=this@entry=0xc605c20, buffers=..., ec=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/basic_parser.hpp:41
#7  0x0000000000840f36 in boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>::operator()<boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >(boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)>&, boost::system::error_code, unsigned long) (this=this@entry=0x7fffd911daf0, self=..., ec=..., bytes_transferred=237) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/http/impl/read.hpp:187
#8  0x00000000008519ec in boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)>::operator()<boost::system::error_code&, unsigned long&>(boost::system::error_code&, unsigned long&) (this=this@entry=0x7fffd911dae8, t=@0x7fffd911d9c8: 237, t=@0x7fffd911d9c8: 237) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/compose.hpp:107
#9  0x000000000084d913 in boost::beast::async_base<boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)>, boost::asio::any_io_executor, std::__1::allocator<void> >::complete_now<boost::system::error_code&, unsigned long&>(boost::system::error_code&, unsigned long&) (this=this@entry=0x7fffd911dae0, args=@0x7fffd911d9c8: 237, args=@0x7fffd911d9c8: 237)
    at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/core/async_base.hpp:426
#10 0x000000000084c09c in boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >::operator()(boost::system::error_code, unsigned long) (this=this@entry=0x7fffd911dae0, ec=..., bytes_transferred=237)
    at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/beast/core/impl/basic_stream.hpp:425
#11 0x000000000084ed61 in boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::system::error_code, unsigned long>::operator()() (this=this@entry=0x7fffd911dae0)
    at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/bind_handler.hpp:289
#12 0x000000000084f2c3 in boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::system::error_code, unsigned long>, boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::be--Type <RET> for more, q to quit, c to continue without paging--
ast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::system::error_code, unsigned long> >(boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::system::error_code, unsigned long>&, boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::system::error_code, unsigned long>&) (function=..., context=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/handler_invoke_helpers.hpp:51
#13 boost::asio::detail::executor_function::complete<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::system::error_code, unsigned long>, std::__1::allocator<void> >(boost::asio::detail::executor_function::impl_base*, bool) (base=base@entry=0xc70fec0, call=true) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/executor_function.hpp:116
#14 0x00000000007d48d2 in boost::asio::detail::executor_function::operator() (this=<optimized out>, this@entry=0x7fffd911dd08) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/executor_function.hpp:64
#15 0x00000000007d499e in boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::executor_function, boost::asio::detail::executor_function> (function=..., context=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/handler_invoke_helpers.hpp:51
#16 boost::asio::detail::executor_op<boost::asio::detail::executor_function, std::__1::allocator<void>, boost::asio::detail::scheduler_operation>::do_complete (owner=owner@entry=0xc6969a0, base=base@entry=0xc8128c0) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/executor_op.hpp:70
#17 0x00000000007d4bcd in boost::asio::detail::scheduler_operation::complete (this=0xc8128c0, owner=0xc6969a0, ec=..., bytes_transferred=0) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/scheduler_operation.hpp:40
#18 boost::asio::detail::strand_executor_service::run_ready_handlers (impl=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/impl/strand_executor_service.ipp:150
#19 0x00000000007d79cd in boost::asio::detail::strand_executor_service::invoker<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 4ul> const, void>::operator() (this=0x7fffd911ddc0) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/impl/strand_executor_service.hpp:136
#20 boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::strand_executor_service::invoker<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 4ul> const, void>, boost::asio::detail::strand_executor_service::invoker<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 4ul> const, void> > (function=..., context=...)
    at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/handler_invoke_helpers.hpp:51
#21 boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 4ul>::execute<boost::asio::detail::strand_executor_service::invoker<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 4ul> const, void> > (this=this@entry=0x7fffd911e280, f=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/impl/io_context.hpp:294
#22 0x00000000007d783b in boost::asio::detail::strand_executor_service::do_execute<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 4ul> const, boost::asio::detail::executor_function, std::__1::allocator<void> > (impl=..., ex=..., function=..., a=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/impl/strand_executor_service.hpp:268
#23 0x00000000007d76eb in boost::asio::detail::strand_executor_service::execute<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 4ul> const, boost::asio::detail::executor_function> (impl=..., ex=..., function=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/impl/strand_executor_service.hpp:218
#24 boost::asio::strand<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 4ul> >::execute<boost::asio::detail::executor_function> (this=0x6, this@entry=0x7fffd911e280, f=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/strand.hpp:287
#25 0x00000000007d752f in boost::asio::execution::detail::any_executor_base::execute_ex<boost::asio::strand<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 4ul> > > (ex=..., f=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/execution/any_executor.hpp:1004
#26 0x000000000084ef0c in boost::asio::execution::detail::any_executor_base::execute<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::system::error_code, unsigned long> >(boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::system::error_code, unsigned long>&&) const (this=0x7fffd911e280, f=...)
    at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/execution/any_executor.hpp:788
#27 0x000000000084ec7b in boost::asio::detail::handler_work_base<boost::asio::any_io_executor, boost::asio::any_io_executor, boost::asio::io_context, boost::asio::executor, void>::dispatch<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boos--Type <RET> for more, q to quit, c to continue without paging--
t::system::error_code, unsigned long)> >, boost::system::error_code, unsigned long>, boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> > >(boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::system::error_code, unsigned long>&, boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >&) (this=0x9f694d, this@entry=0x7fffd911dfd8, function=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/handler_work.hpp:446
#28 boost::asio::detail::handler_work<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::asio::any_io_executor, void>::complete<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::system::error_code, unsigned long> >(boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::system::error_code, unsigned long>&, boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >&) (this=this@entry=0x7fffd911e248, 
    function=..., handler=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/handler_work.hpp:488
#29 0x000000000084e530 in boost::asio::detail::reactive_socket_recv_op<boost::beast::buffers_prefix_view<boost::asio::mutable_buffer>, boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffer, boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void (boost::asio::any_io_executor)>, boost::beast::detail::bind_front_wrapper<void (irods::http::session::*)(boost::system::error_code, unsigned long), std::__1::shared_ptr<irods::http::session> >, void (boost::system::error_code, unsigned long)>, void (boost::system::error_code, unsigned long)> >, boost::asio::any_io_executor>::do_complete(void*, boost::asio::detail::scheduler_operation*, boost::system::error_code const&, unsigned long) (owner=owner@entry=0xc7105d0, base=base@entry=0xc8128c0) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/reactive_socket_recv_op.hpp:147
#30 0x00000000007c2fee in boost::asio::detail::scheduler_operation::complete (this=0xc8128c0, owner=0xc7105d0, ec=..., bytes_transferred=0) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/scheduler_operation.hpp:40
#31 boost::asio::detail::scheduler::do_run_one (this=this@entry=0xc7105d0, lock=..., this_thread=..., ec=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/impl/scheduler.ipp:492
#32 0x00000000007c27ed in boost::asio::detail::scheduler::run (this=this@entry=0xc7105d0, ec=...) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/detail/impl/scheduler.ipp:210
#33 0x00000000007a3b43 in boost::asio::io_context::run (this=<optimized out>, this@entry=0x7fffd911e6e8) at /opt/irods-externals/boost-libcxx1.81.0-1/include/boost/asio/impl/io_context.ipp:63
#34 0x000000000079f1bc in main (_argc=<optimized out>, _argv=<optimized out>) at /workspaces/irods_client_http_api/core/src/main.cpp:1103

@MartinFlores751
Copy link
Contributor Author

It does seem we can create an ignore file to not sanitize certain things: https://releases.llvm.org/13.0.1/tools/clang/docs/SanitizerSpecialCaseList.html

I'll try using it shortly.

This can be used for asan too. Not sure if that might be of interest for you @korydraughn, since I think you've used it the most.

@korydraughn
Copy link
Contributor

I'm always open to learning. Make it good for everyone.

@MartinFlores751
Copy link
Contributor Author

Added more checks. ignorelist.txt is used to skip generation of UBSAN code for specified files at compile time, for the specific cases stated in the file.

Of note:

@MartinFlores751 MartinFlores751 marked this pull request as ready for review December 11, 2024 15:51
@MartinFlores751 MartinFlores751 changed the title [???] Add UBSAN [#390] Add UBSAN Dec 11, 2024
Copy link
Contributor

@korydraughn korydraughn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent.

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@alanking alanking requested a review from SwooshyCueb December 11, 2024 16:55
Copy link
Member

@SwooshyCueb SwooshyCueb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like us to eventually move away from having all of this stuff in our CMake, but I don't think we're quite ready for a workflow that leans on setting a bunch of stuff via arguments to cmake.

Aside from Kory's comments and my ignorelist suggestions, this looks good to me.

ignorelist.txt Outdated Show resolved Hide resolved
@korydraughn
Copy link
Contributor

I'd like us to eventually move away from having all of this stuff in our CMake, but I don't think we're quite ready for a workflow that leans on setting a bunch of stuff via arguments to cmake.

That sounds like a push towards the cmake presets feature.

I like the idea of a smaller CMake. Demonstrate and prove to the team this is the way.

@korydraughn
Copy link
Contributor

What's the status of this PR? Seems we're very close.

@MartinFlores751
Copy link
Contributor Author

Need to address open comments is all, I think.

@korydraughn
Copy link
Contributor

Good. Let's get this merged today as well.

Copy link

@alanking alanking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks alright to me. I defer.

Copy link
Contributor

@korydraughn korydraughn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Squash it.

Please open an issue to add ubsan to irods/irods.

@MartinFlores751
Copy link
Contributor Author

Created irods/irods#8090.

@MartinFlores751
Copy link
Contributor Author

Squashed.

@korydraughn
Copy link
Contributor

Slightly tweaked commit message.

Top line:

[_390] Add CMake options for enabling Undefined Behavior Sanitizer

Commit message body:
add -> adds

@MartinFlores751
Copy link
Contributor Author

Message tweaked.

Copy link
Contributor

@korydraughn korydraughn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pound it.

This commit adds UBSAN to the CMake options while also providing
defaults for UBSAN and an ignore list.
@MartinFlores751
Copy link
Contributor Author

Pounded.

@alanking alanking merged commit ccb9928 into irods:main Dec 13, 2024
5 checks passed
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.

5 participants