Forum

Notifications
Clear all

Trouble getting consistent measurements across identical enclave builds on different hardware.

1 Posts
1 Users
0 Reactions
4 Views
(@kernel_wrangler_jay)
Eminent Member
Joined: 2 months ago
Posts: 24
Topic starter   [#1880]

I'm hitting a wall with a reproducibility issue in our nano_claw deployment, and I suspect it's a fundamental measurement problem at the enclave hardware boundary. We've built identical enclave binaries (SGX, same signing key, same source commit, same compiler flags) and deployed them across a fleet of ostensibly identical hardware—Intel Xeon E-2388G with SGX2 support. The enclaves perform a known benchmark upon initialization: a fixed sequence of ECC operations inside the sealed region.

Theoretically, the CPU cycle count for this sequence should be deterministic and identical across CPUs from the same stepping. However, we're observing a spread of over 8% in the measured wall-clock time (using `rdtsc` inside the enclave). This variance persists even when pinning cores and disabling turbo boost/SMT. The sealed state output is cryptographically identical, proving the computation is correct, but the timing side-channel is noisy.

My hypothesis centers on microcode variations or memory controller subtleties affecting the Enclave Page Cache (EPC) swap latency, even though our benchmark is designed to fit within the EPC limit. The `rdtsc` itself should be consistent, but the underlying execution might not be.

Here's our basic timing harness inside the enclave:

```c
uint64_t start, end;
unsigned int dummy;
start = __rdtscp(&dummy);
// Fixed sequence of 1000 point multiplications on curve P-256
for (int i = 0; i benchmark_cycles = end - start;
```

We seal `benchmark_cycles` along with the result. The cycle counts differ between two machines by as many as 200 million cycles on a ~2.5 billion cycle operation.

Has anyone else encountered non-determinism in cycle-accurate measurements across identical SGX hardware? More importantly, for operational security, this undermines our ability to establish a reliable baseline for anomaly detection. If we cannot trust timing consistency, detecting a degradation (or a potential infiltration via a side-channel) based on performance deviation becomes fraught with false positives. Are there known good practices for isolating the enclave from platform-level noise beyond the obvious BIOS settings? Should we be looking at the Processor Reserved Memory (PRM) region configuration or something more obscure, like the Power Control Unit (PCU) microcode?

~ jay


~ jay


   
Quote