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

Fix another segfault in the partition deletion logic #1809

Merged
merged 5 commits into from
Jul 29, 2021

Conversation

tobim
Copy link
Member

@tobim tobim commented Jul 29, 2021

📔 Description

This time the index forgot to check the validity of a requested partition chunk. The relevant error handling below was also slightly modified to log the cause of failed mmap(2)s and prevent similar problems in the future.

📝 Checklist

  • All user-facing changes have changelog entries.
  • The PR description contains instructions for the reviewer, if necessary.

🎯 Review Instructions

By commit.

@tobim tobim added the bug Incorrect behavior label Jul 29, 2021
@tobim tobim requested a review from lava July 29, 2021 13:51
Copy link
Member

@lava lava left a comment

Choose a reason for hiding this comment

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

The fix looks correct; a unit test might have been nice but also annoying to write this since ultimately requires a system error to trigger and results in a segfault which isn't really testable so our testbed testing should suffice.

libvast/src/chunk.cpp Outdated Show resolved Hide resolved
@JoeLoser
Copy link
Contributor

The fix looks correct; a unit test might have been nice but also annoying to write this since ultimately requires a system error to trigger and results in a segfault which isn't really testable so our testbed testing should suffice.

I'd like to see a unit test too. Perhaps we need to build out some testing infrastructure to be able to fake out the mmap call and have it return an error so we can test this code. I'm OK with that coming as a follow-up after this release though given the timing of things.

@tobim
Copy link
Member Author

tobim commented Jul 29, 2021

The fix looks correct; a unit test might have been nice but also annoying to write this since ultimately requires a system error to trigger and results in a segfault which isn't really testable so our testbed testing should suffice.

I'd like to see a unit test too. Perhaps we need to build out some testing infrastructure to be able to fake out the mmap call and have it return an error so we can test this code. I'm OK with that coming as a follow-up after this release though given the timing of things.

I think it shouldn't actually be that hard, we can just mock the filesystem, but we'll have to delay that until after the release.

The erase handler in the index failed to check that the chunk that
is returned from the filesystem is actually valid. In case it wasn't,
the subsequent deref lead to a segfault.
The posix filesystem used to convert mmap failures to invalid chunks.
This seems like a bad idea.
@tobim tobim merged commit 0071eaf into master Jul 29, 2021
@tobim tobim deleted the topic/check-mmap-result branch July 29, 2021 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants