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

Use passed in neg and key cache if non-NULL. #135

Merged
merged 1 commit into from Jan 6, 2020

Conversation

fobser
Copy link
Contributor

@fobser fobser commented Dec 19, 2019

With this the neg and key caches can be shared between multiple
libunbound contexts.

The msg and rrset caches already allowed this since context_finalize()
did not touch those if they are already available and have the correct
size.

Care must be taken to properly unhook the caches from the validator
environment before calling ub_ctx_delete() otherwise one risks double
free or use after free bugs.

With this the neg and key caches can be shared between multiple
libunbound contexts.

The msg and rrset caches already allowed this since context_finalize()
did not touch those if they are already available and have the correct
size.

Care must be taken to properly unhook the caches from the validator
environment before calling ub_ctx_delete() otherwise one risks double
free or use after free bugs.
Copy link
Member

@wcawijngaards wcawijngaards left a comment

Looks harmless for normal code and libunbound. Not too easy to use for libunbound users, you have to create and delete and then set to NULL (as you describe) the entry, and also NULL the entry in the val_env before deleting to avoid double-free.

@wcawijngaards
Copy link
Member

@wcawijngaards wcawijngaards commented Jan 6, 2020

So I'm fine with it, if it helps unwind. Probably not something I could easily describe for how libunbound users could make use of it.

Thank you for the contribution!

Best regards, Wouter

@wcawijngaards wcawijngaards merged commit d982dff into NLnetLabs:master Jan 6, 2020
1 check passed
wcawijngaards added a commit that referenced this issue Jan 6, 2020
- Merge #135 from Florian Obser: Use passed in neg and key cache
  if non-NULL.
@fobser fobser deleted the pass-in-neg-key-cache branch Jan 10, 2020
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

2 participants