-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix heap-use-after-free race condition in dwb_plugins::KinematicsHandler #5707
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
base: foxy-devel
Are you sure you want to change the base?
Fix heap-use-after-free race condition in dwb_plugins::KinematicsHandler #5707
Conversation
|
@suifengersan123, all pull requests must be targeted towards the |
|
Can you fix this without modifying the use of atomics to the shared pointer? I don't like this solution since I imagine the atomics were designed that way for a reason. How about an atomic to a shared pointer and/or setting the pointer value to nullptr so that where the free after use is occurring can check if the pointer is nullptr before use. Also, is this an issue still in the |
|
I think what you said makes perfect sense, so before using it, I will check if it is nullptr and have removed the shared pointer. And I also noticed that the main branch has the same issue since I saw that their code logic is exactly the same.Below is the new commit.> 445386f |
nav2_dwb_controller/dwb_plugins/include/dwb_plugins/kinematic_parameters.hpp
Outdated
Show resolved
Hide resolved
|
@suifengersan123 two items
With that, I can merge this + the |
|
Thank you for your patient response. I have tested it in the foxy version and it can solve this problem. Moreover, I have already submitted a PR(#5720) in the main branch. |
|
Please revert all changes other than the ones related to the dwb_plugins. Open a separate PR for each issue you have a Ticket open for and link that ticket to the PR. Please keep things separated for good workflow :-) |
nav2_amcl/src/amcl_node.cpp
Outdated
| if(resample_interval_ == 0){ | ||
| RCLCPP_WARN( | ||
| get_logger(), "You've set resample_interval to be zero," | ||
| " this isn't allowed so it will be set to default value to 1."); | ||
| resample_interval_ = 1; | ||
| } |
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.
Definite linting issues in this PR as well
| { | ||
| Costmap2D * master = layered_costmap_->getCostmap(); | ||
| if (!master) { | ||
| RCLCPP_WARN( |
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.
Ditto
nav2_costmap_2d/src/costmap_2d.cpp
Outdated
| } | ||
| } | ||
| return true; | ||
| return cells_written; |
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.
Ditto
nav2_costmap_2d/src/costmap_2d.cpp
Outdated
| unsigned int index = getIndex(polygon_cells[i].x, polygon_cells[i].y); | ||
| costmap_[index] = cost_value; | ||
| if (index < size_x_ * size_y_) { | ||
| costmap_[index] = cost_value; |
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.
Ditto
| void initialize(const nav2_util::LifecycleNode::SharedPtr & nh, const std::string & plugin_name); | ||
|
|
||
| inline KinematicParameters getKinematics() {return *kinematics_.load();} | ||
| inline KinematicParameters getKinematics() { |
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.
Ditto
9bf6018 to
53ca1ab
Compare
Signed-off-by: suifengersan123 <[email protected]>
Signed-off-by: suifengersan123 <[email protected]>
…shared pointer Signed-off-by: suifengersan123 <[email protected]>
Signed-off-by: suifengersan123 <[email protected]>
Signed-off-by: suifengersan123 <[email protected]>
Signed-off-by: suifengersan123 <[email protected]>
Signed-off-by: suifengersan123 <[email protected]>
Signed-off-by: suifengersan123 <[email protected]>
Signed-off-by: suifengersan123 <[email protected]>
6dac7d7 to
6cf29ac
Compare
|
I removed the other changes, fixed the linting errors, and then made the commit. Please check if there are any other issues when you have time. |
Basic Info
Description of contribution in a few bullet points
Technical details:
Description of documentation updates required from your changes
Description of how this change was tested
AddressSanitizer validation: Compiled with -fsanitize=address and verified no heap-use-after-free errors occur
For Maintainers:
backport-*.