1 00:00:00,640 --> 00:00:01,780 Hello everyone. 2 00:00:01,780 --> 00:00:09,820 I'm actually surprised there's so many people on Saturday, relatively in the morning, so thank you everyone for coming to this talk on a Saturday morning. 3 00:00:10,120 --> 00:00:20,800 I'm delighted to be for the first time on the DEF CON main stage and have an opportunity to speak about how to secure, and how actually NVIDIA secure, a unique ecosystem shipping more than a billion cores. 4 00:00:20,860 --> 00:00:25,100 However, are we even the right people to speak about such an important topic? 5 00:00:25,100 --> 00:00:27,660 I don't want to spend too much time here, but here we are. 6 00:00:27,660 --> 00:00:30,960 Currently, I'm working in NVIDIA as a Director of Offensive Security. 7 00:00:30,960 --> 00:00:37,480 My name is Adam Zabrocki, and I'm leading various offensive security research efforts across the entire company. 8 00:00:37,480 --> 00:00:46,460 I'm also involved in the RISC-V International, when I'm serving as a Vice Chair of J-Extension Group, and I'm author of various CPU ISA extensions. 9 00:00:46,560 --> 00:00:50,580 And I'm also security architect of the GPU and next generation NVIDIA product. 10 00:00:50,580 --> 00:00:59,020 While Marko Mityk, who is here, co-presenter, he's software security architect and manager at NVIDIA, where he leads NVIDIA core RISC-V team. 11 00:00:59,300 --> 00:01:02,540 And he also GPU product security and RISC officer and lead. 12 00:01:03,000 --> 00:01:07,900 So the most important question, I think, is why we even have this talk today. 13 00:01:08,040 --> 00:01:13,060 So NVIDIA is known from their data platform product, who looks like this. 14 00:01:13,060 --> 00:01:14,380 You can see on the screen. 15 00:01:14,420 --> 00:01:17,300 And this is not just a specific product. 16 00:01:17,300 --> 00:01:18,200 It's a platform. 17 00:01:18,200 --> 00:01:22,700 It's an entire platform who handles very complicated workloads, including AI workloads. 18 00:01:22,700 --> 00:01:24,100 This is the most known. 19 00:01:24,120 --> 00:01:25,860 And it's a huge machine. 20 00:01:25,860 --> 00:01:28,120 But that's not the only product which NVIDIA has. 21 00:01:28,120 --> 00:01:40,500 We also have this type of the product, which actually can buy and plug into your already existing data platform and handle also AI workloads and other complicated workloads. 22 00:01:40,500 --> 00:01:43,400 But we also have traditional GPUs who looks like this. 23 00:01:43,400 --> 00:01:46,580 The one which is on the left, it's actually consumer GPU. 24 00:01:46,580 --> 00:01:52,180 But on the right, it's actually also server type GPU, which is different computer architecture. 25 00:01:52,260 --> 00:01:54,400 Then we also have other products like that. 26 00:01:54,540 --> 00:01:59,400 We have system on the chips like Tegra, which is used in various products. 27 00:01:59,400 --> 00:02:02,320 We also have upcoming NVIDIA Digits and Spark. 28 00:02:02,400 --> 00:02:06,400 But what is important, even all of those products has completely different features. 29 00:02:06,400 --> 00:02:07,960 They look even completely different. 30 00:02:07,960 --> 00:02:09,820 They have completely different functionality. 31 00:02:09,820 --> 00:02:11,640 They have different security expectations. 32 00:02:11,640 --> 00:02:13,240 They have different threat model. 33 00:02:13,240 --> 00:02:18,800 On their core, on their heart, they're still running only one specific NVIDIA processor. 34 00:02:19,120 --> 00:02:26,340 So even they have completely different security warranties, they still are based on the ecosystem, which is NVIDIA processor. 35 00:02:26,360 --> 00:02:34,320 So there's nothing hidden under the sun, and we wanted to give you a little bit insight how we redesigned the system to be able to fulfill so many various use cases. 36 00:02:34,640 --> 00:02:43,480 So first thing first, each NVIDIA chipset, which you saw on the previous slide, may include between 10 up to 50 microcontrollers in one die. 37 00:02:43,480 --> 00:02:48,760 There's various level microcontrollers like functional level controllers, like memory controllers, chip-to-chip interface. 38 00:02:48,760 --> 00:02:53,400 There is chip-system level controllers like RM, like PMU, like security and more. 39 00:02:53,400 --> 00:02:54,900 There is also data processing. 40 00:02:54,900 --> 00:03:03,520 And what is important that in the past, all of those microcontrollers were actually designed and run on the internal proprietary skies across Falcon. 41 00:03:03,560 --> 00:03:11,200 However, our demand of grow and our demand of adaptability was much, much faster than Falcon could actually keep up. 42 00:03:11,200 --> 00:03:13,920 The legacy architecture couldn't keep up. 43 00:03:13,920 --> 00:03:20,200 So we have different trajectory of the grow, and it was very difficult to scale on the Falcon architecture. 44 00:03:20,500 --> 00:03:25,840 So it was sufficient at the time when we used it, but requirements and expectation changed. 45 00:03:25,840 --> 00:03:33,920 The security layer needed to be updated to fulfill all of the modern and also future expectation, which we don't even actually know how it's going to look like, yes? 46 00:03:34,220 --> 00:03:42,920 And NVIDIA processor and chip must meet the demand which we have, especially of the grow and adaptability, and they must be flexible enough to actually fulfill these needs. 47 00:03:42,920 --> 00:03:53,840 AI work was still booming, actually, not only AI work, but most of the complicated work was booming, and NVIDIA processor is actually a crucial piece of all of those processing. 48 00:03:54,040 --> 00:04:07,200 And we had actually an opportunity to redesign this ecosystem from the scratch to be able to fulfill all of those use cases, and actually wanted to do it in a secure manner that will be scalable in the future, which we don't even know how this future is going to look like. 49 00:04:07,340 --> 00:04:09,580 And we decided to do this on the RISC-V. 50 00:04:09,580 --> 00:04:11,000 Why did we choose RISC-V? 51 00:04:11,000 --> 00:04:12,380 Mark will speak to you more about. 52 00:04:12,920 --> 00:04:15,640 Thank you, Adam. 53 00:04:15,640 --> 00:04:16,320 Hello, everyone. 54 00:04:16,320 --> 00:04:17,920 I'm really happy to be here. 55 00:04:17,940 --> 00:04:21,320 So let me continue with answering why did we choose RISC-V. 56 00:04:21,420 --> 00:04:28,520 So first, we wanted to retire our proprietary Falcon architecture and move towards an open and more future-proof foundation. 57 00:04:29,180 --> 00:04:38,800 The RISC-V offered better baseline performance without legacy overhead, and its flexibility enabled rapid hardware-software co-design through custom extensions. 58 00:04:39,100 --> 00:04:43,800 But the layered security isolation primitives were the key factor here. 59 00:04:44,100 --> 00:04:49,120 So essentially, we wanted to build a strong isolation model as strong as physically separate controllers. 60 00:04:49,560 --> 00:04:55,240 We did not want to keep adding new standalone controllers whenever we wanted stronger isolation for something. 61 00:04:55,800 --> 00:05:01,200 So we needed a common configurable platform for all microcontrollers across all products. 62 00:05:01,420 --> 00:05:07,380 And such a platform would need to be scalable, both up and out, so that we only pay for what's needed whenever we needed it. 63 00:05:07,380 --> 00:05:10,560 And RISC-V met all our requirements. 64 00:05:12,000 --> 00:05:15,360 This shows the rate of adoption of RISC-V at NVIDIA. 65 00:05:15,380 --> 00:05:22,560 So naturally, with more applications we run on controllers, we have more cores in each of the products. 66 00:05:23,020 --> 00:05:34,800 We first introduced RISC-V in Turing architecture, and then focus was on migrating from Falcon, making investments along the way through hardware-software co-design on security hardening, performance, and scaling. 67 00:05:35,140 --> 00:05:43,680 I do want to mention that we have RISC-V in all NVIDIA products, not just GPUs, but I only listed GPU architectures just for simplicity. 68 00:05:45,480 --> 00:05:52,160 So there are many aspects to forming a secure execution, and this list here is by no means an exhaustive one. 69 00:05:52,300 --> 00:05:56,560 What I highlighted are just items that our talk will be touching on today. 70 00:05:57,720 --> 00:06:03,840 And now let's go briefly over some RISC-V basics as it's important to follow what's coming. 71 00:06:03,920 --> 00:06:09,060 So most commonly RISC-V has three privilege modes, machine mode, supervisor mode, and user mode. 72 00:06:09,060 --> 00:06:14,060 And there is also this HS mode, or HS mode when hypervisor extension is present. 73 00:06:15,040 --> 00:06:22,400 Each privilege mode has its own set of CSR registers, and there are multiple access control primitives that are configurable per privilege level. 74 00:06:24,500 --> 00:06:31,020 PMP and IOPMP are the most fundamental isolation primitives, isolation units. 75 00:06:31,020 --> 00:06:39,600 So PMP, physical memory protection, this is what restricts code running at different privilege levels from accessing certain memory regions. 76 00:06:39,600 --> 00:06:44,040 And IOPMP would be pretty much the same thing, just for peripheral devices. 77 00:06:44,040 --> 00:06:49,820 So essentially it restricts devices like DMA or crypto to access some memory ranges. 78 00:06:50,240 --> 00:06:56,440 And from processor's perspective, IOPMP is used to restrict access to devices' control registers. 79 00:06:57,200 --> 00:07:07,010 NVMPU is NVIDIA's memory protection unit, that's NVIDIA extension, this is what enables tasks or processes if operating system is present on a controller. 80 00:07:08,400 --> 00:07:13,950 And apart from memory protection, it also does virtual to physical address translation. 81 00:07:15,660 --> 00:07:19,700 So NVRISC-V would be NVIDIA's implementation of the RISC-V ISA. 82 00:07:19,700 --> 00:07:24,640 It is highly configurable, and it has several NVIDIA custom extensions. 83 00:07:24,660 --> 00:07:32,160 I only listed security extensions here, and I believe we'll cover most of them throughout our talk today. 84 00:07:33,860 --> 00:07:39,800 And Peregrine is our hardware subsystem that includes NVRISC-V processor and peripheral devices. 85 00:07:39,900 --> 00:07:47,040 Within Peregrine there may be multiple NVRISC-V cores, and the RISC-V extensions may or may not be present. 86 00:07:47,300 --> 00:07:51,200 We also have certain configurability within the peripheral devices as well. 87 00:07:51,840 --> 00:07:58,160 And depending on what microcontroller does, some cores may be in DCLS mode for safety and security. 88 00:07:59,980 --> 00:08:04,860 So internally we describe this Peregrine ecosystem as one core strategy. 89 00:08:04,860 --> 00:08:11,580 Essentially having one foundational hardware software architecture for all microcontrollers across all products. 90 00:08:11,600 --> 00:08:18,040 This way, investments we make in these foundational elements, everything benefits from these investments. 91 00:08:18,880 --> 00:08:27,120 So on a given microcontroller, execution starts in immutable bootrom, or boot plugin if bootrom is not present. 92 00:08:27,220 --> 00:08:33,640 And then we have separation kernel software which creates and manages these isolated execution environments we call partitions. 93 00:08:34,220 --> 00:08:40,700 And partitions are where all the application software runs, where all the use cases are implemented. 94 00:08:40,900 --> 00:08:47,480 And this partition architecture is our foundation for running mixed criticality applications on a single NVRISC-V controller. 95 00:08:47,480 --> 00:08:52,560 And at the same time, that's also a foundation for our GPU software security. 96 00:08:53,320 --> 00:09:00,100 So because majority of applications, majority of software runs within partitions, it's very important to secure that execution environment. 97 00:09:00,140 --> 00:09:04,860 And this is what Adam is going to talk about next, and I'll come back to dive deeper into core software elements. 98 00:09:07,730 --> 00:09:08,890 Thanks, Marko. 99 00:09:08,950 --> 00:09:13,730 So yes, as Marko mentioned, the Peregrine ecosystem is actually much more than RISC-V, yes? 100 00:09:13,730 --> 00:09:21,730 We have entire ecosystem built on the top of this basic block, but still the foundation of everything what we've built, it's actually RISC-V. 101 00:09:21,930 --> 00:09:25,890 And it's architecture flexibility which RISC-V gave us is awesome, yes? 102 00:09:25,890 --> 00:09:35,070 It's great for the innovation, but if you want to build entire ecosystem on the RISC-V, you must take into account some caveats which comes with it. 103 00:09:35,070 --> 00:09:41,990 So open source and flexibility, despite their undeniable advantages, they are actually some caveats that you need to take into account. 104 00:09:41,990 --> 00:09:43,590 Like, for example, fragmentation. 105 00:09:43,670 --> 00:09:46,070 What actually is implemented in the hardware? 106 00:09:46,070 --> 00:09:47,350 What software can expect? 107 00:09:47,370 --> 00:09:50,230 Specific optional extension exist or not? 108 00:09:50,230 --> 00:09:52,250 Is this specific functionality exist or not? 109 00:09:52,250 --> 00:09:54,950 How do I run securely on that specific hardware? 110 00:09:54,950 --> 00:09:58,510 Does this even include the hardware functionality which software expects? 111 00:09:58,510 --> 00:10:01,230 We don't know, because it's optional or mandatory. 112 00:10:01,250 --> 00:10:13,130 And there is some remediation for this problem, because RISC-V International provides something which they call profiles, that mandate that specific profile must actually provide specific functionality. 113 00:10:13,130 --> 00:10:15,730 Some extensions are mandatory or optional. 114 00:10:15,730 --> 00:10:28,710 Also, when we decided to design this ecosystem on the RISC-V, their software ecosystem were not as mature compared to other architectures, like x86 ISA or ARM ISA had much better software support at that time. 115 00:10:28,710 --> 00:10:35,070 And the remediation is that RISC-V partners are trying to close that gap and fulfill that gap. 116 00:10:35,070 --> 00:10:43,030 And there is also, whenever we work on the new extension functionality for the RISC-V, they also provide software support for those. 117 00:10:43,030 --> 00:10:52,210 There is also this kind of spirit that RISC-V becoming more and more popular, so open source community also starting to bring in more support for those. 118 00:10:52,210 --> 00:10:58,650 However, speaking about the profiles, they are great at addressing the fragmentation, but there are still some caveats there. 119 00:10:58,650 --> 00:11:00,710 They may not always be mutually compatible. 120 00:11:00,710 --> 00:11:04,190 For example, RVA is not compatible with profile RVB. 121 00:11:04,450 --> 00:11:10,150 Also, even RVA profile does the best job to be backward compatible, still there are some caveats. 122 00:11:10,150 --> 00:11:14,530 For example, profile RVA22 has vector extension as optional. 123 00:11:14,530 --> 00:11:19,090 However, RVA23 mandates vector extension, so there are still some caveats. 124 00:11:19,190 --> 00:11:25,710 And also, custom extension must be actually costly, and so we always say, please contribute to the RISC-V. 125 00:11:25,710 --> 00:11:32,150 Because maybe you have a problem that nobody else had at that time, and you design your own custom hardware solution for those, yes? 126 00:11:32,290 --> 00:11:41,250 However, in the future, maybe someone else made the same problem, and they developed also solution in the hardware for that problem, but together with the RISC-V. 127 00:11:41,250 --> 00:11:46,690 Then you will find out yourself that your custom extension might be incompatible with the official ratified one, yes? 128 00:11:46,690 --> 00:11:49,330 So please contribute to the RISC-V to avoid this problem. 129 00:11:49,330 --> 00:11:54,730 And also, new extension may actually solve your problem in the better or maybe not way, so contribute to RISC-V. 130 00:11:54,750 --> 00:11:58,690 And also, if you have custom hardware, it means you also must have custom software support. 131 00:11:58,690 --> 00:12:00,490 Nobody else is going to do it for you. 132 00:12:00,490 --> 00:12:04,930 So it's better just to contribute to RISC-V and make this ecosystem grow together. 133 00:12:05,690 --> 00:12:11,170 So also speaking about the Peregrine, as Marco mentioned, Peregrine is much, much more than just RISC-V. 134 00:12:11,170 --> 00:12:23,370 There is other processors, and there is other interesting components also from the security perspective, but still in the core of itself, the execution environment is still based on the RISC-V. 135 00:12:23,370 --> 00:12:25,870 In our implementation, which is NVIDIA RISC-V. 136 00:12:25,870 --> 00:12:28,750 So how do we secure this new execution environment? 137 00:12:28,750 --> 00:12:30,930 At first, we wanted to learn from the past, yes? 138 00:12:30,930 --> 00:12:32,830 We don't want to repeat some mistakes. 139 00:12:32,830 --> 00:12:43,270 So we decided we do not intentionally, we do not want to implement ASLR because we believe it has limited value in our specific execution environment. 140 00:12:43,470 --> 00:12:45,090 But it's still not free. 141 00:12:45,090 --> 00:12:47,590 You still need to pay cost of having ASLR. 142 00:12:47,610 --> 00:12:58,910 So we decided to use these resources instead of implementing something which has limited value in our ecosystem to be something more, like, it's better from the security perspective. 143 00:12:58,910 --> 00:13:00,710 It's more efficient from the security perspective. 144 00:13:00,710 --> 00:13:04,630 Instead of buying these resources for something which, you know, would have a limited value. 145 00:13:04,630 --> 00:13:07,710 Also, Peregrine, it's not the only one ecosystem there. 146 00:13:07,710 --> 00:13:09,330 There is other Peregrines in the die. 147 00:13:09,330 --> 00:13:13,050 As I mentioned, there could be between 10 to 50 Peregrines on the one core. 148 00:13:13,150 --> 00:13:17,530 Some Peregrines have different security levels, some have different threat models, some have different warranties. 149 00:13:17,530 --> 00:13:20,050 We need to take this into account when we design the ecosystem. 150 00:13:20,050 --> 00:13:25,290 Also, how do we communicate between this ecosystem or between these different privilege level Peregrines? 151 00:13:25,290 --> 00:13:28,110 We must have a complicated software and firmware. 152 00:13:28,110 --> 00:13:32,390 So we found out that still the software is the biggest attack surface for us. 153 00:13:32,430 --> 00:13:35,950 So how to actually effectively find the software vulnerabilities? 154 00:13:36,270 --> 00:13:46,010 We have a video of anti-security research and among other things, we also do obviously manual vulnerability research because this is something which we must have, that everybody must have. 155 00:13:46,010 --> 00:13:49,730 But actually, that's not sufficient because it's neither scalable solution, yes? 156 00:13:49,730 --> 00:13:51,530 We cannot just rely on those. 157 00:13:51,530 --> 00:13:53,850 It's something which we must have, but it's not enough. 158 00:13:54,150 --> 00:14:00,150 So we obviously need to have also automatic vulnerability detection because it's a crucial piece to automate some of the processes. 159 00:14:00,150 --> 00:14:01,710 So fuzzing can help here. 160 00:14:01,770 --> 00:14:03,990 And how to increase the effectiveness of the fuzzing? 161 00:14:03,990 --> 00:14:08,670 Obviously, we need to have some other sanitizer and code coverage driver instrumentation. 162 00:14:08,670 --> 00:14:10,210 That can help, yes? 163 00:14:10,210 --> 00:14:14,090 The problem is that RISC-V did not support that at that time. 164 00:14:14,250 --> 00:14:21,070 So what we've done, we've actually proactively modified the compilers to be able to bring other sanitizer to RISC-V ecosystem. 165 00:14:21,070 --> 00:14:27,150 Over the time, also software community pick it up and now everybody can use other sanitizer on the RISC-V. 166 00:14:27,150 --> 00:14:33,690 However, when we're starting to use it, we realize it's still not fast enough for our ecosystem because it's very complicated. 167 00:14:33,690 --> 00:14:37,490 So we needed to have hardware support for the better fuzzing and automation. 168 00:14:37,510 --> 00:14:40,930 So that's how I created pointer masking extension for the RISC-V. 169 00:14:41,090 --> 00:14:48,790 And the main goal for this is aim to add hardware support and memory tagging later to RISC-V ecosystem, especially to our ones. 170 00:14:48,790 --> 00:14:50,710 But our ecosystem is unique. 171 00:14:50,710 --> 00:14:55,410 So among standard use case like S and U mode, we also have unusual use case. 172 00:14:55,410 --> 00:14:56,970 We need to support M mode. 173 00:14:56,970 --> 00:15:00,330 We need to support bar metal code for fuzzing microcode, yes? 174 00:15:00,330 --> 00:15:03,270 We also needed to support with and without OS layer. 175 00:15:03,370 --> 00:15:12,670 So because of those, I created on custom developed extension and brought it to RISC-V international to the TE group, which is now rebranded to Runtime Integrity. 176 00:15:12,670 --> 00:15:17,350 However, when I've done that, I realized and I met other folks working on the similar problems. 177 00:15:17,350 --> 00:15:24,310 It turns out that independently people from the Google were also working on the somehow similar pointer masking solution. 178 00:15:24,310 --> 00:15:34,490 So instead of fighting between ourselves, we decided to unite and our use case and promote one single standard for everyone because this will be beneficial entire ecosystem, yes? 179 00:15:34,690 --> 00:15:37,710 So that's how pointer masking extension was created. 180 00:15:37,710 --> 00:15:45,370 And at first, the main principle of pointer masking is to serve as a framework for any feature who requires masking the pointers. 181 00:15:45,370 --> 00:15:46,930 And there's various more use case. 182 00:15:46,930 --> 00:15:49,730 They could be hardware agent and member tagging like we wanted. 183 00:15:49,750 --> 00:15:51,290 They could be pointer authentication code. 184 00:15:51,290 --> 00:15:52,930 They could be hardware memory sandbox. 185 00:15:53,030 --> 00:16:00,830 Like you can see the visualization on the right side, top right slide, because it allows you to create in-process memory sandbox. 186 00:16:00,930 --> 00:16:13,810 But during gratification process, we simplified use case only to hardware ASAN and to be able to have the best integration because there is so many corner cases and to be able to serve as a framework, you must solve all of those problems. 187 00:16:13,810 --> 00:16:15,430 And we actually achieved that. 188 00:16:15,490 --> 00:16:23,230 And we also created a mode that you can have up to seven bits masked from the top or up to 16 bits masked from the top. 189 00:16:23,230 --> 00:16:28,970 And also in the meantime, we were working with the risk of international to be able to include pointer masking as a part of the profiles. 190 00:16:28,970 --> 00:16:34,970 So some of the profiles actually mandate pointer masking to be implemented in the hardware and other profiles make them optional. 191 00:16:35,110 --> 00:16:40,050 And in total, we spent more than four years of work to be able to introduce pointer masking. 192 00:16:40,090 --> 00:16:42,010 And it's actually not one extension. 193 00:16:42,010 --> 00:16:45,470 It's umbrella for five different extension, which is split per privilege level. 194 00:16:45,470 --> 00:16:53,890 And also there is additionally two virtual kind of extension that only describe execution environment, but they have no bearing in the hardware implementation. 195 00:16:53,890 --> 00:16:58,270 Just mandate that you must have support of pointer masking in the U mode or S mode. 196 00:16:58,270 --> 00:17:00,170 And there is some method to be able to enable that. 197 00:17:00,170 --> 00:17:05,510 We also obviously create software ecosystem support for hardware ASAN which is listed here. 198 00:17:05,510 --> 00:17:12,830 And internally, when we actually finish all of those work, we added the software support for our customer ecosystem. 199 00:17:12,930 --> 00:17:18,170 So as of today, we actually run the GSP firmware with the hardware ASAN. 200 00:17:18,170 --> 00:17:23,710 And we're also running as of today resource manager microcode also with the hardware ASAN. 201 00:17:23,710 --> 00:17:30,030 And we're also working to enable hardware ASAN on the bar metal files in microcode as well as the firmware under RTOS. 202 00:17:30,530 --> 00:17:36,860 So there is more people involved in and that's the list and kudos to everybody who are involved in this great research. 203 00:17:37,690 --> 00:17:44,510 Another extension which we believe makes sense, it's very effective from the security perspective, is actually hardware control flow integrity. 204 00:17:44,510 --> 00:17:46,730 Not software CFI, but hardware CFI. 205 00:17:46,730 --> 00:17:54,230 I'm not going to describe how the ROP and return-oriented programming works because it's DEF CON, so I assume everybody knows how it works. 206 00:17:54,230 --> 00:17:56,610 But this is some visualization on the right slide. 207 00:17:56,610 --> 00:18:04,670 However, CFI protects against code reuse attacks, protects against return to rip-seal, protects against the ROP, drop, and this type of attacks. 208 00:18:04,910 --> 00:18:09,050 And CFI is actually a sub... it's a two extension. 209 00:18:09,050 --> 00:18:11,350 There's two sub-extensions inside of the CFI. 210 00:18:11,350 --> 00:18:20,630 One of them is a shadow stack, which enforces backward edge control flow integrity, and it creates a new region called shadow stack, which keeps the copy of return address. 211 00:18:20,630 --> 00:18:23,790 It's visualized on the right side of the slide. 212 00:18:23,790 --> 00:18:30,250 And it also preserves original stack ABI, and we introduce new register and also new instruction for shadow stack management. 213 00:18:30,490 --> 00:18:37,830 And before we return, we just compare if the return address from the shadow stack, it's equivalent on the sign which is in the normal stack. 214 00:18:37,830 --> 00:18:41,470 And the shadow stack region is protected by the hardware, so attacker doesn't have access to it. 215 00:18:41,470 --> 00:18:45,030 So then you cannot actually overwrite the copy of the return address. 216 00:18:45,050 --> 00:18:51,830 And if the return address doesn't match, the hardware will realize the exception, and we can kill the process or however we want to. 217 00:18:51,830 --> 00:18:58,510 And we also believe that this extension is so powerful that we can actually remove the stack cookies and replace them with the shadow stack. 218 00:18:58,510 --> 00:19:11,750 So because of doing that, we do not blow up the code, because the size of the instrumentation of the function code will replace the one which is used by the stack cookies, so the code will not grow in size. 219 00:19:11,750 --> 00:19:15,130 And it's much more effective than stack cookies, so why keeping both? 220 00:19:15,490 --> 00:19:31,010 And again, the second extension under CFI calls the landing pad, which enforces forward edge control flow integrity as opposed to backward edge on the shadow stack, that it's actually mandated any indirect branch must always be landing in the landing pad instruction. 221 00:19:31,010 --> 00:19:31,790 It's a new instruction. 222 00:19:31,790 --> 00:19:35,710 However, this new instruction additionally encodes 20-bit label. 223 00:19:36,390 --> 00:19:42,470 And whenever we have enforcements of the landing pad, then any indirect branch must always land in the landing pad. 224 00:19:42,470 --> 00:19:46,050 Additionally, this landing pad must always have correct hash. 225 00:19:46,050 --> 00:19:48,530 It can't be just random landing pads. 226 00:19:48,530 --> 00:19:49,990 It must be specific hash. 227 00:19:49,990 --> 00:20:00,910 And because we have 20 bits of the space to use for the hash, we actually can reduce the collision problem with other ISA architecture have, because our label is much longer than other architecture. 228 00:20:00,910 --> 00:20:05,850 So as today, we believe the RISC-V hardware CFI is the strongest CFI ISA implementation. 229 00:20:06,430 --> 00:20:13,130 And again, we also are working with the RISC-V profiles and RISC-V international to include CFI profile. 230 00:20:13,310 --> 00:20:17,390 And actually, hardware CFI is mandated to some profile and optional to another one. 231 00:20:17,390 --> 00:20:19,750 We also have software ecosystem support for those. 232 00:20:19,750 --> 00:20:26,450 And inside NVIDIA, we are adding software and hardware support for this, and we committed to bring it to the production in the Ruby timeframe. 233 00:20:27,490 --> 00:20:33,390 And again, there's more people involved in the CFI than just us and other folks. 234 00:20:33,390 --> 00:20:40,030 The list of everyone who are involved of those, and especially kudos for the George and who are chair and co-chair of this group. 235 00:20:40,270 --> 00:20:41,290 And also, what's next? 236 00:20:41,290 --> 00:20:42,310 What we are planning to? 237 00:20:42,310 --> 00:20:46,490 Obviously, memory tagging, because this was the main idea also behind the point I'm asking, yes? 238 00:20:46,490 --> 00:20:50,150 It addresses the performance issue, which you can still have with the hardware ASIN. 239 00:20:50,150 --> 00:20:56,390 And additionally, memory tagging is targeting to be enabled in the production binaries. 240 00:20:56,710 --> 00:21:06,510 Also, we are obviously actively contributing to the RISC-V memory tagging extension, and we want to bring support for this in the software and the hardware and ratify this extension. 241 00:21:06,510 --> 00:21:16,290 So, basic concept, whenever you allocate the memory, then pointer will get the special tag or color, however you call it, assigned to that pointer. 242 00:21:16,690 --> 00:21:25,590 Additionally, the memory itself will also have another separate tag or separate color, which will have actually the same value as the one assigned to the pointer. 243 00:21:25,590 --> 00:21:31,930 So whenever you reference the memory, the hardware will compare if the tag matches the one in the pointer with the one in the memory. 244 00:21:31,930 --> 00:21:34,830 If the tag matches, it means you're inbound of access. 245 00:21:34,830 --> 00:21:39,470 Otherwise, the hardware will detect that you're touching different tag, different color, and tries the exception. 246 00:21:39,570 --> 00:21:50,470 So it's actually kind of very effective and different approach to detecting the problem, because it can detect any type of out-of-bound access, memory corruption, use after free, all of those, it's detectable by the hardware. 247 00:21:50,470 --> 00:21:54,710 But what is important, it's detected before corruption happens. 248 00:21:54,710 --> 00:21:56,730 Most of the mitigation detects post-corruption. 249 00:21:56,730 --> 00:21:57,910 This is before corruption. 250 00:21:57,910 --> 00:22:04,970 So there's no chance for attacker to do anything yet, because hardware will kill it in the root cause before the corruption happens in the first place. 251 00:22:04,970 --> 00:22:17,830 Another extension which we're working on now, we're trying to extend the SafeEye M mode, ShadowStack to the M mode, actually, because landing pad is defined in every mode, but ShadowStack is only defined, not defined in the M mode. 252 00:22:17,830 --> 00:22:24,390 So we want to extend ShadowStack to the M mode as well, using PMP to be able to protect also critical M mode software. 253 00:22:24,510 --> 00:22:34,770 And another extension which we're looking at is actually Hardware Fault Isolation, HFI, which addresses in-process memory sandbox, which was removed from the original pointer masking, but this is very interesting use case. 254 00:22:34,770 --> 00:22:36,390 We are interested on that feature as well. 255 00:22:36,390 --> 00:22:42,850 There's no TG yet, but we are evaluating the benefits of bringing such sandbox to our software ecosystem. 256 00:22:43,030 --> 00:22:44,370 So how it works? 257 00:22:44,370 --> 00:22:49,050 In principle, HFI introduced something like user mode concept of memory region. 258 00:22:49,050 --> 00:22:52,830 Doesn't need to be on the user mode, but it can be enabled also in the user mode. 259 00:22:52,830 --> 00:22:56,510 It's similar to concept of x86 segmentation. 260 00:22:56,830 --> 00:23:01,370 So any access outside of this region, predefined region, will generate a hardware trap. 261 00:23:01,370 --> 00:23:17,250 So before what you do, you generate the list of the base length and attributes of the sub-regions, and whenever you want to execute untrusted code, you just enter to this sub-region, and then hardware will enforce that you cannot touch anything else, excluding the predefined hardware region of the memory. 262 00:23:17,290 --> 00:23:18,930 And it's enforced by the hardware. 263 00:23:19,350 --> 00:23:25,550 And there's another interest of interest for us, which is post-quantum cryptography, PQC. 264 00:23:25,550 --> 00:23:28,070 We also evaluate side channel protection hardening. 265 00:23:28,070 --> 00:23:34,810 We're also looking in the cherry, and we're also looking on the enhanced hardware fault injection protection. 266 00:23:34,870 --> 00:23:37,890 So what I was speaking about, it's a hardware foundation security. 267 00:23:37,890 --> 00:23:39,150 What about the software? 268 00:23:39,150 --> 00:23:41,450 So this is what Marco will speak about next. 269 00:23:43,090 --> 00:23:44,410 Thank you, Adam. 270 00:23:44,470 --> 00:23:47,650 Now let's go over software layers that form this foundation. 271 00:23:48,670 --> 00:24:01,290 So our partition design draws inspiration from multiple independent levels of security and safety, or MILS architecture that's common in higher assurance systems, like in defense and avionics industries. 272 00:24:01,730 --> 00:24:20,210 So again, partitions are isolated execution environments defined by manifesting partition policies, which are signed encrypted static configuration sets that have fine-grained configurations for hardware access control primitives we have. 273 00:24:20,670 --> 00:24:33,490 So essentially, bootrom first parses manifest and then configures the hardware such that it limits capabilities and the maximum privilege for the rest of the software that comes on that core. 274 00:24:34,030 --> 00:24:43,470 And partition policies are parsed by separation kernel, which then further configures hardware and thereby defines a partition where application software runs. 275 00:24:43,470 --> 00:24:53,530 Important thing to note here is that manifest and policies are signed separately from partition images, so nothing done within partitions would affect policy configuration. 276 00:24:54,830 --> 00:25:03,090 So at any given time, only one partition is active per core, and all the information flow in and out partitions is access controlled via policies. 277 00:25:04,090 --> 00:25:08,710 So the separation kernel is that software component that creates and manages partitions. 278 00:25:09,150 --> 00:25:20,330 It is not a hypervisor, so it only controls what hardware is exposed to partitions, it does not obstruct any hardware, nor provides any high-level functionalities for partition software. 279 00:25:20,750 --> 00:25:33,730 During a partition switch, separation kernel would clear out the previous partition state, then parse the target partition policy, reconfigure the hardware, and then transfer execution to that target partition. 280 00:25:34,090 --> 00:25:41,710 From separation kernel's perspective, scheduling is simple, it's cooperative, but different scheduling policies can be built on top. 281 00:25:41,710 --> 00:25:50,970 And there are mechanisms to detect when a partition is stuck, preempt it, and then transfer execution to a predefined fallback partition. 282 00:25:51,610 --> 00:26:00,150 This kernel is small in size, it is written in ATA Spark programming language , and it is formally verified to be free of runtime errors. 283 00:26:01,370 --> 00:26:10,370 But before separation kernel, we have the bootstrap, which is immutable in hardware, embedded in hardware, and also written in Spark language. 284 00:26:10,750 --> 00:26:15,890 Because of its nature and importance, we added specific extensions to further secure its execution. 285 00:26:16,330 --> 00:26:26,470 For example, the ROM protection here means that the ROM is split into sections, such that after each phase of bootstrap execution, hardware will disable the previous state, previous section. 286 00:26:26,470 --> 00:26:30,490 So even if you somehow manage to get the core to jump back, it won't work. 287 00:26:30,670 --> 00:26:34,090 And we have execute-only memory, so the code cannot be dumped out. 288 00:26:34,870 --> 00:26:39,790 All functions are leaf functions, so there is no return address, bill, and stack. 289 00:26:40,270 --> 00:26:47,500 And during the core software execution, the core is in lockdown state, so all external access is disabled. 290 00:26:48,930 --> 00:27:03,550 We have multiple glitch attack mitigations in hardware, but what I added here is a reference to Adam's talk, where they explain details of a flaw they found in RISC-V ISA itself that makes glitch attacks more successful. 291 00:27:04,730 --> 00:27:10,050 And as I said before, depending on what microcontroller does, some cores may be in DCLS mode. 292 00:27:10,050 --> 00:27:15,570 Essentially this means that there is another core that's in lock step with the main core just delayed by a few cycles. 293 00:27:15,810 --> 00:27:21,610 So if there is a mismatch between the execution, it means something off is going on and it will be detected. 294 00:27:21,970 --> 00:27:27,230 This is added for safety, but it also makes glitch attacks less successful. 295 00:27:27,870 --> 00:27:28,490 Harder. 296 00:27:29,590 --> 00:27:32,190 Okay, now let's talk about language-based security a bit. 297 00:27:32,190 --> 00:27:34,850 As I mentioned Spark multiple times now. 298 00:27:35,530 --> 00:27:44,090 So traditionally we rely on tests to show program's correctness, or to point that there is a security vulnerability somewhere in the code. 299 00:27:44,130 --> 00:27:51,750 And this is good, but there are no guarantees that you won't have a single overflow in a large C code base, for example. 300 00:27:51,970 --> 00:27:56,970 But with Spark we can prove that whole classes of vulnerabilities will not ever happen. 301 00:27:57,350 --> 00:28:06,150 And we do that through contract-based programming, and due to the fact that the Spark is very strict subset of Ada language with formally defined specification. 302 00:28:07,730 --> 00:28:12,510 So here I have one simple procedure in pre- and post-condition contracts. 303 00:28:12,510 --> 00:28:13,970 And this is the implementation. 304 00:28:14,510 --> 00:28:19,210 So with Spark we can prove that this implementation is correct given the contracts. 305 00:28:19,990 --> 00:28:27,330 And this is done through this high-level pipeline that involves multiple steps and some fancy tools like SMT solvers. 306 00:28:27,910 --> 00:28:46,410 But the beauty with Spark nowadays, and the tools we have available with it, is that we can abstract all that complexity with pruning away, and use Spark and its tools to get to a formally verified implementation without knowing the intrinsics of the SMT solvers or the underlying mathematics of it. 307 00:28:46,910 --> 00:28:50,150 So the pipeline would actually look more like this. 308 00:28:50,230 --> 00:29:05,910 So all that complexity with pruning is let's say hidden under this tool called Gnat prove, which you would use through this iterative process and if some property cannot be proven, Gnat prove would give you counter examples of why something doesn't hold. 309 00:29:05,910 --> 00:29:12,510 And then you would go back, change specification, implementation, or even the contracts, and do it again. 310 00:29:13,670 --> 00:29:19,610 But most likely you won't be able to implement 100% everything you want with just Spark. 311 00:29:19,610 --> 00:29:23,470 So you would need to make calls into A to C or assembly. 312 00:29:23,630 --> 00:29:27,170 In this case, you would test for what you cannot prove. 313 00:29:27,170 --> 00:29:37,190 Essentially, if you make a call into C, your preconditions should be tested because non-Spark code is invisible to Spark and its tools. 314 00:29:37,350 --> 00:29:48,430 And you should make sure that there are no side effects to that non-Spark call or at least assert and test for expectations that the Spark environment has for those. 315 00:29:50,430 --> 00:29:56,910 Now you may be wondering why you can't do all this with C, Ada, or Rust, for example. 316 00:29:57,030 --> 00:30:00,730 And what follows is my modified section of a talk. 317 00:30:00,730 --> 00:30:08,730 I saw ones that I really liked that explains the fundamental difference between the languages and why we can use Spark to do all this. 318 00:30:09,530 --> 00:30:16,910 So let's say this is a finite machine state set of a given machine, so all possible combinations of memory, registers, everything. 319 00:30:17,670 --> 00:30:23,210 And this would be a subset of that machine state set that is attainable through a programming language. 320 00:30:24,590 --> 00:30:31,510 And the green box here would be machine states that fall under correct execution of your program, so the thing that you want to build. 321 00:30:32,150 --> 00:30:33,970 And C is the most powerful language. 322 00:30:33,970 --> 00:30:41,670 It tends to extend its state set that it can attain, while Ada, Rust, and other languages are more strict, so they have a reduced state set. 323 00:30:42,470 --> 00:30:52,650 But Spark is a very strict subset of Ada programming language with no ambiguities, with no undefined behavior, with formally defined specification. 324 00:30:52,970 --> 00:31:02,830 And this is the main reason why you can rely on Spark, build on top, use the tools I mentioned, and get to a formally verified implementation for something. 325 00:31:03,770 --> 00:31:15,870 Again, most likely you would need to use these escapes, as I call them, to a non-Spark world and make calls into C, Ada, or Assembly, in which case you'll fall back to testing and test for what you cannot prove. 326 00:31:16,170 --> 00:31:25,110 So the main point here is to minimize usage of those and to keep them very small so that you can rely on testing and manual verification. 327 00:31:25,590 --> 00:31:42,990 But if you have most of your code in Spark, or let's say some sub-components 100% written in Spark, having this guarantee that there will be no runtime exceptions at any given time for any given input is extremely valuable for both security and reliability perspectives. 328 00:31:44,470 --> 00:31:56,610 So coming back to the original architecture diagram, this multi-partition architecture is our foundation for running mixed criticality applications on a single MVRIS5 microcontroller. 329 00:31:56,670 --> 00:32:08,880 This isolation between partitions is done through hardware access control primitives that are only configurable by core software that is formally verified to be free of runtime errors. 330 00:32:09,550 --> 00:32:14,490 The AORT, or absence of runtime errors, is a common term used for this. 331 00:32:15,930 --> 00:32:23,870 Now there are certain attack vectors that you can't really defend against via language only, and side channels would kind of be the obvious ones. 332 00:32:23,870 --> 00:32:28,110 So we designed our hardware and configured it such that we mitigate against those. 333 00:32:28,830 --> 00:32:43,170 Although, theoretically, it is possible that you model all the bits of the hardware, so all the branch predictors and caches, and model that in software and then use that model to prove that your software mitigates against these. 334 00:32:43,490 --> 00:32:53,990 But this is extremely complex and a much more practical approach would be to combine software techniques with proper hardware configuration to mitigate against these kind of attacks. 335 00:32:56,110 --> 00:33:11,870 I was thinking about top five takeaways for all this journey of ours, and I would say if you have a chance to design something from ground up or redesign something, first you should think holistically and start a design from both top down and bottom up. 336 00:33:12,090 --> 00:33:20,610 So things like confidential compute and virtualization introduced requirements we had to consider from the very beginning when we started building this foundation. 337 00:33:21,790 --> 00:33:30,830 I do understand that not everyone is in a position to do hardware-software co-design, but when building a large ecosystem, a hardware-software co-design is a must. 338 00:33:31,950 --> 00:33:40,290 Being just different does not imply innovation, so standards are good, and it does pay off when standards are followed, so innovate when you must. 339 00:33:40,290 --> 00:33:43,730 And we saw how memory safety is a harder problem as well. 340 00:33:43,990 --> 00:33:50,330 But ultimately there are no silver bullets in security, and defense in depth remains the most reliable guiding principle. 341 00:33:50,730 --> 00:33:54,510 And now over to Adam, and he's going to close with some lessons learned. 342 00:33:56,470 --> 00:33:58,770 So yes, what are the lessons learned? 343 00:33:58,770 --> 00:34:02,330 So actually, hardware extensions are not enough, yes? 344 00:34:02,510 --> 00:34:06,370 The biggest attack surface is still actually a software, as we discussed at the beginning. 345 00:34:06,370 --> 00:34:17,410 So we must co-design hardware and software to be able to create a secure execution environment, and some hardware extensions that we discussed actually help doing that. 346 00:34:17,410 --> 00:34:24,110 But that's not enough, because even in the bound of the hardware limitations, software can still misbehave, and there's some room for the playground. 347 00:34:24,110 --> 00:34:27,370 So that's why it's so important to co-design and software and the hardware. 348 00:34:27,370 --> 00:34:29,670 There's no silver bullet in just one layer. 349 00:34:29,870 --> 00:34:34,090 Also, formally verified language like Spark or memory-safe language like Rust, they are great. 350 00:34:34,090 --> 00:34:35,070 They're awesome. 351 00:34:35,230 --> 00:34:40,310 And they have significant security return of the investments, but costs are actually substantial. 352 00:34:40,310 --> 00:34:41,650 It's not cheap, yes? 353 00:34:41,650 --> 00:34:57,550 So it's very likely we are going to live in the hybrid world for a while, because either we cannot afford to rewrite the software in the more secure language, or maybe we must rely on the third-party library, which we do not control, and they're just not going to be rewritten at all. 354 00:34:57,550 --> 00:34:58,590 We just don't know. 355 00:34:58,590 --> 00:35:02,470 So it's very likely it's going to be a hybrid world for a while. 356 00:35:02,470 --> 00:35:06,150 And also, it's worth to keep in mind there is also non-memory safety issues. 357 00:35:06,150 --> 00:35:08,690 Any type of the language, yes? 358 00:35:08,830 --> 00:35:15,730 And we actually make a talk about the bugs on the formally verified Spark language on DEF CON 30, so we recommend to watch on this. 359 00:35:16,030 --> 00:35:18,850 And I think this is the most important bullet from the entire talk. 360 00:35:18,950 --> 00:35:22,230 So actually, how to create innovative ecosystem? 361 00:35:22,310 --> 00:35:27,970 You actually need to have, it's a demand, you must have a forward-thinking mindset. 362 00:35:28,190 --> 00:35:32,070 At first, you don't know how you're going to evolve, so you must be flexible. 363 00:35:32,110 --> 00:35:43,450 You must be flexible enough to be able to have an opportunity to evolve your, to have an evolution of your hardware and the software in the way that you might not even know from the beginning. 364 00:35:43,710 --> 00:35:48,850 But you must be flexible enough to be able to have such kind of primitive to be flexible, yes? 365 00:35:48,850 --> 00:35:50,190 And also, how to do it? 366 00:35:50,190 --> 00:35:55,230 You must kind of predict the industry trends, some kind of informed prediction of the industry trends. 367 00:35:55,230 --> 00:35:56,250 How to do that? 368 00:35:56,250 --> 00:36:07,590 You must be part of the various initiatives and organizations, because this, actually, see where the entire industry is moving, and you can have informal prediction of where it's going to move anyway. 369 00:36:07,710 --> 00:36:14,110 And sometimes, you know, it's not obvious, but you can read them from the air on this type of discussion in the organization. 370 00:36:14,290 --> 00:36:20,650 And also, scalability, flexibility, reliability, performance, and security must be taken collectively, not separately. 371 00:36:20,650 --> 00:36:32,550 It's very tempted to be able to optimize, for example, reliability on the cost of the security, but then you will lose the flexibility of your ecosystem, which means you may or may not adopt the future threats, which can arise and you don't know. 372 00:36:32,870 --> 00:36:41,530 And also, we believe that hybrid attacks, not just pure software attack, not just pure hardware attack, are going to be on the rise, and they're still rising now. 373 00:36:41,770 --> 00:36:51,270 We see the attacks like RawHammer, side-channel attacks, or even the bugs in the ISA, which Marco referenced, those type of attacks, neither hardware, neither software, it's between. 374 00:36:51,270 --> 00:36:55,190 They are hybrid attacks, and we believe they are going to be on the rise. 375 00:36:55,330 --> 00:36:57,030 So that's it what we have today. 376 00:36:57,030 --> 00:36:59,270 If we have any questions, we are happy to answer. 377 00:36:59,290 --> 00:36:59,690 Thank you very much.