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

Cherry-pick #8027 to 6.x: Fix data race and deadlock in file_integrity module #8169

Merged
merged 2 commits into from
Sep 5, 2018

Conversation

cwurm
Copy link
Contributor

@cwurm cwurm commented Aug 30, 2018

Cherry-pick of PR #8027 to 6.x branch. Original message:

This PR fixes two issues with auditbeat's file_integrity module:

  • Concurrent map write in [Auditbeat] TestIncludedExcludedFiles fails with race condition #8009
    Auditbeat's file_integrity module had a data race in its recursive watcher implementation for Linux. Was caused by file watches being installed from different goroutines.
    This patch fixes the problem by moving watch installation to the same goroutine that processes inotify's events, guaranteeing that watches are installed in order, which is necessary for consistence.

  • deadlock when file integrity monitor is started
    A deadlock is possible in auditbeat's file_integrity module under Windows: When enough events arrive while watches are being installed, the event channel can fill causing the installation of a watch to block. This patch makes sure that events are received while watches are being installed, and at the same time ensures that no event is lost.

@cwurm
Copy link
Contributor Author

cwurm commented Aug 30, 2018

Backport to hopefully fix test failure #7731 which is also occurring on 6.x (#8087 (comment)).

Auditbeat's file_integrity module had a data race in its recursive
watcher implementation for Linux. Was caused by file watches being
installed from different goroutines.

This patch fixes the problem by moving watch installation to the same
goroutine that processes inotify's events, guaranteeing that watches
are installed in order, which is necessary for consistence.

Fixes elastic#8009

(cherry picked from commit 698cf9c)
A deadlock is possible in auditbeat's file_integrity module under
Windows: When enough events arrive while watches are being installed,
the event channel can fill causing the installation of a watch to
block.

This patch makes sure that events are received while watches are being
installed, and at the same time ensures that no event is lost.

(cherry picked from commit 51267b4)
@cwurm cwurm merged commit 60b6540 into elastic:6.x Sep 5, 2018
@cwurm cwurm deleted the backport_8027_6.x branch September 19, 2018 08:37
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.

2 participants