Commit 1cf07359 authored by Sami Kyostila's avatar Sami Kyostila Committed by Commit Bot

Increase timer resolution

Now that site isolation is enabled on desktop platforms, we can safely
increase timer resolution back to the previous 5µs value. Clock edge
jittering is still enabled however.

Bug: 798795, 422000
Change-Id: I23f29a40a8615354674f33bae7339d348773dd00
Reviewed-on: https://chromium-review.googlesource.com/c/1290916Reviewed-by: default avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601536}
parent fc3195e2
......@@ -114,7 +114,13 @@ base::LazyInstance<EnabledStateObserverImpl>::Leaky g_trace_state_dispatcher =
// TODO(skyostil): Deduplicate this with the clamper in Blink.
class TimeClamper {
public:
static constexpr double kResolutionSeconds = 0.001;
// As site isolation is enabled on desktop platforms, we can safely provide
// more timing resolution. Jittering is still enabled everywhere.
#if defined(OS_ANDROID)
static constexpr double kResolutionSeconds = 100e-6;
#else
static constexpr double kResolutionSeconds = 5e-6;
#endif
TimeClamper() : secret_(base::RandUint64()) {}
......
......@@ -6,6 +6,7 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_TIMING_TIME_CLAMPER_H_
#include "base/macros.h"
#include "build/build_config.h"
#include "third_party/blink/renderer/core/core_export.h"
#include <stdint.h>
......@@ -14,11 +15,17 @@ namespace blink {
class CORE_EXPORT TimeClamper {
public:
static constexpr double kResolutionSeconds = 0.0001;
// As site isolation is enabled on desktop platforms, we can safely provide
// more timing resolution. Jittering is still enabled everywhere.
#if defined(OS_ANDROID)
static constexpr double kResolutionSeconds = 100e-6;
#else
static constexpr double kResolutionSeconds = 5e-6;
#endif
TimeClamper();
// Deterministically clamp the time value |time_seconds| to a 100us interval
// Deterministically clamp the time value |time_seconds| to a fixed interval
// to prevent timing attacks. See
// http://www.w3.org/TR/hr-time-2/#privacy-security.
//
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment