-
Notifications
You must be signed in to change notification settings - Fork 912
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 register type race #14897
fix register type race #14897
Conversation
Including assert to prevent future accidents and detect more instances of current abuse.
Pull Request Test Coverage Report for Build 12082288051Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that reportBasicTypes()
is only used by unit tests, reportOtherTypes()
is no longer used after this PR, so I think they could be removed in favor of always calling reportAllTypes()
. Once this is done I don't think anyone should call ::report()
directly (the remote backend unit tests currently do, but it looks like it could call reportAllTypes() instead
), so perhaps it would make sense to disallow that (for example by making it take a required parameter to a const-reference to an opaque object, that can only be constructed by reportAllTypes()
). This way we can call DNSRecordContent::lock()
from reportAllTypes()
directly, preventing a mistake later where we call reportAllTypes()
without calling lock()
.
Does that make sense to you? If so I can look into it if you want me to.
I pushed a commit implementing my proposal, please let me know if it looks good to you. |
I'm mostly happy with this. One remark: we tend to move to |
Sure! |
pdns/dnsrecords.hh
Outdated
{ \ | ||
unregist(1, QType::RNAME); \ | ||
unregist(254, QType::RNAME); \ | ||
(void)guard; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to change this one as well for consistency.
Short description
Actually seen in recursor, but auth could also have it in theory.
The issue is that you cannot call type register functions while the rest of the threads are doing their work. The actual fix is in
reczones.cc
, but also guard against this happening in other places (for both rec and auth), and while there remove the unusedunregist
function.Checklist
I have: