Skip to content

param: Move alias resolution before protected check #4324

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

Merged
merged 3 commits into from
May 15, 2025

Conversation

dridi
Copy link
Member

@dridi dridi commented May 2, 2025

param: Move alias resolution before protected check

Instead of resolving tweaks when the function is called, this is now
done in the MGT code performing the protected check. Since aliases may
be used to reset a single bit of another parameter (namely vcc_feature)
the default value is looked up before the alias resolution.

Unfortunately, that also means resolving deprecated aliases before
showing them to the user, adding a little bit of duplicated logic.

Refs #4323

@dridi
Copy link
Member Author

dridi commented May 5, 2025

bugwash: OK, waiting for @nigoroll's review.


orig = TRUST_ME(pp->priv);
AN(orig);
memcpy(alias, orig, sizeof *orig);
Copy link
Member

Choose a reason for hiding this comment

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

nitpick sizeof *alias as a "I know my buffer overflows" style checkbox?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair enough, I will change the sizeof operand.

Should we have a COPY_OBJ(dest, src, magic) macro with actual type checking?

@nigoroll
Copy link
Member

FTR, flexelint is happy with the tree as of f26f3f7 except for arg_xyzzy_debug_argtest which I had looked after in the meantime (unrelated).

Reminder: Be aware of SQUASHMEs

@dridi dridi force-pushed the param_alias_protected branch from f26f3f7 to 0e7e1ea Compare May 15, 2025 15:52
dridi added 3 commits May 15, 2025 17:53
Instead of resolving tweaks when the function is called, this is now
done in the MGT code performing the protected check. Since aliases may
be used to reset a single bit of another parameter (namely vcc_feature)
the default value is looked up before the alias resolution.

Unfortunately, that also means resolving deprecated aliases before
showing them to the user, adding a little bit of duplicated logic.

Refs varnishcache#4323
The alternative could have been to mark both aliases and their original
parameters as protected but there isn't always a one-to-one mapping
between deprecated aliases and the parameters they point to.

The old vcc_* boolean parameters turned into vcc_feature flags.

Refs varnishcache#4323
@dridi dridi force-pushed the param_alias_protected branch from 0e7e1ea to d2b090b Compare May 15, 2025 15:53
@dridi dridi merged commit d7147ce into varnishcache:master May 15, 2025
9 of 10 checks passed
@dridi dridi deleted the param_alias_protected branch May 15, 2025 16:21
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