  Emerging non-volatile main memory (NVMM) is rapidly being integrated into
computer systems. However, NVMM is vulnerable to potential data remanence and
replay attacks.
  Established security models including split counter mode encryption and
Bonsai Merkle tree (BMT) authentication have been introduced against such data
integrity attacks. However, these security methods are not readily compatible
with NVMM. Recent works on secure NVMM pointed out the need for data and its
metadata, including the counter, the message authentication code (MAC), and the
BMT to be persisted atomically. However, memory persistency models have been
overlooked for secure NVMM, which is essential for crash recoverability.
  In this work, we analyze the invariants that need to be ensured in order to
support crash recovery for secure NVMM. We highlight that prior research has
substantially under-estimated the cost of BMT persistence and propose several
optimization techniques to reduce the overhead of atomically persisting updates
to BMTs. The optimizations proposed explore the use of pipelining, out-of-order
writes, and update coalescing while conforming to strict or epoch persistency
models respectively. We evaluate our work and show that our proposed
optimizations significantly reduce the performance overhead of secure NVMM with
crash recoverability.
