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

This PR fixes a few problems reported by Clang's Undefined Behavior sanitizer #2139

Merged
merged 11 commits into from May 4, 2016

Conversation

sithhell
Copy link
Member

@sithhell sithhell commented May 2, 2016

The problems included:

  • Fixing typed_continuation problems when the action return type is a future:
    Removed special handling of typed_continuation<([shared_]future> and
    replaced it with free function handling of future return types.
  • Explicitly initialize ignore_all_locks_ member to false
  • Fixing a problem with packaged_action return type:
    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.
  • Fixing problem with actions returning void:
    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
  • Fixing UB in promise AGAS memory management.

ltroska and others added 5 commits May 2, 2016 09:02
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.
@sithhell sithhell added this to the 0.9.12 milestone May 2, 2016
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,
Copy link
Member

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>.

Copy link
Member Author

@sithhell sithhell May 2, 2016 via email

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.
@sithhell sithhell force-pushed the ubsan branch 3 times, most recently from 749aa9d to c5b4798 Compare May 3, 2016 19:55
@sithhell
Copy link
Member Author

sithhell commented May 3, 2016

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);
Copy link
Member

@hkaiser hkaiser May 3, 2016

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.

@hkaiser hkaiser merged commit 933db14 into master May 4, 2016
@hkaiser hkaiser deleted the ubsan branch May 4, 2016 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants