-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maintain 3 separate HPD caches for the HPRT experiment
Hash-prefix real-time checks and URL real-time checks can both fall back to the hash-prefix database check (HPD). As such, we don't want the different mechanisms to share the same HPD cache, to avoid one mechanism benefitting from cached results of another mechanism's lookup. The two backgrounded mechanisms (hash real-time and hash database lookups) each have their own HPD cache within V4GetHashProtocolManager. URL real-time lookups use the primary cache as normal, since the experiment is performed by intercepting URL real-time lookups. Within the context of the experiment, reads and writes are performed on the specific mechanism's HPD cache. Outside the context of the experiment, reads are performed only on the primary cache. Writes are performed on all 3 of the caches. This is because many cache updates are outside the scope of the experiment (e.g. non-mainframe URLs, checks to non-browsing threat types), but the backgrounded mechanisms should be allowed to reuse these results if they happen to match, since that's how it would work if that mechanism were the default mechanism being used. We only want to maintain the separate caches if the experiment might run for the user (they are an ESB user and the feature flag is enabled). As an approximation to keep the code simple, we start maintaining separate caches any time there is a lookup performed where these criteria are matched. The edge cases this misses (e.g. a user enables ESB) are rare enough that the approximation will have a negligible impact on the results. Implementation details: - V4GetHashProtocolManager has most of the changes. It holds the 3 caches and owns the read/write logic for them. It also has the property is_lookup_mechanism_experiment_enabled_ that determines whether it should maintain 3 caches instead of just one. - A MechanismExperimentHashDatabaseCache enum value is threaded through from consumers to V4GetHashProtocolManager to specify which caches should be used for reads/writes. Within the experiment, this says to read/write to the specific mechanism's cache. Outside the experiment, this specifies to read only from the primary cache and write to all 3 caches. - If the experiment should be enabled, at the start of a lookup, SafeBrowsingUrlCheckerImpl kicks off a chain of SetLookupMechanismExperimentIsEnabled calls that eventually set is_lookup_mechanism_experiment_enabled_ to true in V4GetHashProtocolManager. Bug: 1392144 Change-Id: Ic7aaa65d990003e6aff2420a03f125496b0d4217 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4203687 Commit-Queue: thefrog <thefrog@chromium.org> Reviewed-by: Xinghui Lu <xinghuilu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1100477}
- Loading branch information
thefrog
authored and
Chromium LUCI CQ
committed
Feb 2, 2023
1 parent
2b91d47
commit ee2a607
Showing
33 changed files
with
592 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.