Skip to content

Commit 42e97a6

Browse files
committed
counters: slightly expand the documentation.
1 parent 349183e commit 42e97a6

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

measureme/src/counters.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,16 @@
4848
//! * if I/O can be isolated to separate profiling events, and doesn't impact
4949
//! execution in a more subtle way (see below), the deterministic parts of
5050
//! the program can still be profiled with high accuracy
51-
//! * low-level non-determinism (e.g. ASLR, randomized `HashMap`s, thread scheduling)
51+
//! * intentional uses of randomness may change execution paths, though for
52+
//! cryptographic operations specifically, "constant time" implementations
53+
//! are preferred / necessary (in order to limit an external observer's
54+
//! ability to infer secrets), so they're not as much of a problem
55+
//! * even otherwise-deterministic machine-local communication (to e.g. system
56+
//! services or drivers) can behave unpredictably (especially under load)
57+
//! * while we haven't observed this in the wild yet, it's possible for
58+
//! file reads/writes to be split up into multiple smaller chunks
59+
//! (and therefore take more userspace instructions to fully read/write)
60+
//! * low-level non-determinism (e.g. ASLR, randomized `HashMap`s, timers)
5261
//! * ASLR ("Address Space Layout Randomization"), may be provided by the OS for
5362
//! security reasons, or accidentally caused through allocations that depend on
5463
//! random data (even as low-entropy as e.g. the base 10 length of a process ID)
@@ -65,9 +74,17 @@
6574
//! ASLR and ASLR-like effects, making the entire program more sensitive
6675
//! * the default hasher is randomized, and while `rustc` doesn't use it,
6776
//! proc macros can (and will), and it's harder to disable than Linux ASLR
68-
//! * `jemalloc` (the allocator used by `rustc`, at least in official releases)
69-
//! has a 10 second "purge timer", which can introduce an ASLR-like effect,
70-
//! unless disabled with `MALLOC_CONF=dirty_decay_ms:0,muzzy_decay_ms:0`
77+
//! * most ways of measuring time will inherently never perfectly align with
78+
//! exact points in the program's execution, making time behave like another
79+
//! low-entropy source of randomness - this also means timers will elapse at
80+
//! unpredictable points (which can further impact the rest of the execution)
81+
//! * this includes the common thread scheduler technique of preempting the
82+
//! currently executing thread with a periodic timer interrupt, so the exact
83+
//! interleaving of multiple threads will likely not be reproducible without
84+
//! special OS configuration, or tools that emulate a deterministic scheduler
85+
//! * `jemalloc` (the allocator used by `rustc`, at least in official releases)
86+
//! has a 10 second "purge timer", which can introduce an ASLR-like effect,
87+
//! unless disabled with `MALLOC_CONF=dirty_decay_ms:0,muzzy_decay_ms:0`
7188
//! * hardware flaws (whether in the design or implementation)
7289
//! * hardware interrupts ("IRQs") and exceptions (like page faults) cause
7390
//! overcounting (1 instruction per interrupt, possibly the `iret` from the

0 commit comments

Comments
 (0)