Method, system and storage medium for protecting cache from side channel attacks
By introducing an access permission mechanism into the cache hierarchy of the computer system, the problem that the cache hierarchy is vulnerable to side-channel attacks is solved, ensuring that only legitimate access can modify the cache status, enhancing cache security and preventing information leakage.
Patent Information
- Application Number
- CN201910164064.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-03-05
- Filing Date
- 2019-03-05
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2039-03-05
AI Technical Summary
In existing computer systems, cache hierarchies are vulnerable to side-channel attacks, such as Specter and Meltdown, which threaten cache security. In particular, unauthorized speculative execution may leak secret information.
By introducing an access permission mechanism into the cache system, extending address tags and area information based on virtual addresses and processor IDs, checking the access permission of memory instructions, and suppressing cache state changes when access is not allowed, ensuring that only legal access can modify the cache state. .
It effectively reduces the risk of side-channel attacks, prevents unauthorized information leakage, enhances cache security, and prevents attackers from stealing sensitive data through speculative execution.
Smart Images

Figure CN110232031B_ABST
Abstract
Description
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims the benefit of U.S. Provisional Application No. 62 / 638,450, filed on March 5, 2018. The entire disclosure of that application is incorporated herein by reference. Technical Field
[0003] The present disclosure relates to methods and systems for accessing data in computer memory devices, including mechanisms and techniques for improving the security of caches. Background Art
[0004] This section provides background information related to the present disclosure which is not necessarily prior art.
[0005] The processor may be equipped with a cache, which may store copies of data and instructions stored in some high-capacity memory, such as dynamic random access memory (DRAM). Herein, the term "memory" may be used to refer collectively to all current and future memory implementations. Cache memory (or simply "cache") may be set up as a memory that is smaller and faster than other memory implementations, and may then only hold a copy of a portion of the data stored in the main memory or secondary storage at any given time. Smaller caches may be implemented using SRAM, and larger caches may be implemented using DRAM.
[0006] The memory system of a computer system may include many caches, and some computer systems may include larger and slower caches (referred to herein as higher-level caches) that are physically and / or logically closer to the main memory and smaller and faster caches (referred to herein as lower-level caches) that are physically and / or logically closer to the processor. This configuration may be referred to as a cache hierarchy, a memory hierarchy, or a memory system. Each level in the cache hierarchy is referred to as a cache level. Summary of the invention
[0007] This section provides a general summary of the disclosure and is not a comprehensive disclosure of its full scope or all of its features.
[0008] In an example embodiment, a method for accessing data in a cache of a device is provided, the method comprising: storing access permissions of cache blocks stored in a cache in a buffer; for a memory instruction involving the cache block, determining whether the memory instruction is allowed to access the cache block based at least in part on the access permissions of the cache block; and inhibiting changes to the cache if it is determined that the memory instruction is not allowed to access the cache block.
[0009] In an example embodiment, a system is provided, comprising: a cache; and at least one processor configured to: store access permissions for cache blocks in a cache area; for a memory instruction involving the cache block, determine whether the memory instruction is allowed to access the cache block based at least in part on the access permissions for the cache block; and inhibit changing the cache if it is determined that the memory instruction is not allowed to access the cache block.
[0010] Further areas of applicability will become apparent from the description provided herein.The description and specific examples in this summary are intended for purposes of illustration only and are not intended to limit the scope of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate one or more example embodiments and, together with the specification, explain at least some portions of these example embodiments. The accompanying drawings are not intended to limit the scope of the present disclosure. In the drawings:
[0012] Figure 1 is a block diagram illustrating an example embodiment of a multi-processor system;
[0013] Figure 2 is a block diagram of an example embodiment of a single processor system including a cache hierarchy;
[0014] Figure 3 An example embodiment of a two-level cache hierarchy including a set associative cache and a set associative data translation lookaside cache is shown;
[0015] Figure 4 is a block diagram illustrating an example embodiment of a system including a two-level cache hierarchy and a two-level cache block address lookaside buffer (CLB) hierarchy, wherein a first level is accessed virtually and a second level is accessed physically;
[0016] Figure 5 is a block diagram illustrating an example embodiment of a system including two CPUs connected to a two-level cache hierarchy and a two-level cache block lookaside cache hierarchy;
[0017] Figure 6 This is an example Figure 4 A block diagram of an example embodiment of an implementation of an extension of CLB1; and
[0018] Figure 7 This is an example Figure 3 A block diagram of an example embodiment of an implementation of an extension of a TLB. DETAILED DESCRIPTION
[0019] The following description of example embodiments refers to the accompanying drawings. The same reference numerals in different figures refer to the same or similar features. The following detailed description does not limit the invention. However, the scope of the invention is defined by the appended claims. For simplicity, some of the following example embodiments are discussed with respect to the terminology and structure of the cache hierarchy and methods for performing lookups in such a hierarchy. However, the example embodiments are not limited to these configurations, but are extendable to other arrangements discussed below.
[0020] References throughout the specification to "an example embodiment" or "example embodiments" are intended to mean that a feature, structure, or characteristic may be included in at least one example embodiment of the disclosed subject matter. Thus, the phrases "in an example embodiment" or "in example embodiments" appearing in various places throughout the specification are not necessarily referring to the same embodiment(s). Further, features, structures, or characteristics may be combined in any suitable manner in one or more example embodiments.
[0021] Example embodiments will now be described more fully with reference to the accompanying drawings.
[0022] Figure 1 An example computer system is depicted in which each CPU 101 is assigned its own first level private cache 102 (L1 cache), wherein a private cache is a cache whose space for data cells is accessible only by the activity of the CPU to which the cache is local and / or in the same node as the cache (wherein the cache is dedicated to that node). In this example computer system, a second level cache 103 is shared by all CPUs 101 and may contain data and instructions accessed by all CPUs 101. Cache 103 is a shared cache because the space for data cells is accessible by the activity of any CPU 101. Cache 103 is also a shared cache because each data cell may only exist in one shared copy, while each private cache may have a replicated copy. Main memory 105 also stores instructions and data accessible by all CPUs 101. Main memory 105 is accessed using physical addresses (or PAs for short), while addresses generated by CPU 101 are identified as virtual addresses (or VAs for short). A computer system (e.g., Figure 1 The example computer system shown in ) may feature a mechanism for quickly finding a requested data unit in one of the caches and / or for keeping multiple copies of data stored in different nodes consistent.
[0023] exist Figure 1 In the example computer system of FIG. 1 , if CPU 101 accesses data stored on disk 104, the virtual memory system ( Figure 1105 and creates a translation from the virtual address corresponding to the page to the physical address. A special type of translation cache (TLB) is identified as a "translation lookaside buffer" (or TLB for short). Figure 1 The virtual memory system may be viewed as a cache system that stores a portion of the data located in the disk 104 in the memory 105.
[0024] Figure 2 Show Figure 1 2, wherein the CPU 204 is shown as including several similar cache structures (e.g., instruction TLB (ITLB, 201) and data TLB (DTLB, 205)) and the CPU core 202. The first level cache 102 is shown as including an instruction cache 200 (L1ICACHE) and a data cache 206 (L1DCACHE) between the CPU 204 and the second level (and potentially higher level) cache 207. Figure 2 Also shown is a high capacity memory 208 connected to the cache hierarchy.
[0025] When CPU 204 requests data that is present in the cache (referred to as a cache hit), the request may be serviced more quickly than an access to data that is not present in the cache (referred to as a cache miss). Assuming the two applications have similar properties, an application running on a CPU 204 that experiences fewer cache misses may execute faster and / or consume less energy than an application that exhibits more cache misses. Therefore, it would be advantageous to provide a computer system that reduces cache misses and / or makes cache hits and cache misses efficient relative to their access latency and / or the energy consumed by such memory transactions.
[0026] Data may be stored in the cache in fixed blocks larger than the word size of the processor, referred to as cache blocks. Example embodiments may feature cache block sizes such as 32, 64, and 128 bytes, as well as larger and / or smaller cache block sizes and / or variable cache block sizes.
[0027] In an example embodiment, data placement in memory 208 may be organized in a manner that each data word is statically mapped to reside in a particular cache block. Each cache may have a random index value that identifies a portion of the cache in which each cache block may reside, referred to as a set. The set may contain space for storing one or more cache blocks simultaneously. The number of cache blocks that the set may store is referred to as its associativity. In a set-associative cache, the associativity of all sets is the same. Associativity may also vary between sets. Each of the spaces in a set that may store cache blocks is referred to as a way.
[0028] In order to determine the identity of each cache block stored in each group, cache blocks in the cache have some identifier associated with them, such as an address tag (ATAG). When looking for a particular cache block in the cache, the address of the cache block can be used to determine the cache group in which the cache block may exist. The address tag of the cache block of the corresponding group is the same as the tag portion of the address used to identify the cache block (see, for example, Figure 3 The ADDR address tag (ATAG) depicted in and described below is compared to determine whether the desired cache block exists in the cache, and if so, which way it exists in (e.g., which of the spaces in the group that can hold the cache block it exists in). In an example embodiment, the size of such an ADDR address tag can be quite large and can be in the range of 30-40 bits (which can be 6-10% of the size of the cache block).
[0029] In an example embodiment, a cache may have an embedding policy, also referred to as its replacement policy, for determining which cache blocks remain in a group and which cache blocks are evicted (also referred to as replacements) to make room for new cache blocks introduced into the group. The replaced cache blocks are referred to as victims or replaced cache blocks. Replacement policies that may be used in conjunction with cache memory include, but are not limited to, least recently used (LRU), pseudo-LRU, and random replacement policies.
[0030] In an inclusive cache hierarchy, a copy of a block of data (e.g., a cache block) present in one cache level (e.g., a block of data in an L1 cache) may also be present in a higher cache level (here, higher refers to a cache level higher than the first level), for example, in the L2 and L3 caches. An exclusive cache hierarchy has only one copy of a block of data (e.g., a cache block) present in the entire cache hierarchy, while a non-inclusive cache hierarchy may have a mix of the two strategies. In example embodiments of exclusive and non-inclusive cache hierarchies, a cache block may be stored in the next higher cache level when evicted from a given cache level.
[0031] Some techniques for identifying specific cache locations within an example cache hierarchy are now described, such as in Figure 1 and Figure 2 As shown in . Figure 3An example of the organization of a computer system node is shown, which includes a CPU core 301, a data translation lookaside buffer (DTLB) 303, an L1 cache 307, and an L2 cache 311, wherein the L2 cache 311 is characterized by having cache entries, and the cache entries include ATAG 312 and DATA (data) 313. The CPU core 301 generates a memory request including a virtual address 302 (VADDR), and the virtual address 302 is used to perform an associative lookup in the DTLB 303. In this example, the virtual address 302 is divided into three parts: P-OFFSET (page offset, e.g., including low-level bits), TAG (tag), and INDEX (index). The INDEX portion of the virtual address 302 is used to identify a group within the DTLB 303 that can store address translations.
[0032] The illustrated DTLB 303 used in this example has a two-way associative organization showing two entries of the identified group. Each entry includes an address tag (ATAG) 304 and a physical page frame (PPF) 305. The TAG portion of the virtual address 302 is compared with the ATAG 304 of each entry of the identified group. Logic 318 determines whether there is a match for either entry and, if so, controls the multiplexer (MUX) 306 to select the corresponding PPF 305. The physical address (PADDR) 316 is composed by concatenating the PPF 305 selected by the MUX 306 with the P-OFFSET portion of the virtual address 302. Alternatively, if none of the entries of the identified group matches the TAG portion of the virtual address 302, a TLB fill operation is performed and the corresponding translation entry is introduced into the DTLB 303.
[0033] PADDR 316 is used to perform a lookup in L1 cache 307. More specifically, the INDEX portion of PADDR 316 is used to identify a group in which a cache block containing the requested data may be stored. The L1 index may contain different bits than the DTLB index. The depicted L1 cache 307 has a 2-way associative organization with two entries in the identified group. Each entry includes an address tag (ATAG) 308 and data 309 of the corresponding cache block. The TAG portion of PADDR 316 is compared with the ATAG of each entry of the identified group. Logic 319 determines whether there is a match for any of the entries and controls MUX 310 to select the corresponding data and return (315) the data to the CPU core 301. If any of the entries do not match (depicted by L1 MISS (L1 miss) 317), a lookup in L2 cache 311 is performed by logic 320 provided to a third multiplexer (MUX) 314, which returns (315) the data to the CPU core 301.
[0034] Although the division of PADDR 316 into an INDEX portion and a TAG portion for an L2 cache lookup may be different from the division performed for an L1 cache lookup, the remaining steps for an L2 cache lookup may be similar to the steps performed for a lookup in an L1 cache. If a miss in the L2 cache is determined, a new lookup in a higher level cache or access to memory may be performed. If the INDEX portion of PADDR 316 used by the L1 cache consists entirely of P_OFFSET bits, access to the L1 cache 307 may begin before the PPF information from MUX 306 is available. This may be referred to as a virtually indexed physically tagged cache (VIPT). An L2 (and higher level) cache may contain a larger number of groups than an L1 cache, and the TLB may convert some address bits to be used as index bits.
[0035] In the example embodiment, each has a configuration similar to Figure 3 Several "nodes" of the memory hierarchy depicted in can be connected together to form a coherent multiprocessor system. Figure 1 In the example embodiment of a multiprocessor shown in , each CPU has its own private L1 cache. A multiprocessor configuration can complicate the task of locating where requested data exists, as it may not be sufficient to search for data in the next higher cache level. Mechanisms for searching caches of other nodes and for reconciling multiple copies of data stored in different nodes are used to perform those tasks.
[0036] Figure 4 An example embodiment including an untagged cache is presented that can rely on location information LI (sometimes referred to as a cache block pointer CP) corresponding to the requested cache block matching the cache table entry CTE (sometimes referred to as a region location entry) to indicate in which cache and in which position of the cache the requested cache block exists. This will enable the embodiment to perform a direct cache lookup at the appropriate cache.
[0037] For example, Figure 4 The example system of FIG. 1 shows an untagged node in an example multiprocessor system, where location information can be used to distinguish between an L1 cache and an L2 cache. The location information can also be used to distinguish between other caches ( Figure 4 (not shown). It may also be possible to identify an associated way within the cache in which the requested data is stored. Figure 4 The example untagged node shown in FIG. 4 can be connected to other nodes in an example multiprocessor system having a two-level cache hierarchy with set-associative caches and a CPU (which may contain one or more caches, depicted here as L0), where CPU 401 generates an address (ADDR) 402. In an example embodiment, ADDR 402 is VA. In another example embodiment, ADDR 402 is PA. Figure 4 Also shown is a two-level cache block address lookaside buffer (CLB) hierarchy of a set associative CLB, where CLB1 410 and CLB2 420 are indexed using ADDR. Each entry in CLB1 includes at least an address tag (AT) 411, a cache location table (CLT) 412. In an example embodiment, AT 411 stores a portion of a virtual address, and in a different embodiment, AT 411 stores a portion of a physical address. The entry may store additional information, such as region information (RI) 413. The CLT stores location information (LI) (also called micropage) of the cache block of the corresponding region. As an example, Figure 4 Four LIs are shown per region. Experimental studies by the inventors indicate that 8 to 16 LIs per region (e.g., 8 to 16 data units and / or cache blocks per region) are cost-effective and effective. The location information encodes the location within a multiprocessor system where the corresponding cache block can be found. For example, the location information may include the identity of the cache in which the data unit can be found. The location information may also include the location within the cache where the data unit can be found, referred to as its way information in the associated cache. Alternatively, the location information may include the identity of the node in which the data unit can be found and / or may include a symbol providing information about its location. For example, the symbol "MEM" may indicate that the data unit can be found in memory. In an example embodiment, the symbol "don't know" indicates that the location of the corresponding data unit is not recorded in the CLT corresponding to the region.
[0038] Region Information (RI) 413 stores attributes applicable to the region. For example, this could be the physical address of the region (or a portion thereof) and some region classification information (e.g., a code if the region only exists in this CLB and not in other CLBs).
[0039] MUX 416 selects the CLT in which AT 411 matches the TAG portion of ADDR 402, and MUX 415 selects the LI 414 corresponding to the requested cache block based on the LI-OFFSET portion of ADDR 402. If the cache identity stored in the selected LI corresponds to L2 cache 440, an address 417 for accessing the requested data unit in L2 cache 440 is formed using the INDEX portion of address 402 and a portion of location information 414. In the example of a set-associative L2 cache 440, the portion contains information corresponding to the associated way in which the requested data unit is stored. In an example embodiment, the L2 index is formed using a portion of ADDR 402 and some of the physical addresses stored in region information RI 413. If the cache identity stored in the selected LI corresponds to L1 cache 430, an address 418 for accessing the requested data unit in L1 cache 430 is formed in a similar manner.
[0040] For a cache hierarchy that includes set-associative caches with the same associativity, the number of bits in each LI depends on the number of ways and the number of caches of the cache hierarchy covered by the CLB. For invalidation mode ("MEM"), one LI value may be reserved. In this embodiment, the number of LI bits is equal to the base-2 logarithm of the number of ways (one or more) plus the base-2 logarithm of the number of cache levels covered by the CLB plus one (e.g., log 2 (number of roads) + log 2 (number of levels) + 1). Other LI representations may be possible if the number of ways of different cache levels varies or if a cache other than a set associative cache is used. In an example embodiment, the size of the LI may be much smaller than the size of an address tag. A 2-level cache hierarchy with a 16-way associative cache at each level may be encoded using 6 LI bits.
[0041] Figure 4An example embodiment is shown in which each entry in the L1 cache 430 and the L2 cache 440 has a back pointer (BP) 432 and 442 associated with its cache block (DATA) 431 and 441, respectively. In various embodiments, the BP pointer points to its respective associated CTE in CLB2 420 or in CLB1 410. Each CTE in CLB2 420 contains an address tag (AT) 421, a CLT 422, a CLB1 pointer (CIP) 423, and region information (RI) 425. If a CLB2 entry has a corresponding CLT present in CLB1 410, its CIP will point to the entry. In this case, CLB1 410 will contain the latest information for the region. In this case, the CLE in CLB1 is identified as an active CLB entry, while the CLB entry for the region in CLB2 420 contains a passive entry. CLB2 420 may provide the level and way information to one or more multiplexers (MUX) 424. In an example embodiment, if CLB1 410 contains an active entry for a region, CLB2 420 may contain a passive entry for the region.
[0042] In an example embodiment, when a matching CTE cannot be found in CLB1 410, a corresponding CTE is found in CLB2 420 and the corresponding CTE is copied to CLB1, and the old entry in CLB1 is copied to CLB2 420. These operations may be referred to as "overflow and fill" or simply "overflow / fill", which may be described in detail in the following examples. Figure 4 Spills may occur when an inclusive cache evicts a data unit to the next level to make room for a new data unit, which may be brought in (filled) from the next cache level. Similar spill / fill activities will be performed between different CLB levels, where CLB entries are moved between CLB levels because the CLB levels form an inclusive hierarchy. In the example embodiment, the directory DIR is at the root of the CLB hierarchy, and the highest level CLB performs the spill / fill.
[0043] In an example embodiment, access to the requested data unit may be initiated concurrently with the overflow / fill activity.
[0044] In an example embodiment, the CLB hierarchy is inclusive, but cache hierarchy L1 430, L2 440, and higher caches do not enforce inclusiveness. One or more caches may return (450) data to CPU 401.
[0045] In an example embodiment, the contents of the CLBs of a multi-level CLB implementation maintain consistent locations of data cells of the multi-level cache system they manage. Data cells that move in the cache hierarchy (including but not limited to movements caused by requests for data cells from the CPU, evictions of data cells, pre-fetch activities, and coherency activities) result in updates to their corresponding location information in one or more of the CLBs. For example, in Figure 4 , evicting a data cell 441 from L2 cache 440 may involve the following steps: following its associated BP 442 pointer to find its corresponding CTE which may be present in CLB2 420; and updating its corresponding location information to point to the new location of the data cell (e.g., storing a MEM symbol). If the CIP pointer of the corresponding CLE of CLB2 is valid, then following the CIP to find its corresponding CTE in CLB1 410 and updating its location information associated with the cache block. In an example embodiment, if there is a valid CIP pointer, the entry in CLB2 is not updated. In an example embodiment, only the active CLT is updated.
[0046] In an example embodiment using an untagged cache system (e.g., a cache system in which data units stored in the cache do not have address tags associated with them), a number of different types of transactions may occur as CPU 401 requests various cache blocks located in different storage devices. For example, Figure 4 The node depicted in FIG. 1 may be a subsystem (or node) of a larger multiprocessor system composed of several such cache nodes. Keeping cached data in many nodes consistent may involve a cache consistency protocol, which may include snooping and / or directory-based consistency. The consistency protocol may be directed to Figure 4420 sends a coherence request (EXTERNAL REQUEST) to the node depicted in . These requests may first be directed to CLB2 420, which may determine that the cache system does not have the requested cache block (CLB2 miss or CLB2 hit with invalid (inactive) CIP and location information of the requested cache block with memory mode value retained). If so, no further action is involved regarding the data caches L1 and L2 (called coherence filtering), but the corresponding LI in the active CLT may be updated to track the new location associated with the data unit. Otherwise, the CLB2 lookup may provide the requested location information (CLB2 hit and location information of the requested cache block with the location of the cache block retained) or it may determine that CLB1 410 stores the associated location information (CLB2 hit and valid CIP). In the latter case, the lookup in CLB1 410 may determine the location of the requested cache block or that the cache block does not exist in the cache subsystem. The corresponding location information in CLB1 contains the memory mode. Depending on the attributes of the coherence request (e.g., invalidate request, read request, or exclusive read request), the coherence protocol may perform some operations on the requested data unit and possibly change its state. The corresponding LI in the active CLT may also be updated to track the new location associated with the data unit.
[0047] although Figure 4 The node shown in includes two cache levels. In example embodiments, other numbers of levels may be used to aggregate nodes, and nodes may include more than one CPU. In addition, in example embodiments, the number of cache levels and the number of CLB levels in a node may vary.
[0048] Example embodiments may also be applied to systems having several CPUs that share a cache managed by a CLB. For example, Figure 5 An example system constructed of two CPU nodes (580 and 590) is shown, each CPU node having a CLB1 (CLB1A 503 and CLB1B 513) and dedicated L1 caches (504 and 514) within its own level 1 cache hierarchy, according to an example embodiment. Figure 5 The example system also includes a shared L2 cache 523 (sometimes referred to as a last level cache LLC), which is shared between the two CPUs 501, 511. Figure 5 In the example system of , the shared L2 cache 523 includes entries characterized by data 505 and a back pointer (BP) 506 .
[0049] A lookup in CLB1 (513 or 503) selects a single LI based on the address 502, 512 generated by its corresponding CPU (501, 511), for example, using a technique similar to CLB1 410. As indicated by the three arrows (including 517) originating from the CLT entries shown in two of CLB1A 503 and CLB1B 513, the selected LI may identify the location in the corresponding L1 cache (504 and 514, respectively), in the L2 cache 523, or in other nodes (shown by 570 and 571, respectively). In this example, CLB1A503 identifies the accessed data 505 in the shared L2 cache 523, while CLB1A 503 identifies the data it accesses as 505 in its L1 cache 514 (shown by the solid arrow). If the other node is identified as storing the data, a lookup in its CLB is performed to determine the exact location of the requested cache block within its (one or more) dedicated caches.
[0050] It may be advantageous to reduce the presence of side-doors in computer systems that may allow security attacks such as Spectre, Meltdown, and other side-channel attacks.
[0051] The processor executes independent instructions out of sequence in an attempt to hide delays caused by busy functional units or memory access delays. In an example embodiment, the processor does not stall but attempts to schedule subsequent operations in the instruction stream to available functional units. Upon completion, instructions are queued in a re-order buffer (ROB). Instructions are formally committed and are visible externally to other processors and / or processor cores in the system when they retire from the ROB. Instructions may only retire from the re-order buffer when all previous instructions have retired.
[0052] Some aspects of speculative execution that may relate to cache security are now discussed.
[0053] refer to Figure 1 In an example computer system, CPU 101 may execute instructions faster than accessing cache and memory. To compensate for this, the CPU may perform speculative work. Examples of speculative work include starting to execute instructions along an execution path that may be a wrong path, executing instructions in an order different from program order, and pre-fetching data into cache before the first request for the data.
[0054] In some processing architectures, the processor may speculate on the next instruction to introduce a program (in the case of a branch or function call) and / or a value that should be returned by a load. In some such cases, the processor evaluating the first instruction cannot determine whether the next instruction in the program should be executed. This situation may be caused by delays in converting a virtual address to a physical address and then checking the access permissions of the location. As an example, if the next instruction in the program attempts to access memory location A via a read operation, it may take some time to determine whether the program has permission to do so. Although the processor waits to determine whether it has permission to read A, if it ultimately determines that the access is not permitted, it may perform the read speculatively as long as it "erases" the software-visible effects of the read.
[0055] In some cases, speculation may result from mispredicted branches. Branch prediction is a technique used by processors to reduce the number of speculative instructions that are not executed. Branching involves the calculation of a branch target. Conditional branches also involve the evaluation of branch conditions to determine whether to "take" the branch. A branch target buffer (BTB) may store a mapping from the address of the most recently executed branch instruction to the branch target address. Another hardware component that keeps a record of the most recent branch results is used to determine whether to take the branch.
[0056] The Spectre and Meltdown attacks exploit CPU caches as a primary source of information leakage. Cache-based side-channel attacks are security vulnerabilities in which an attacker exploits cache behavior to gain information about a victim program as it executes, and then acts on that information to attack the host system. Specifically, these scenarios rely on the attacker being able to distinguish between cache hits and misses.
[0057] Some cache-based attacks can exploit timing channels as part of the attack vector. These timing channels can exploit measurable differences in memory and / or page table access latency to monitor victim behavior. Examples of timing attacks include Prime+Probe and Flush+Reload.
[0058] In a Prime+Probe attack, first, the attacker prepares the cache by filling one or more groups with his own cache blocks, and then allows the victim program to execute. After the victim program has been executed, the attacker investigates the cache by re-accessing the cache blocks he previously prepared and timing these accesses. Longer access times (i.e., cache misses) indicate that the victim program has touched addresses mapped to the same group, thereby evicting the attacker's cache blocks.
[0059] A Flush+Reload attack may have similar purposes as Prime+Probe, but may rely on shared virtual memory between the attacker and the victim program (e.g., a shared read-only library or page deduplication) and the ability to clear by virtual address. In a Flush+Reload attack, the attacker may identify specific cache blocks, rather than just cache groups. A Flush+Reload attack may begin by clearing the shared cache block(s) of interest and then allowing the victim program to execute. After the victim program has executed, the attacker may reload the previously evicted cache block(s), while measuring the duration of the access to determine if the cache block was preloaded by the victim program.
[0060] Meltdown and Spectre represent a recently discovered class of cache timing side-channel attacks that exploit the effects of out-of-order speculative execution on cache state. Meltdown breaks the mechanism that prevents applications from accessing arbitrary system memory. Spectre mis-trains branch predictors in modern processors to trick applications into accessing arbitrary locations in their memory. After inducing speculative execution, both attacks use timing side channels (specifically, Flush+Reload) to identify which addresses are speculatively accessed by the processor. By inducing speculative execution of non-privileged read accesses that depend (via address calculation) on previously privileged read accesses, the attack may be able to access privileged core memory.
[0061] Meltdown and Spectre attacks show that CPU caches can be polluted by speculatively executed instructions. Even if the software-visible effects of speculative instructions are eliminated, microarchitectural effects can still remain. In addition, Meltdown and Spectre attacks show that software dependencies can be exploited from victim memory accesses to attacker memory accesses, allowing an attacker to increase the range of addresses where Flush+Reload attacks can be performed to include non-shared memory locations in addition to shared memory.
[0062] In summary, various cache implementations (including Figures 1 to 5 The example system depicted in ) can be vulnerable to side channel attacks including Spectre and Meltdown, where microarchitectural state changes can be observed by its own processes and sometimes by other processes that are not allowed to access the data.
[0063] It may be advantageous to design a cache system to reduce vulnerability to security attacks (e.g., side channel attacks). Some cache systems may consider whether a process executing a memory instruction is allowed to execute the memory instruction on the address it accesses. In some cache systems, no access permission check is performed when a memory instruction is issued. However, at least for some memory instructions, an access permission check is performed when the instruction is committed. Access permissions may be checked via the TLB. Access permissions may change over time (e.g., via TLB invalidation, which invalidates one or more entries and forces a reload of the TLB on the next access), and access permissions may be applied only at commit time. Although later access permission checks may be acceptable from an architectural perspective, later permission checks may allow unauthorized speculative instructions to change the state of the cache, which may allow secret information to be leaked between processes.
[0064] The example embodiments may be extended with additional fields including Figure 3 and Figure 4 ) to implement an embodiment associated with protecting a cache system.
[0065] In an example embodiment, Figure 3 The net load of each entry of the DTLB 303 is extended to also encode the access permissions for access to the region. The DTLB 303 is accessed using the full virtual address of address 302 (which may include any process ID (also known as address space identifier, ASID), virtual machine ID (such as VMID), and may include other specific extensions to the virtual address). The address tag ATAG 304 is also extended to store the corresponding bits of the full virtual address. The access permissions in the CLB are checked when a memory instruction is issued. Violating the access permissions results in no cache block movement or state change in the cache hierarchy, and the CPU is notified that the memory instruction violates the access permissions.
[0066] In an example embodiment, the expansion Figure 4 The region information RI 413 is encoded to also encode the access permissions for access to the region. CLB1 410 is accessed using the full virtual address of address 402 (which may include any process ID (also known as address space identifier, ASID), virtual machine ID (such as VMID) and may include other specific extensions to the virtual address). The address tag AT 411 is also extended to store the corresponding bits of the full virtual address. The access permissions in the CLB are checked when a memory instruction is issued. Violation of the access permissions results in no cache block movement or state change in the cache hierarchy, and the CPU is notified that the memory instruction violates the access permissions.
[0067] In an example embodiment, performing an access permission change (e.g., TLB invalidation) of a region or page also involves removing (or invalidating by some other means) the corresponding entry in CLB1 410. However, cache blocks in L1 cache 430 and L2 cache 440 pointed to by location information (LI) stored in their CLT 412 may be evicted (sometimes referred to as forced eviction).
[0068] In an example embodiment, performing an access permission change (e.g., TLB invalidation) for a system with a tagged cache also involves removing (or invalidating by some other means) Figure 3 The corresponding entry in the DTLB 303 depicted in FIG. 4 is a reference to the corresponding entry in the DTLB 303 depicted in FIG. 4. Figure 3 and Figure 4 The expansions are Figure 7 and Figure 6 and described in more detail below.
[0069] In the example embodiment, the CLB1 410 entries from CLB2 420 are populated ( Figure 4 The FILL arrow in the figure also includes access to the TLB ( Figure 4 The access permissions read from the TLB are stored as access permissions AP in the extended region information (RI). The region information is also extended to store TLB reload bits (TR). When CLB1 410 receives an access permission change (e.g., TLB invalidation), it sets the TR of the corresponding region, but does not evict or invalidate the CLB entry. This will force a new TLB reload (accessing the TLB used during CLB1 410 filling) to read the (possibly modified) access permission bits. However, since the CLB1 410 entry was not removed or invalidated from CLB1 410, the cache block may not be evicted.
[0070] In an example embodiment, additional mechanisms may be included to handle access permissions changes between the time a memory instruction is issued and the time it is later committed. In an example embodiment, if the access permissions change (perhaps by receiving a TLB invalidation between the time the initial cache access permissions are checked and the time the instruction is committed), the pipeline will recheck its access permissions. This may be applicable to, for example, Figure 3 The extended functionality of the tagged cache and / or Figure 4 410 and DTLB 303, respectively, when a change in access permissions occurs. Whenever the RECHECK bit is set, it is necessary to recheck access permissions at commit time (e.g., by executing Figure 3 DTLB 303 lookup or Figure 4 In another example embodiment, in-flight instructions affected by the access permission change are identified and these instructions are forced to recheck their permissions upon submission.
[0071] In an example embodiment, a portion of a cache may include a random index value (RIV) associated with a cache block stored in the cache and used to identify the location of the cache block in the memory of the device. The random index value (RIV) may be stored in the region information (RI) 413 of the region. For example, the number of RIV bits stored in this field may vary from a single bit to the maximum number of bits used to index the cache in the system. In an example embodiment, the RIV is initialized to store a random value unknown to the application. In an example embodiment, the RIV can be used to determine the index to be used when the processor accesses the cache. In an example embodiment, the random index value is formed by XORing the RIV bits with some address bits to calculate the cache index or by some other logical transformation of the bits. The RIV bits can also be used directly as index bits to the cache without any logical transformation. Some caches in the system can be made to rely entirely on the address bits for their index, while other caches rely on random indexes.
[0072] In an example embodiment, the DTLB 303 may also add a field with a random index value (RIV) to its payload. All cache blocks of the page may calculate their indexes using the RIV. (Assuming a 4k byte page size and a 64 byte cache block size, each page has 64 cache blocks.) In an example embodiment, a presence bit (PB) field may be added to the DTLB 303 payload, storing a number of bits (e.g., 64 bits) corresponding to a number of cache blocks on a page.
[0073] Now assuming that the RIV index is only applied to one cache level (e.g., L1), each time a cache block is stored in that cache, the corresponding PB bit is set, and each time it is evicted, the bit is cleared. In this way, the TLB can tell when to evict the last cache block in a group. In an example embodiment, when a TLB entry is evicted, any cache blocks still present in the L1 are also evicted. However, assuming a TLB range that is much larger than the size of the L1, this should not cause too many performance issues. In fact, knowing which TLB entries still have valid L1 cache blocks will facilitate the replacement logic of the TLB to inhibit replacing entries with cache blocks present in the L1 cache, and another TLB entry can be selected to evict instead, which can improve performance.
[0074] Figure 6 shows how it can be extended with more area information as described above Figure 4For clarity, Figure 4 Some components that do not change are already in Figure 6 610. The CPU 601 generates a virtual address that may consist of VA+ASID+VMID. A portion of the virtual address (CI) is used to index CLB1 610 and a portion thereof is compared with all address tags (AT) 611 stored in CLB1 610 entries (only one entry is shown) in the indexed group. Each entry contains a cache location table (CLT) 612 (LI of the cache block storing the region), a physical address (PA) 614, a region classification bit (P) 615, a random index value (RIV) 616, a TLB reload bit (TR) 617, and an access permission (AP) 618 of the fields. A portion of the virtual address generated by the processor is compared with the AT 611 of all entries in the group (640). If there is a match, the fields of the entry are used to access the RIV 616 of the corresponding region, which is at least partially used to index the L1 cache, and the location information (LI) of the corresponding cache block is used to find the correct cache level (e.g., L1 cache) and associated way within the cache.
[0075] If there is a miss (no AT 611 in the indexed CLB1 610 set matches the address generated by the processor 601), a lookup in the TLB 620 is initiated to retrieve the physical address (PA) 622 and access permissions (AP) 623. If there is a match with the virtual address tag (VAT) 621 in the TLB 620, the PA 622 of the matching TLB 620 entry is used to perform a lookup in CLB2 630 and a new CLB1 610 entry is created using the information from the matching CLB2 630 entry along with the PA 622 and AP 623. At the same time, if this is the only CLB1 610 entry in the system, a new random number is written to the RIV 616, TR 617 is not set, and P 615 is set.
[0076] Figure 7 shows how it can be extended with more fields for each of its entries Figure 3710). The CPU 701 generates a virtual address consisting of VA+ASID+VMID. A portion of the virtual address (TI) is used to index the TLB 710 and a portion of it is compared with the virtual address tags (VAT) 711 of the TLB entries (only one entry is shown) stored in the indexed group (740). Each entry contains the fields present bit (PB) 712 (one bit is stored per cache block of the page), physical address (PA) 714, random index value (RIV) 716, TLB reload bit (TR) 717 and access permission (AP) 718. A portion of the virtual address generated by the processor is compared with the virtual address tags VAT 711 of all entries in the group. If there is a match, the fields of the entry are used to access the memory hierarchy. The RIV 716 is used to index the L1 cache to find the appropriate group, and the address tags (AT) of all cache blocks of the group are compared with the physical address.
[0077] Figure 7 The TLB 710 depicted in FIG. Figure 6 610 in that both store PA, RIV, AP, TR, and some per-cache block location information (e.g., PB 712 stores information about which cache blocks in a page are stored in L1). Thus, TLB 710 may be considered a form of cache location buffer (CLB).
[0078] The following section summarizes how the features of the above example embodiments can reduce various security attacks. Figure 6 and Figure 7 Described example embodiments as well as other example embodiments.
[0079] Meltdown attacks involve inter-procedural attacks in which an attacking process can facilitate an attacked process to speculatively access the attacker's address space and leave traces in the microarchitectural state that can reveal secrets. Meltdown attacks rely in part on the fact that speculative instructions that are not allowed to affect microarchitectural state are allowed to do so. Early permission checks (e.g., for instructions that cause Figure 6 and Figure 7 ) would be sufficient to mitigate such attacks (even though other parts of the architectural implementation (e.g., shared branch predictor state) could also be fixed).
[0080] Spectre attacks involve the side effects of speculative accesses to a process's own address space, which can leak data from one part of the process to parts of the process that code has been designed not to access. One such example is enabling code to step outside of a security isolation architecture (e.g., a just-in-time (JIT) execution sandbox) and access data in the process that should be out-of-bounds due to the security isolation architecture. The security vulnerability is activated by allowing microarchitectural side effects caused by speculative (and later not executed) accesses to be observable through non-speculative accesses (that are executed), such as by measuring timing to determine whether data is stored in cache.
[0081] Examples of attacks that can exploit this type of speculation include flush+reload, which relies on being able to hit speculatively loaded data non-speculatively, and prime+probe, which relies on speculatively loaded data evicting non-speculatively loaded data.
[0082] In flush+reload, the attacker flushes the cache of a chosen set of data, then causes the data it controls to be speculatively loaded into the cache indirectly from a speculative load (e.g., load controlled_data[speculative_data]). The attacker can then time accesses to all elements of its controlled data to see which are cached, and thus infer the value of the speculative data. This attack can succeed if the speculatively loaded data is accessible to non-speculative loads.
[0083] In prime+probe, the opposite approach is used. First, controlled data is loaded into the cache in a way that some of the index bits in the cache for each controlled data element are known. The attacker then loads speculative data into the cache, which evicts one of the controlled data elements. The attacker can then time the load of each of the speculative data elements to determine which to evict, thereby gaining information about the speculative information. If the speculatively loaded data evicts the non-speculatively loaded data, the attack is successful.
[0084] This attack can be mitigated by distinguishing speculatively loaded data from non-speculative data, and optionally, at the same time, reducing the performance cost of protecting speculative loads. That is, speculative data can be fetched from DRAM while speculative, but its effects can only be made visible in the cache hierarchy when it is no longer speculative.
[0085] Part of the prime+probe attack involves the fact that the attacker knows the cache index of each cache block for a particular cache level. Such an attacker can fully fill one or many of its groups before the attack, and then time accesses to the prepared cache blocks after the attack to infer some secret information about the cache. However, if the random index value of the cache block is unknown, it may become more difficult to fill the group and / or infer secret information based on the timing of certain accesses after the attack. The example embodiments described herein may use the random index value (RIV) field of the CLB1 610 entry and the TLB 710 entry, respectively, to reduce such attacks. The RIV may include a random number that is unknown to the application (including the attacker) and may be used at least in part to generate index bits for cache accesses.
[0086] Figure 6 and Figure 7 The cache system is shown to generate random cache indexes using RIV. As described above, preferably, the random index values 616, 716 in CLB1610 and TLB 710 are initially set to random numbers unknown to any application. The following description is based on Figure 6 and Figure 7 .
[0087] Periodically changing the random index value can further reduce prime+probe attacks. Random indexing can also make it more difficult to design side-channel "prime+probe" security attacks because the index of the monitored data and the index used for malicious probing access are not easily known. This attack involves determining a dynamic index to fill enough area of the group before the attack can be established. The dynamic index can increase the difficulty of the attack (e.g., increase the time), including by actively changing the dynamic index of the cache block at a faster rate than the attacker can access the cache block.
[0088] In an example embodiment, the random index values of the regions in CLB1 610 and TLB 710 may be dynamically changed at a selected rate. When the random index value is changed, the cache block pointed to by the location information (LI) of the region may be copied to a new group identified by the new random index value.
[0089] In an example embodiment, when the last cache block pointed to by its LI or recorded by its PB, respectively, is removed from the cache using the random index value to calculate its random index value, the random index value of the region can be changed to a new random number. In this case, the random index value can be changed to a new random value without moving any cache blocks. For example, referring to Figure 6If the random index value 616 field of CLB1 610 is used only to calculate the random index value 616 of the L1 cache and the CLT 612 determines that the last cache block of the region is evicted from the L1 cache, then the random index value 616 of the region of the CLT can be changed to a new random number without moving any cache blocks in the L1 cache. Figure 7 A similar example of relies on PB 712 to determine when the last cache block of one of its pages is evicted to allow a valid random index value 716 to be updated.
[0090] In an example embodiment, the system detects a region that has not had its random index value changed within a selected time period that causes its random index value to change, even though some of its cache blocks may be relocated due to the random index value change. This allows for a selected random index value change time period while limiting the relocation of cache blocks to regions / pages with data present in L1 for a longer time period.
[0091] Untagged caches can exhibit higher associativity because the cost of their associativity grows only logarithmically with the size of their LI. For example, doubling the associativity of all caches can be achieved with one more LI bit. High associativity itself makes "prime+probe" side-channel attacks linearly more expensive.
[0092] In the case of a higher associativity cache organization, the replacement algorithm becomes less influential, allowing untagged caches to easily support random replacement. Since many side-channel attacks exploit the knowledge of the replacement algorithm (e.g., LRU) to build their attacks, switching to random replacement makes them statistically more difficult to predict, which results in longer attack times. Methods that not only randomly replace data but also randomly protect data can make it difficult to determine random index values. Although random replacement can be expected to produce less efficient cache behavior, the large associativity will make the performance difference relatively small compared to optimal replacement.
[0093] Lack of inclusiveness can allow untagged caches to reduce the amount of speculative data stored throughout the cache hierarchy. In some example computer systems, speculative loads can leave traces of storing and / or removing data at each level as the data is introduced. Untagged caches can allow arbitrary data caching policies, which can facilitate the placement of speculative data in caches without affecting other caches. Such placement can reduce the amount of data that is leaked, and / or facilitate flexibility for isolating speculation in a way that makes it easier to control its effects and the way it can be observed.
[0094] While each of these features of cache design can help reduce such attacks, example embodiments may combine them in such a way that speculative pre-fetching of data can be performed for performance while preventing speculative accesses from becoming visible in the form of evicting non-speculative data (prime+probe) and / or hits from non-speculative accesses (flush+reload).
[0095] Lack of inclusiveness and the ability of an untagged cache to easily track data in multiple levels may enable an untagged cache with a separate speculative cache that may reduce speculative accesses.
[0096] In an example embodiment, speculative loads may be stored exclusively in the speculative cache, thereby reducing the eviction of non-speculative data from the rest of the memory hierarchy (prime+probe). Hits to data in the speculative cache from other loads may be reduced, which may reduce detection by non-speculative accesses (flush+reload). When the pipeline has committed and / or retired the load and it is determined to be non-speculative, the data from the speculative cache can be safely moved into the regular hierarchy to achieve the performance benefits of speculative pre-fetching. In some embodiments, the conversion to non-speculative may be completed before the instruction is committed. In an example embodiment, the conversion to non-speculative is completed once it can be determined that the instruction is no longer speculative and is to be executed.
[0097] Introducing RIVs into the CLB and TLB, respectively, may allow the cache hierarchy to be protected from such attacks by reducing hits on speculatively loaded data and / or making it difficult to learn from evictions caused by speculative loads (prime+probe). The approach may combine the following effects: high associativity, random indexing, and lack of forced inclusion to provide a safe zone cache for loading and storing speculative data. Speculative loads can be stored in the safe cache and marked as speculative. Once the speculation is resolved, the data can be quietly evicted in the event of a mis-speculation. Otherwise, its marking as speculative is cleared, and from this point, it may also be stored in the rest of the cache hierarchy.
[0098] In an example embodiment, the L1 cache may be designed to reduce side channel attacks. In an example embodiment, the L1 cache may exhibit 32-way associativity, random indexing, random replacement, and tracking of speculatively loaded data. Tracking speculatively loaded data may reduce hits on speculative data, which may reduce flush+reload attacks. Reducing prime+probe attacks may involve selecting random index values that are difficult to determine, which may allow for increased associativity, and utilizing random index bits to mask the location where data is stored in the cache.
[0099] In an example embodiment, the random index value of a region may be changed occasionally. For example, if an attacker determines the index of a region, the random index value may be changed before the attacker accesses the region. In an example embodiment, one or more random index values may be changed at a selected time period and / or frequency. In an example embodiment, the time period and / or frequency of changing the random index value may be selected based on the speed of the attack and / or the selected security level. In an example embodiment, a subset of regions may have random index values that change occasionally because the index bits may be changed for free each time a region is first introduced or the last cache block in a region is evicted. If the dynamic index bits of a region change when it has data present in the cache, those cache blocks may be evicted and restored, but the L1 cache may not be searched for those cache blocks because they may be found by looking at the CLB entries with data present in the L1 cache.
[0100] In an example embodiment, due to the non-inclusive cache hierarchy, cache blocks returned for memory requests may not be installed in the L2 cache when installed in the L1 cache. Upon L1 cache eviction and as long as it is deemed appropriate to do so (e.g., guided by some cache placement heuristics), cache blocks may be installed in the L2 cache. For speculative accesses, cache blocks may be installed only in the safe L1 cache and / or marked as speculative, which can reduce non-speculative accesses while keeping them close to the processor and / or processor core to facilitate speculative pre-fetching. When speculation is completed and the instruction is determined to be executed, the cache block can be moved into the appropriate location for future reuse.
[0101] In an example embodiment, the state machine (SM) can introduce data into a secure cache or into a speculative cache. In an example embodiment, the state machine can decide which cache blocks are installed in the L1 cache and / or L2 cache and also decide when to promote them. In some embodiments, the processor can notify the state machine when a memory request becomes non-speculative, such as when it is known that it is no longer part of a malicious side channel attack. If the state machine is processing a long-latency DRAM access and all its preceding branches have been resolved (as well as other potential reasons for not executing speculative instructions), the processor can notify the state machine that the memory request is no longer speculative and it can be safely installed in some other cache. If the cache block is still considered speculative when the data is returned from DRAM, the memory request is satisfied from the L1 cache and the cache block is marked as speculative.
[0102] For simplicity, some of the descriptions herein describe techniques for how to locate a cache block and / or return it to a requesting CPU. Some examples do not describe in detail the various ways in which a requested word contained within a cache block is selected and / or returned to the CPU, but such details are obvious to those skilled in the art.
[0103] For simplicity, some descriptions herein describe processing data of a cache hierarchy and describe an exclusive cache hierarchy. Those skilled in the art will appreciate that the described embodiments can be expanded to cover both inclusive and non-exclusive memory hierarchies.
[0104] Although the example embodiments described above relate to single-processor systems and multi-processor systems (eg, Figure 1 and Figure 2 As illustrated and described above, the CLB according to example embodiments may be used in conjunction with a single processor system, and may also be used with a multi-processor system.
[0105] The subject matter of the present disclosure, including the example embodiments discussed and / or presented in the accompanying drawings, may be implemented in various architectures. In an example embodiment, the cache may be stored in, accessed by, and / or controlled by: one or more software components (e.g., threads or processes executed on one or more processors); a software library, such as a set of instructions stored in a memory and accessed by processes and / or threads of an operating system and / or application; and / or a set of instructions executable by a processor stored on a non-temporary computer-readable medium. In an example embodiment, the cache may be stored in, accessed by, and / or controlled by one or more hardware devices. In an example embodiment, such a hardware device may include a processing circuit system, such as, but not limited to, one or more processors each having one or more processor cores. Such processors may include a central processing unit (CPU); a graphics processing unit (GPU); a core of a multi-core CPU or GPU; an arithmetic logic unit (ALU); a digital signal processor; a microcontroller and / or a microcomputer; a system on a chip (SoC); a field programmable gate array (FPGA); a programmable logic array (PLA); an application specific integrated circuit (ASIC); a modular logic device, such as a packaged logic chip; and / or any other device capable of responding to and executing instructions in a defined manner. In example embodiments, the cache may be stored in, accessed by, and / or controlled by a combination of components of the same and / or different types, such as: multiple processors and / or processing cores in a single processor or multi-processor computer; two or more processors operating in tandem, such as a CPU and a GPU; a CPU utilizing an ASIC and / or software executed by a processor. Example embodiments may include components of a single device, such as a computer including one or more CPUs that store, access, and manage a cache. Example embodiments may include components of multiple devices, such as two or more devices with CPUs that communicate to access and / or manage a cache. Example embodiments may include one or more components contained in a server computing device, in a server computer, in a series of server computers, in a server farm, in a cloud computer, in a content platform, in a mobile computing device, in a smart phone, in a tablet computer, or in a set-top box. Example embodiments may include components that communicate directly (e.g., two or more cores of a multi-core processor) and / or components that communicate indirectly (e.g., via a bus, through a wired or wireless channel or network, and / or via an intermediate component such as a microcontroller or arbitrator). Example embodiments may feature multiple instances of a cache manager executed by each device or component, wherein such instances may be executed simultaneously, continuously, and / or in an alternating manner. Example embodiments may feature instances of a cache manager distributed across two or more devices or components.
[0106] Example embodiments may include components including cache and computer-readable instructions stored in memory. Non-limiting examples of memory include, but are not limited to: rewritable non-volatile memory devices (including, for example, flash memory devices, erasable programmable read-only memory devices, or mask read-only memory devices); volatile memory devices (including, for example, static random access memory devices or dynamic random access memory devices); magnetic storage media (including, for example, analog or digital tapes or hard disk drives); and optical storage media (including, for example, CDs, DVDs, or Blu-ray discs). Examples of memory with embedded rewritable non-volatile memory include, but are not limited to: memory cards; and media with embedded ROM (including, but not limited to ROM tapes), etc. Example embodiments may include and / or utilize a memory device of a tangible or non-transitory computer-readable storage medium (e.g., random access memory (RAM), read-only memory (ROM), permanent mass storage devices (e.g., hard disk drives), and / or any other similar data storage mechanism capable of storing and recording data). The memory may be configured to store computer programs, program codes, instructions, or some combination thereof for one or more operating systems and / or for implementing the example embodiments described herein. The memory may include a universal serial bus (USB) flash drive, a memory stick, a Blu-ray / DVD / CD-ROM drive, a memory card, and / or other similar computer-readable storage media. In an example embodiment, a cache, a computer program, a program code, and / or instructions, or some combination thereof, may be loaded from a remote data storage device to one or more local memories and / or one or more local processors via a network interface. In an example embodiment, a cache, a computer program, a program code, and / or instructions, or some combination thereof, may be loaded from another local memory and / or another local processor or component.
[0107] Although described above in the context of certain example computer architectures, caches exist in many other settings within and outside of computer systems, and the foregoing embodiments are equally applicable to such other contexts. An example of such use is a virtual memory system that caches data from a slow, high-capacity storage (e.g., disk or FLASH memory) to a faster, smaller, high-capacity storage that can be implemented using dynamic RAM. Other examples of caches in computer systems include, but are not limited to, disk caches, network caches, and name caches. The organization and caching mechanisms of such caches may differ from those described above, such as changes in group size, implementation and association of groups, and the like. Regardless of the implementation of the caching mechanism, the example embodiments described herein may be applicable to implementing various caching schemes.
[0108] For example, the disclosed embodiments describe systems and methods associated with various cache hierarchies. However, the exemplary embodiments are intended to encompass alternatives, modifications, and equivalents that are included within the spirit and scope of the present invention. Further, in the specific description of the exemplary embodiments, a large number of specific details are set forth to provide a comprehensive understanding of the present invention. However, those skilled in the art will appreciate that the various embodiments may be practiced without such specific details.
[0109] Although the features and elements of the present embodiments are described in some combinations in the example embodiments, each feature or element may be used alone without other features and elements of the example embodiments, or may be used in various combinations with or without other features and elements disclosed herein. The methods or processes provided in this application may be implemented in a computer program, software, or firmware tangibly embodied in a computer-readable storage medium for execution by a special-purpose computer or processor.
[0110] This written description uses examples of the disclosed subject matter to enable any person skilled in the art to practice the subject matter, including making and using any devices or systems and performing any incorporated methods. The patentable scope of the subject matter is defined by the following claims and may include other examples that occur to those skilled in the art. Such other examples are intended to fall within the scope of the following claims.
Claims
1. A method for accessing data in a cache of a device, the method comprising: include: Storing in a cache area access permissions for cache blocks stored in the cache; for a memory instruction involving the cache block, determining whether the memory instruction is permitted to access the cache block based at least in part on the access permissions of the cache block; as well as Under the condition that it is determined that the memory instruction is not allowed to access the cache block, refraining from changing the cache, Wherein, under the condition that the access permission of the cache block is changed between the time when the pending memory instruction is determined to be allowed to access the cache block and the time when the pending memory instruction is submitted, whether to allow the pending memory instruction to access the cache block is re-determined at least in part based on the access permission.
2. The method according to claim 1, further comprising: include: The cache block in the cache is invalidated upon condition that the access permissions of the cache block are changed.
3. The method according to claim 1, in, The cache area includes a cache table, the cache table includes a cache table entry, the cache table entry identifying a region of the cache block in a memory of the device, and Storing the access permissions for the cache block includes storing the access permissions in the cache table entry for the cache block.
4. The method according to claim 1, in, The cache area includes a cache table, the cache table includes a cache table entry, the cache table entry identifies the area of the cache block in the memory of the device and the area information of the cache table, and Storing the access permission for the cache block includes storing the access permission in the region information of the cache table.
5. The method according to claim 1, further comprising: include: Storing random index values in the buffer; storing the cache block in the cache at a location based at least in part on the random index value; as well as Conditional upon determining that the memory instruction is permitted to access the cache block, the cache block is accessed by determining a location of the cache block based at least in part on the random index value.
6. The method according to claim 5, further comprising: include: The random index value is periodically changed at a selected rate.
7. The method according to claim 6, further comprising: include: Under condition that the random index value is changed to a new random index value, the cache block is moved to a new location based at least in part on the new random index value.
8. The method according to claim 5, further comprising: include: The random index value is changed under the condition that the cache block is removed from the cache.
9. The method according to claim 1, further comprising: include: marking the cache block as speculative on condition that the cache block is stored as a speculative load of the memory instruction; marking the cache block as non-speculative upon resolving the speculative load of the memory instruction as non-speculative; as well as The cache block is removed from the cache upon resolution of the speculative load of the memory instruction as a mis-speculation.
10. A system, include: A cache that stores cache blocks; and at least one processor configured to: Storing access permissions for the cache blocks in a cache area; for a memory instruction involving the cache block, determining whether the memory instruction is permitted to access the cache block based at least in part on the access permissions of the cache block; as well as Under the condition that it is determined that the memory instruction is not allowed to access the cache block, refraining from changing the cache, Wherein, the at least one processor is further configured to: under the condition that the access permission of the cache block is changed between the time when the pending memory instruction is determined to be allowed to access the cache block and the time when the pending memory instruction is submitted, redetermine whether to allow the pending memory instruction to access the cache block at least in part based on the access permission.
11. The system according to claim 10, in, The cache area includes a cache table, the cache table includes a cache table entry, the cache table entry identifies the area of the cache block in the memory, and The at least one processor is configured to store the access permission in the cache table entry of the cache block.
12. The system according to claim 10, in, The cache area includes a cache table, the cache table includes a cache table entry, the cache table entry identifies the area of the cache block in the memory and the area information of the cache table, and The at least one processor is configured to store the access permission in the region information of the cache table.
13. The system according to claim 10, in, The at least one processor is further configured to invalidate the cache block in the cache conditional on changing the access permissions of the cache block.
14. The system according to claim 10, in, The at least one processor is further configured to: Storing random index values in the buffer; storing the cache block in the cache at a location based at least in part on the random index value; as well as Conditional upon determining that the memory instruction is permitted to access the cache block, the cache block is accessed by determining a location of the cache block based at least in part on the random index value.
15. The system according to claim 14, in, The at least one processor is further configured to periodically change the random index value at a selected rate.
16. The system according to claim 15, in, The at least one processor is further configured to, upon changing the random index value to a new random index value, move the cache block to a new location based at least in part on the new random index value.
17. The system according to claim 14, in, The at least one processor is further configured to change the random index value conditional upon removal of the cache block from the cache.
18. The system according to claim 10, in, The at least one processor is further configured to: marking the cache block as speculative on condition that the cache block is stored as a speculative load of the memory instruction; marking the cache block as non-speculative upon resolving the speculative load of the memory instruction as non-speculative; as well as The cache block is removed from the cache upon resolution of the speculative load of the memory instruction as a mis-speculation.
19. A non-transitory computer-readable storage medium comprising instructions that, when executed by a processor, cause the processor to perform an operation, the operation include: storing, in the cache area, access permissions for cache blocks stored in the cache; for a memory instruction involving the cache block, determining whether the memory instruction is permitted to access the cache block based at least in part on the access permissions of the cache block; as well as Under the condition that it is determined that the memory instruction is not allowed to access the cache block, refraining from changing the cache, The operation further includes: If the access permissions of the cache block are changed between a time when a pending memory instruction is determined to be allowed to access the cache block and a time when the pending memory instruction is committed, whether to allow the pending memory instruction to access the cache block is re-determined based at least in part on the access permissions.
Citation Information
Patent Citations
Virtually-tagged instruction cache with physically-tagged behavior
CN101421706A
Automatic suspend and resume in hardware transactional memory
CN102906703A
High-speed cache storage system and method for accessing cache lines
CN104679669A
Microprocessor having improved memory management unit and cache memory
US20020156962A1
Method and apparatus for updating and invalidating store data
US20030065890A1
