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

Check if another forked child has already added the vhost. #581

Merged
merged 4 commits into from
Aug 20, 2020

Conversation

jjnicola
Copy link
Member

@jjnicola jjnicola commented Aug 19, 2020

In some cases, in which expand_vhosts and test_empty_vhost options
are enabled, a plugin process fork()s one child for vhost.
These children inherit the current state of vhosts list, but it does not
check if the concurrent child plugin has already added a new found vhost.
Now, it checks not only if the vhost has been added by another plugin before
(and already exists in the vhosts list), but also checks if a concurrent child
added to the internal/vhosts key in redis.

@jjnicola jjnicola force-pushed the vhosts branch 3 times, most recently from 4ee5412 to 6f94084 Compare August 19, 2020 11:13
@jjnicola jjnicola marked this pull request as ready for review August 19, 2020 12:12
@jjnicola jjnicola requested a review from cfi-gb August 19, 2020 12:12
@jjnicola jjnicola changed the title Vhosts Check if another forked child has already added the a vhost. Aug 19, 2020
@jjnicola jjnicola changed the title Check if another forked child has already added the a vhost. Check if another forked child has already added the vhost. Aug 19, 2020
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@cfi-gb cfi-gb left a comment

Choose a reason for hiding this comment

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

Tested for regressions of this change with some larger scans. No additional problems found, scans are still working as expected.

I wasn't able to reproduce the initial problem though and can't judge on the code changes itself, a final approval is required by @greenbone/gvm-dev

In some cases, in which expand_vhosts and test_empty_vhost options
are enabled, a plugin process fork()s one child for vhost.
These children inherit the current state of vhosts list, but it does not
check if the concurrent child plugin has already added a new found vhost.
Now, it checks not only if the vhost has been added by another plugin before
(and already exists in the vhosts list), but also checks if a concurrent child
added to the internal/vhosts key in redis.
Like the previous commit, but this check is done at host process level,
It does not removes the appended vhosts from internal/vhosts key (get instead pop)
So, avoids race condition in which other plugins checks for adding the same vhosts,
and they have an outdated vhosts list.
@cfi-gb
Copy link
Member

cfi-gb commented Aug 20, 2020

Backport to the openvas-7.0 branch in #584

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants