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

rec: Delay the loading of RPZ zones until the parsing is done, fix race #6588

Merged
merged 2 commits into from May 16, 2018

Conversation

Projects
None yet
2 participants
@rgacogne
Member

rgacogne commented May 9, 2018

Short description

This PR fixes two issues in our RPZ loading code introduced in #6237:

  • the RPZ thread was modifying the zone shared with all of the other threads during the first AXFR, triggering a race condition that could have lead to crashes ;
  • the RPZ thread was started during the parsing of the Lua configuration, and was immediately modifying its RPZ zone. The first AXFR was altering the shared zone and the following IXFRs were updating the configuration with a new copy of the zone, as they should. However if one IXFR finished before the Lua parsing was finished, for example because we were loading a huge RPZ file from the disk, the new zone would have been overridden by an empty one at the end of the parsing. We now delay the creation of the RPZ threads, and therefore the AXFR and IXFR, until the end of the parsing.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

pieterlexis and others added some commits May 8, 2018

rec: Delay RPZ threads creation until the Lua config has been parsed
Otherwise if the parsing of the remaining Lua directives takes longer
than the AXFR, our zone content will be replaced by an empty zone
once the parsing finishes.

@rgacogne rgacogne added this to the rec-4.2.0 milestone May 9, 2018

@rgacogne rgacogne requested review from pieterlexis and chbruyand May 9, 2018

@pieterlexis

👍

rgacogne added a commit to rgacogne/pdns that referenced this pull request May 16, 2018

rgacogne added a commit that referenced this pull request May 16, 2018

@rgacogne rgacogne merged commit ec93ce4 into PowerDNS:master May 16, 2018

4 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
lgtm analysis: C/C++ No alert changes
Details
lgtm analysis: JavaScript No alert changes
Details
lgtm analysis: Python No alert changes
Details

@rgacogne rgacogne deleted the rgacogne:rec-safe-load-rpz branch May 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment