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
This PR fixes a few problems reported by Clang's Undefined Behavior sanitizer #2139
Conversation
Instead of reinterpret_casting to an possibly unrelated promise_base, this patch uses the common base_lco base for the managed_promise shim.
the promise is allocated as promise<void>, however the continuation tried to trigger a promise<unused_type>, this triggers UB and has been fixed in this patch. Flyby: Some cleanup of basic_action.hpp and continuation.hpp
This patch fixes a problem when the result type specified for packaged_action does not match the action's local result type. This led to the continuation calling the set_value_nonvirt function on an object of wrong type.
struct sync_invoke | ||
{ | ||
template <typename IdOrPolicy, typename ...Ts> | ||
HPX_FORCEINLINE static LocalResult call( | ||
HPX_FORCEINLINE static local_result_type call( | ||
boost::mpl::false_, launch policy, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might have been a good idea to replace boost::mpl::true_/false_
here as well - all the rest of the file has been switched to <type_traits>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…uture Removed special handling of typed_continuation<([shared_]future<R>> and replaced it with free function handling of future return types.
749aa9d
to
c5b4798
Compare
All comments have been addressed now. This PR lets the HPX unit and regression tests run with UBsan without failure. |
Component::heap_type::free(cv, 1); | ||
return naming::invalid_gid; | ||
} | ||
Component *c = static_cast<Component *>(cv); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is throwing an exception if creation goes wrong. I don't think we should silently return invalid_gid in case of an error in the constructor.
Flyby: replaced all actions::extract_action with traits::extract_action
The problems included:
Removed special handling of typed_continuation<([shared_]future> and
replaced it with free function handling of future return types.
This patch fixes a problem when the result type specified for packaged_action
does not match the action's local result type. This led to the continuation
calling the set_value_nonvirt function on an object of wrong type.
the promise is allocated as promise, however the continuation
tried to trigger a promise<unused_type>, this triggers UB and has
been fixed in this patch.
Flyby: Some cleanup of basic_action.hpp and continuation.hpp