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

[16360] Protect from uncaught exception during SHM Segment creation. #3293

Merged
merged 7 commits into from
Feb 24, 2023

Conversation

jsan-rt
Copy link
Contributor

@jsan-rt jsan-rt commented Feb 13, 2023

This PR adds protection for possible boost::interprocess::interprocess_exception that may be thrown during the execution of SharedMemSegment::compute_per_allocation_extra_size

Description

@Mergifyio backport 2.9.x 2.8.x 2.6.x

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • [N/A] Any new/modified methods have been properly documented using Doxygen.
  • Changes are ABI compatible.
  • Changes are API compatible.
  • [N/A] Documentation builds and tests pass locally.
  • [N/A] New feature has been added to the versions.md file (if applicable).
  • [N/A] New feature has been documented/Current behavior is correctly described in the documentation.
  • Applicable backports have been included in the description.

Reviewer Checklist

  • Check contributor checklist is correct.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

jsan-rt and others added 3 commits February 13, 2023 14:17
Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
…rows

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>
Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

The Regression Test and the fix work as expected. Just a couple of minor comments

src/cpp/rtps/transport/shared_mem/SharedMemManager.hpp Outdated Show resolved Hide resolved
test/unittest/rtps/DataSharing/CMakeLists.txt Outdated Show resolved Hide resolved
Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
Mario-DL
Mario-DL previously approved these changes Feb 15, 2023
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
Mario-DL
Mario-DL previously approved these changes Feb 15, 2023
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

LGTM with green CI

@Mario-DL Mario-DL added ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. and removed ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. labels Feb 15, 2023
@Mario-DL
Copy link
Member

@richiprosima please test this

@Mario-DL Mario-DL added the ci-pending PR which CI is running label Feb 15, 2023
Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
@Mario-DL
Copy link
Member

Mario-DL commented Feb 15, 2023

@richiprosima please test uncrustify

@Mario-DL
Copy link
Member

@richiprosima please test windows

2 similar comments
@Mario-DL
Copy link
Member

@richiprosima please test windows

@jsan-rt
Copy link
Contributor Author

jsan-rt commented Feb 16, 2023

@richiprosima please test windows

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
@jsan-rt jsan-rt force-pushed the bugfix/catch_permission_denied_datasharing branch from de1cd4d to 2fba8e4 Compare February 20, 2023 08:40
@jsan-rt
Copy link
Contributor Author

jsan-rt commented Feb 20, 2023

@richiprosima Please test windows

@jsan-rt jsan-rt removed the ci-pending PR which CI is running label Feb 20, 2023
Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

LGTM with green CI

@jsan-rt jsan-rt added the ci-pending PR which CI is running label Feb 20, 2023
@jsan-rt
Copy link
Contributor Author

jsan-rt commented Feb 20, 2023

@richiprosima please test linux

@jsan-rt
Copy link
Contributor Author

jsan-rt commented Feb 20, 2023

@richiprosima please test mac

Copy link
Member

@Mario-DL Mario-DL left a comment

Choose a reason for hiding this comment

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

LGTM

@Mario-DL Mario-DL added ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. and removed ci-pending PR which CI is running labels Feb 21, 2023
@EduPonz
Copy link

EduPonz commented Feb 21, 2023

@richiprosima please test mac discovery-server

@EduPonz
Copy link

EduPonz commented Feb 21, 2023

@richiprosima please discovery-server

@EduPonz
Copy link

EduPonz commented Feb 21, 2023

@richiprosima please test discovery-server

@EduPonz EduPonz added ci-pending PR which CI is running and removed ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. labels Feb 21, 2023
@Mario-DL Mario-DL added ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. and removed ci-pending PR which CI is running labels Feb 23, 2023
@MiguelCompany MiguelCompany merged commit 72d1ba1 into master Feb 24, 2023
@MiguelCompany MiguelCompany deleted the bugfix/catch_permission_denied_datasharing branch February 24, 2023 06:41
@jsan-rt
Copy link
Contributor Author

jsan-rt commented Feb 28, 2023

@Mergifyio backport 2.9.x 2.8.x 2.6.x

@mergify
Copy link
Contributor

mergify bot commented Feb 28, 2023

mergify bot pushed a commit that referenced this pull request Feb 28, 2023
* Added regression test

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fix Segfault when SharedSegment::compute_per_allocation_extra_size throws

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>

* Refs #16360: Added comments and remove some unneeded code

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Applied suggestions

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Uncrustify

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fixed Windows warnings

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Added NOMINMAX flag to test

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

---------

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>
Co-authored-by: Eduardo Ponz <eduardoponz@eprosima.com>
(cherry picked from commit 72d1ba1)
mergify bot pushed a commit that referenced this pull request Feb 28, 2023
* Added regression test

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fix Segfault when SharedSegment::compute_per_allocation_extra_size throws

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>

* Refs #16360: Added comments and remove some unneeded code

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Applied suggestions

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Uncrustify

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fixed Windows warnings

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Added NOMINMAX flag to test

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

---------

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>
Co-authored-by: Eduardo Ponz <eduardoponz@eprosima.com>
(cherry picked from commit 72d1ba1)

# Conflicts:
#	src/cpp/rtps/DataSharing/WriterPool.hpp
mergify bot pushed a commit that referenced this pull request Feb 28, 2023
* Added regression test

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fix Segfault when SharedSegment::compute_per_allocation_extra_size throws

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>

* Refs #16360: Added comments and remove some unneeded code

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Applied suggestions

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Uncrustify

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fixed Windows warnings

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Added NOMINMAX flag to test

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

---------

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>
Co-authored-by: Eduardo Ponz <eduardoponz@eprosima.com>
(cherry picked from commit 72d1ba1)

# Conflicts:
#	src/cpp/rtps/DataSharing/WriterPool.hpp
MiguelCompany pushed a commit that referenced this pull request Mar 24, 2023
* Protect from uncaught exception during SHM Segment creation (#3293)

* Added regression test

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fix Segfault when SharedSegment::compute_per_allocation_extra_size throws

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>

* Refs #16360: Added comments and remove some unneeded code

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Applied suggestions

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Uncrustify

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fixed Windows warnings

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Added NOMINMAX flag to test

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

---------

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>
Co-authored-by: Eduardo Ponz <eduardoponz@eprosima.com>
(cherry picked from commit 72d1ba1)

# Conflicts:
#	src/cpp/rtps/DataSharing/WriterPool.hpp

* Fixed conflicts

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Removed incompatible changes

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

---------

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
Co-authored-by: jsantiago-eProsima <90755661+jsantiago-eProsima@users.noreply.github.com>
Co-authored-by: Javier Santiago <javiersantiago@eprosima.com>
JLBuenoLopez pushed a commit that referenced this pull request Jun 13, 2023
…#3293) (#3333)

* Protect from uncaught exception during SHM Segment creation (#3293)

* Added regression test

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fix Segfault when SharedSegment::compute_per_allocation_extra_size throws

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>

* Refs #16360: Added comments and remove some unneeded code

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Applied suggestions

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Uncrustify

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fixed Windows warnings

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Added NOMINMAX flag to test

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

---------

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>
Co-authored-by: Eduardo Ponz <eduardoponz@eprosima.com>
(cherry picked from commit 72d1ba1)

# Conflicts:
#	src/cpp/rtps/DataSharing/WriterPool.hpp

* Fixed conflicts

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fixed log macro name

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fixed log macro name

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Refs #16360: Please uncrustify

Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>

* Modified SharedMemSegment mock to be in line with 2.6.x version of the same class

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

---------

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>
Co-authored-by: jsantiago-eProsima <90755661+jsantiago-eProsima@users.noreply.github.com>
Co-authored-by: Javier Santiago <javiersantiago@eprosima.com>
Co-authored-by: JesusPoderoso <jesuspoderoso@eprosima.com>
juanlofer-eprosima pushed a commit that referenced this pull request Nov 10, 2023
* Added regression test

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fix Segfault when SharedSegment::compute_per_allocation_extra_size throws

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>

* Refs #16360: Added comments and remove some unneeded code

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Applied suggestions

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Uncrustify

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Fixed Windows warnings

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Added NOMINMAX flag to test

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

---------

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>
Co-authored-by: Eduardo Ponz <eduardoponz@eprosima.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Ready to be merged. CI and changes have been reviewed and approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants