  Hardware caches are essential performance optimization features in modern
processors to reduce the effective memory access time. Unfortunately, they are
also the prime targets for attacks on computer processors because they are
high-bandwidth and reliable side or covert channels for leaking secrets.
Conventional cache timing attacks typically leak secret encryption keys, while
recent speculative execution attacks typically leak arbitrary
illegally-obtained secrets through cache timing channels. While many hardware
defenses have been proposed for each class of attacks, we show that those for
conventional (non-speculative) cache timing channels do not work for all
speculative execution attacks, and vice versa. We maintain that a cache is not
secure unless it can defend against both of these major attack classes.
  We propose a new methodology and framework for covering such relatively large
attack surfaces to produce a Speculative and Timing Attack Resilient (STAR)
cache subsystem. We use this to design two comprehensive secure cache
architectures, STAR-FARR and STAR-NEWS, that have very low performance
overheads of 5.6% and 6.8%, respectively. To the best of our knowledge, these
are the first secure cache designs that cover both non-speculative cache side
channels and cache-based speculative execution attacks.
  Our methodology can be used to compose and check other secure cache designs.
It can also be extended to other attack classes and hardware systems.
Additionally, we also highlight the intrinsic security and performance benefits
of a randomized cache like a real Fully Associative cache with Random
Replacement (FARR) and a lower-latency, speculation-aware version (NEWS).
