text
stringlengths
0
1.99k
Crucially, the Strict Recent Access Bias strategy is designed to use the
least number of watchpoints necessary to fully cover the guarded addresses
within the recently accessed page. In many cases, the result is one or
more spare watchpoints that can be reassigned when beneficial to reduce
the coverage footprint on other concurrently tracked pages. We limit such
reassignments to a single additional watchpoint per concurrent page, and
only when switching from OS-level page guarding to a single hardware
watchpoint results in a net reduction in page coverage size. This enables
isolated high-activity regions on multiple pages to benefit from tighter
watchpoint precision without increasing overall trap frequency. By
selectively refining coverage in this way, the system ensures that global
watchpoint resources are used efficiently to minimize unnecessary page
faults.
To better illustrate how the Strict Recent Access Bias strategy operates
in practice, consider the following example where the rootBitmap contains
active segments in both halves of the page, and one side includes the
recently accessed segment. Instead of distributing the watchpoint budget
evenly, the algorithm allocates a larger share of the budget (up to three
watchpoints) to the side containing the recent access, and reserves only
one watchpoint for the opposite half. This does not mean all watchpoints
are immediately used, but rather that more refinement and splitting is
permitted on the recent side if needed. The diagram below visualizes this
biased allocation at the root level.
[Root Level Split]
Page RootBitmap (32 bits)
[31..............................0]
00000001000000000000000111100001
^
Where recently accessed segment is at bit 20
.----------------------------+----------------------------.
| High Half [bits 16..31] | Low Half [bits 0..15] |
|----------------------------|----------------------------|
| 0000000100000000 | 0000000111100001 |
|----------------------------+----------------------------|
| Recently | Not-Recently |
| accessed side | accessed |
|----------------------------+----------------------------|
| Segment 24 active | Segments 0, 5-8 active |
|----------------------------+----------------------------|
| Watchpoint Budget Assignment |
|----------------------------+----------------------------|
| Up to 3 Watchpoints | Only 1 Watchpoint |
|----------------------------+----------------------------|
| Each half is refined recursively within its budget. |
| Biasing ensures that the recently accessed side gets |
| more splitting flexibility and tighter coverage, while |
| the opposite half is restricted to a single watchpoint |
| regardless of its internal density. |
'---------------------------------------------------------'
The previous example demonstrated how the strategy distributes budget
between two active halves, favoring the side containing the recently
accessed segment. However, Strict Recent Access Bias also gracefully
handles imbalanced cases where one half of the page contains no active
segments at all. In such scenarios, the full watchpoint budget is
reassigned to the active side, allowing for even more aggressive
refinement when necessary. The next example illustrates this behavior by
showing how all guarded addresses reside in the recently accessed half,
while the opposite half is entirely skipped. It also walks through the
segment-level refinement process, where budgeted splits are recursively
applied to produce the tightest possible coverage at the segment and qword
level. In particular, segment 7 is refined down to a single active qword,
where a minimal 8-byte watchpoint is emitted. We terminate the refinement
process at the qword level because, at this granularity, the ARM CPU
supports a byte-select mask that allows us to monitor only the specific
bytes of interest within the aligned 8-byte region.
[Root Level Split]
Page RootBitmap (32 bits)
[31..............................0]
00000000000000000000001010000000
^
Where recently accessed segment is at bit 7
.----------------------------+----------------------------.
| High Half [bits 16..31] | Low Half [bits 0..15] |
|----------------------------|----------------------------|
| 0000000000000000 | 0000001010000000 |
|----------------------------+----------------------------|
| No active segments | Segments 7 and 9 active |
|----------------------------+----------------------------|
| Skipped entirely | Recently accessed side |
|----------------------------+----------------------------|
| Watchpoint Budget Assignment |
|----------------------------+----------------------------|
| 0 Watchpoints | Up to 4 Watchpoints |
'----------------------------+--------------+-------------'
|
.--------------'
|
.----------------------------+----------------------------.
| High Half [bits 15..8] | Low Half [bits 0..7] |
|----------------------------|----------------------------|
| 00000010 | 10000000 |
|----------------------------+----------------------------|
| [not recently accessed] | [recently accessed] |
|----------------------------+----------------------------|