Search papers, labs, and topics across Lattice.
This paper investigates the practical differences between self-modifying code (SMC) and non-SMC code on modern processors, arguing that timing and self-introspective effects make faithful non-SMC reproduction of timed SMC detectably expensive. They introduce a tamper-proofing model combining introspective and polymorphic SMC with timing predicates to bind integrity checks to execution behavior. Through x86-64 design primitives and careful engineering techniques like loop unrolling and cross-page modification, the authors demonstrate reduced overhead for SMC while maintaining its tamper-detection capabilities.
Self-modifying code, long dismissed as theoretically equivalent to static code, offers a surprisingly practical path to tamper-proofing by exploiting the timing and microarchitectural nuances of modern processors.
Classical computability theory tells us that self-modifying code (SMC) on a deterministic universal Turing machine can be simulated by non-SMC code on the same model. That abstraction, however, omits the external timing inputs, concurrency, and microarchitectural state that dominate practical execution on modern processors. We argue that once timing, ordering, and self-introspective effects are treated as observables, a practically faithful non-SMC reproduction of timed SMC becomes detectably expensive on commodity systems. We present a tamper-proofing model that combines introspective and polymorphic SMC, reliable clocks, and runtime timing predicates to bind integrity checks to execution behavior. We distinguish static and dynamic SMC generation, characterize the timing semantics needed to avoid catastrophic pipeline clears, and give x86-64 design primitives for checksum-driven self-patching. We also report timer measurements, performance comparisons, and performance-monitoring counter evidence showing that careful engineering -- especially loop unrolling and cross-page modification -- substantially reduces the overhead of SMC while preserving its tamper-detection value. The paper concludes with an efficiency analysis, a threat model, and deployment guidance for trusted code executing in untrusted environments.