theory and practice of finding eviction sets
play

Theory and Practice of Finding Eviction Sets Pepe Vila Boris Kpf - PowerPoint PPT Presentation

Theory and Practice of Finding Eviction Sets Pepe Vila Boris Kpf Jos F. Morales IMDEA Software Institute Microsoft Research IMDEA Software Institute vwzq.net @cgvwzq github.com/cgvwzq Eviction Sets CACHE Find addresses that collide


  1. Theory and Practice of Finding Eviction Sets Pepe Vila Boris Köpf José F. Morales IMDEA Software Institute Microsoft Research IMDEA Software Institute vwzq.net @cgvwzq github.com/cgvwzq

  2. Eviction Sets CACHE Find addresses that collide in cache: i.e. SLICE 0 addresses mapped into the same cache set associativity sets SLICE 1 associativity sets

  3. Eviction Sets CACHE Find addresses that collide in cache: i.e. SLICE 0 addresses mapped into the same cache set associativity sets SLICE 1 associativity sets

  4. Eviction Sets CACHE Find addresses that collide in cache: i.e. SLICE 0 addresses mapped into the same cache set associativity sets SLICE 1 associativity sets

  5. Eviction Sets CACHE Find addresses that collide in cache: i.e. SLICE 0 addresses mapped into the same cache set associativity sets Find associativity many colliding addresses: i.e. an eviction set SLICE 1 associativity sets

  6. Attacks Efficient attacks require small eviction sets

  7. Attacks Efficient attacks require small eviction sets Prime+Probe

  8. Attacks Efficient attacks require small eviction sets Prime+Probe Rowhammer

  9. Attacks Spectre Efficient attacks require small eviction sets Prime+Probe Rowhammer

  10. Problem PHYSICAL MEMORY CACHE SLICE 0 associativity Potentially unknown mapping from sets physical address to SLICE 1 cache set associativity sets

  11. Problem Unknown translation from virtual to physical addresses PHYSICAL MEMORY CACHE USER PROCESS SLICE 0 associativity sets MMU SLICE 1 associativity sets text heap stack low high

  12. Problem In some scenarios, even unknown virtual address PHYSICAL MEMORY CACHE USER PROCESS SLICE 0 <script> associativity var foo = new Uint32Array(N) ; foo[12]; ... </script> sets MMU SLICE 1 associativity sets text heap stack low high

  13. Problem PHYSICAL MEMORY CACHE USER PROCESS SLICE 0 <script> associativity var foo = new Uint32Array(N) ; foo[12]; ... </script> sets Find associativity many elements (e.g. JS MMU array indices) that collide in cache. SLICE 1 associativity sets text heap stack low high

  14. Contributions Systematic study of the problem of finding eviction sets

  15. Contributions Systematic study of the problem of finding eviction sets Find eviction sets in O(n) compared to previous O(n 2 )

  16. Contributions Systematic study of the problem of finding eviction sets Find eviction sets in O(n) compared to previous O(n 2 ) Reliability and performance evaluation of algorithms in real hardware

  17. Finding minimal eviction sets 1 Find a large eviction set for an address V: - Pick “enough” addresses at random - Timing test:

  18. Finding minimal eviction sets 1 Find a large eviction set for an address V: - Pick “enough” addresses at random - Timing test: 2 Reduce initial large eviction set into its minimal core

  19. Finding minimal eviction sets 1 Find a large eviction set for an address V: - Pick “enough” addresses at random - Timing test: 2 Reduce initial large eviction set into its minimal core

  20. Baseline algorithm Start with large enough eviction set S of size N N S :

  21. Baseline algorithm Pick candidate element C, and Test if remaining set TEST(S\{C}) is still an eviction set N’ S :

  22. Baseline algorithm If TEST(S\{C}) = True, discard C N’ S :

  23. Baseline algorithm and continue with N’=N-1 N’ S :

  24. Baseline algorithm We repeat this process several times N’ S :

  25. Baseline algorithm We repeat this process several times N’ S :

  26. Baseline algorithm We repeat this process several times N’ S :

  27. Baseline algorithm We repeat this process several times N’ S :

  28. Baseline algorithm Until we find an element C such that when removed the remaining set stops being an eviction set: TEST(S\{C}) = False N’ S :

  29. Baseline algorithm We learn that C is part of the minimal core N’ S :

  30. Baseline algorithm We keep track of it, and insert it again in S N’ S :

  31. Baseline algorithm We repeat this process several times N’ S :

  32. Baseline algorithm We repeat this process several times N’ S :

  33. Baseline algorithm We repeat this process several times N’ S :

  34. Baseline algorithm We repeat this process several times N’ S :

  35. Baseline algorithm We repeat this process several times N’ S :

  36. Baseline algorithm We repeat this process several times N’ S :

  37. Baseline algorithm We repeat this process several times N’ S :

  38. Baseline algorithm We repeat this process several times N’ S :

  39. Baseline algorithm We repeat this process several times N’ S :

  40. Baseline algorithm We repeat this process several times N’ S :

  41. Baseline algorithm Until we have identified ASSOCIATIVITY many elements representing the eviction set’s core! N’ S : ASSOCIATIVITY

  42. Baseline algorithm O(N 2 ) memory accesses N’ S : ASSOCIATIVITY

  43. Threshold Group Testing (10 individual tests) Group testing problem by Robert Dorfman (1943) Blood samples

  44. Threshold Group Testing (4 group tests + 3 individual tests ) Group testing problem by Robert Dorfman (1943) Blood samples

  45. Threshold Group Testing (4 group tests + 3 individual tests ) Group testing problem by Robert Dorfman (1943) Blood samples Generalization by Peter Damaschke (2006): - Positive test only if at least “u” defectives - Negative test only if at most “l” defectives - Random otherwise

  46. Threshold Group Testing (4 group tests + 3 individual tests ) Group testing problem by Robert Dorfman (1943) Observation: Our test is a threshold Blood samples Generalization by Peter Damaschke (2006): group test! - Positive test if at least “u” defectives - Negative test if at most “l” defectives - Random answer otherwise

  47. Group-testing algorithm Start with large enough eviction set S of size N N S :

  48. Group-testing algorithm Split S in ASSOCIATIVITY+1 subsets N S :

  49. Group-testing algorithm In the worst case, there exists a union of ASSOCIATIVITY subsets being an eviction set N S :

  50. Group-testing algorithm We can discard N/(ASSOCIATIVITY+1) elements per iteration N S :

  51. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  52. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  53. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  54. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  55. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  56. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  57. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  58. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  59. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  60. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  61. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  62. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  63. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  64. Group-testing algorithm We repeat this process until we have ASSOCIATIVITY many elements N’ S :

  65. Group-testing algorithm We find our minimal eviction set! ASSOCIATIVITY S :

  66. Group-testing algorithm O(N) mem accesses ASSOCIATIVITY S :

  67. Experiments on Skylake i5-6500 with 6MB cache (8192 sets x 12 assoc) Performance Evaluation Tool (C/x86): https://github.com/cgvwzq/evsets O(n) vs. O(n 2 ) advantage shows up in practice! Finding minimal eviction sets is practical without knowledge on any bits timeout of the set index! Y-right (lines): Average running time for eviction set reduction Y-left (columns): Cost of finding an initial eviction set of certain size X: Eviction set size in number of addresses

  68. Experiments on Skylake i5-6500 with 6MB cache (8192 sets x 12 assoc) Robustness Evaluation Modern replacement policies break our test assumption and introduce errors. X: Cache set offset (each points aggregates all slices) Y: Average success rate for Green: reduction rate w/o error correcting mechanisms. Yellow: Test rate reliability

  69. Demo running on Chrome 74.0.3729.75 with V8 7.4 - CPU i7-8550U Live demo (Bonus Material!) Find minimal eviction sets on Chrome with JS and Wasm

  70. Conclusions Finding minimal eviction sets is a threshold group-testing problem: new insight for research on principled countermeasures Novel linear-time algorithm makes attacks faster and enables them in scenarios previously considered impractical

Recommend


More recommend