start	end	text
640	1780	Hello everyone.
1780	9820	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.
10120	20800	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.
20860	25100	However, are we even the right people to speak about such an important topic?
25100	27660	I don't want to spend too much time here, but here we are.
27660	30960	Currently, I'm working in NVIDIA as a Director of Offensive Security.
30960	37480	My name is Adam Zabrocki, and I'm leading various offensive security research efforts across the entire company.
37480	46460	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.
46560	50580	And I'm also security architect of the GPU and next generation NVIDIA product.
50580	59020	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.
59300	62540	And he also GPU product security and RISC officer and lead.
63000	67900	So the most important question, I think, is why we even have this talk today.
68040	73060	So NVIDIA is known from their data platform product, who looks like this.
73060	74380	You can see on the screen.
74420	77300	And this is not just a specific product.
77300	78200	It's a platform.
78200	82700	It's an entire platform who handles very complicated workloads, including AI workloads.
82700	84100	This is the most known.
84120	85860	And it's a huge machine.
85860	88120	But that's not the only product which NVIDIA has.
88120	100500	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.
100500	103400	But we also have traditional GPUs who looks like this.
103400	106580	The one which is on the left, it's actually consumer GPU.
106580	112180	But on the right, it's actually also server type GPU, which is different computer architecture.
112260	114400	Then we also have other products like that.
114540	119400	We have system on the chips like Tegra, which is used in various products.
119400	122320	We also have upcoming NVIDIA Digits and Spark.
122400	126400	But what is important, even all of those products has completely different features.
126400	127960	They look even completely different.
127960	129820	They have completely different functionality.
129820	131640	They have different security expectations.
131640	133240	They have different threat model.
133240	138800	On their core, on their heart, they're still running only one specific NVIDIA processor.
139120	146340	So even they have completely different security warranties, they still are based on the ecosystem, which is NVIDIA processor.
146360	154320	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.
154640	163480	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.
163480	168760	There's various level microcontrollers like functional level controllers, like memory controllers, chip-to-chip interface.
168760	173400	There is chip-system level controllers like RM, like PMU, like security and more.
173400	174900	There is also data processing.
174900	183520	And what is important that in the past, all of those microcontrollers were actually designed and run on the internal proprietary skies across Falcon.
183560	191200	However, our demand of grow and our demand of adaptability was much, much faster than Falcon could actually keep up.
191200	193920	The legacy architecture couldn't keep up.
193920	200200	So we have different trajectory of the grow, and it was very difficult to scale on the Falcon architecture.
200500	205840	So it was sufficient at the time when we used it, but requirements and expectation changed.
205840	213920	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?
214220	222920	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.
222920	233840	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.
234040	247200	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.
247340	249580	And we decided to do this on the RISC-V.
249580	251000	Why did we choose RISC-V?
251000	252380	Mark will speak to you more about.
252920	255640	Thank you, Adam.
255640	256320	Hello, everyone.
256320	257920	I'm really happy to be here.
257940	261320	So let me continue with answering why did we choose RISC-V.
261420	268520	So first, we wanted to retire our proprietary Falcon architecture and move towards an open and more future-proof foundation.
269180	278800	The RISC-V offered better baseline performance without legacy overhead, and its flexibility enabled rapid hardware-software co-design through custom extensions.
279100	283800	But the layered security isolation primitives were the key factor here.
284100	289120	So essentially, we wanted to build a strong isolation model as strong as physically separate controllers.
289560	295240	We did not want to keep adding new standalone controllers whenever we wanted stronger isolation for something.
295800	301200	So we needed a common configurable platform for all microcontrollers across all products.
301420	307380	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.
307380	310560	And RISC-V met all our requirements.
312000	315360	This shows the rate of adoption of RISC-V at NVIDIA.
315380	322560	So naturally, with more applications we run on controllers, we have more cores in each of the products.
323020	334800	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.
335140	343680	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.
345480	352160	So there are many aspects to forming a secure execution, and this list here is by no means an exhaustive one.
352300	356560	What I highlighted are just items that our talk will be touching on today.
357720	363840	And now let's go briefly over some RISC-V basics as it's important to follow what's coming.
363920	369060	So most commonly RISC-V has three privilege modes, machine mode, supervisor mode, and user mode.
369060	374060	And there is also this HS mode, or HS mode when hypervisor extension is present.
375040	382400	Each privilege mode has its own set of CSR registers, and there are multiple access control primitives that are configurable per privilege level.
384500	391020	PMP and IOPMP are the most fundamental isolation primitives, isolation units.
391020	399600	So PMP, physical memory protection, this is what restricts code running at different privilege levels from accessing certain memory regions.
399600	404040	And IOPMP would be pretty much the same thing, just for peripheral devices.
404040	409820	So essentially it restricts devices like DMA or crypto to access some memory ranges.
410240	416440	And from processor's perspective, IOPMP is used to restrict access to devices' control registers.
417200	427010	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.
428400	433950	And apart from memory protection, it also does virtual to physical address translation.
435660	439700	So NVRISC-V would be NVIDIA's implementation of the RISC-V ISA.
439700	444640	It is highly configurable, and it has several NVIDIA custom extensions.
444660	452160	I only listed security extensions here, and I believe we'll cover most of them throughout our talk today.
453860	459800	And Peregrine is our hardware subsystem that includes NVRISC-V processor and peripheral devices.
459900	467040	Within Peregrine there may be multiple NVRISC-V cores, and the RISC-V extensions may or may not be present.
467300	471200	We also have certain configurability within the peripheral devices as well.
471840	478160	And depending on what microcontroller does, some cores may be in DCLS mode for safety and security.
479980	484860	So internally we describe this Peregrine ecosystem as one core strategy.
484860	491580	Essentially having one foundational hardware software architecture for all microcontrollers across all products.
491600	498040	This way, investments we make in these foundational elements, everything benefits from these investments.
498880	507120	So on a given microcontroller, execution starts in immutable bootrom, or boot plugin if bootrom is not present.
507220	513640	And then we have separation kernel software which creates and manages these isolated execution environments we call partitions.
514220	520700	And partitions are where all the application software runs, where all the use cases are implemented.
520900	527480	And this partition architecture is our foundation for running mixed criticality applications on a single NVRISC-V controller.
527480	532560	And at the same time, that's also a foundation for our GPU software security.
533320	540100	So because majority of applications, majority of software runs within partitions, it's very important to secure that execution environment.
540140	544860	And this is what Adam is going to talk about next, and I'll come back to dive deeper into core software elements.
547730	548890	Thanks, Marko.
548950	553730	So yes, as Marko mentioned, the Peregrine ecosystem is actually much more than RISC-V, yes?
553730	561730	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.
561930	565890	And it's architecture flexibility which RISC-V gave us is awesome, yes?
565890	575070	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.
575070	581990	So open source and flexibility, despite their undeniable advantages, they are actually some caveats that you need to take into account.
581990	583590	Like, for example, fragmentation.
583670	586070	What actually is implemented in the hardware?
586070	587350	What software can expect?
587370	590230	Specific optional extension exist or not?
590230	592250	Is this specific functionality exist or not?
592250	594950	How do I run securely on that specific hardware?
594950	598510	Does this even include the hardware functionality which software expects?
598510	601230	We don't know, because it's optional or mandatory.
601250	613130	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.
613130	615730	Some extensions are mandatory or optional.
615730	628710	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.
628710	635070	And the remediation is that RISC-V partners are trying to close that gap and fulfill that gap.
635070	643030	And there is also, whenever we work on the new extension functionality for the RISC-V, they also provide software support for those.
643030	652210	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.
652210	658650	However, speaking about the profiles, they are great at addressing the fragmentation, but there are still some caveats there.
658650	660710	They may not always be mutually compatible.
660710	664190	For example, RVA is not compatible with profile RVB.
664450	670150	Also, even RVA profile does the best job to be backward compatible, still there are some caveats.
670150	674530	For example, profile RVA22 has vector extension as optional.
674530	679090	However, RVA23 mandates vector extension, so there are still some caveats.
679190	685710	And also, custom extension must be actually costly, and so we always say, please contribute to the RISC-V.
685710	692150	Because maybe you have a problem that nobody else had at that time, and you design your own custom hardware solution for those, yes?
692290	701250	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.
701250	706690	Then you will find out yourself that your custom extension might be incompatible with the official ratified one, yes?
706690	709330	So please contribute to the RISC-V to avoid this problem.
709330	714730	And also, new extension may actually solve your problem in the better or maybe not way, so contribute to RISC-V.
714750	718690	And also, if you have custom hardware, it means you also must have custom software support.
718690	720490	Nobody else is going to do it for you.
720490	724930	So it's better just to contribute to RISC-V and make this ecosystem grow together.
725690	731170	So also speaking about the Peregrine, as Marco mentioned, Peregrine is much, much more than just RISC-V.
731170	743370	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.
743370	745870	In our implementation, which is NVIDIA RISC-V.
745870	748750	So how do we secure this new execution environment?
748750	750930	At first, we wanted to learn from the past, yes?
750930	752830	We don't want to repeat some mistakes.
752830	763270	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.
763470	765090	But it's still not free.
765090	767590	You still need to pay cost of having ASLR.
767610	778910	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.
778910	780710	It's more efficient from the security perspective.
780710	784630	Instead of buying these resources for something which, you know, would have a limited value.
784630	787710	Also, Peregrine, it's not the only one ecosystem there.
787710	789330	There is other Peregrines in the die.
789330	793050	As I mentioned, there could be between 10 to 50 Peregrines on the one core.
793150	797530	Some Peregrines have different security levels, some have different threat models, some have different warranties.
797530	800050	We need to take this into account when we design the ecosystem.
800050	805290	Also, how do we communicate between this ecosystem or between these different privilege level Peregrines?
805290	808110	We must have a complicated software and firmware.
808110	812390	So we found out that still the software is the biggest attack surface for us.
812430	815950	So how to actually effectively find the software vulnerabilities?
816270	826010	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.
826010	829730	But actually, that's not sufficient because it's neither scalable solution, yes?
829730	831530	We cannot just rely on those.
831530	833850	It's something which we must have, but it's not enough.
834150	840150	So we obviously need to have also automatic vulnerability detection because it's a crucial piece to automate some of the processes.
840150	841710	So fuzzing can help here.
841770	843990	And how to increase the effectiveness of the fuzzing?
843990	848670	Obviously, we need to have some other sanitizer and code coverage driver instrumentation.
848670	850210	That can help, yes?
850210	854090	The problem is that RISC-V did not support that at that time.
854250	861070	So what we've done, we've actually proactively modified the compilers to be able to bring other sanitizer to RISC-V ecosystem.
861070	867150	Over the time, also software community pick it up and now everybody can use other sanitizer on the RISC-V.
867150	873690	However, when we're starting to use it, we realize it's still not fast enough for our ecosystem because it's very complicated.
873690	877490	So we needed to have hardware support for the better fuzzing and automation.
877510	880930	So that's how I created pointer masking extension for the RISC-V.
881090	888790	And the main goal for this is aim to add hardware support and memory tagging later to RISC-V ecosystem, especially to our ones.
888790	890710	But our ecosystem is unique.
890710	895410	So among standard use case like S and U mode, we also have unusual use case.
895410	896970	We need to support M mode.
896970	900330	We need to support bar metal code for fuzzing microcode, yes?
900330	903270	We also needed to support with and without OS layer.
903370	912670	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.
912670	917350	However, when I've done that, I realized and I met other folks working on the similar problems.
917350	924310	It turns out that independently people from the Google were also working on the somehow similar pointer masking solution.
924310	934490	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?
934690	937710	So that's how pointer masking extension was created.
937710	945370	And at first, the main principle of pointer masking is to serve as a framework for any feature who requires masking the pointers.
945370	946930	And there's various more use case.
946930	949730	They could be hardware agent and member tagging like we wanted.
949750	951290	They could be pointer authentication code.
951290	952930	They could be hardware memory sandbox.
953030	960830	Like you can see the visualization on the right side, top right slide, because it allows you to create in-process memory sandbox.
960930	973810	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.
973810	975430	And we actually achieved that.
975490	983230	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.
983230	988970	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.
988970	994970	So some of the profiles actually mandate pointer masking to be implemented in the hardware and other profiles make them optional.
995110	1000050	And in total, we spent more than four years of work to be able to introduce pointer masking.
1000090	1002010	And it's actually not one extension.
1002010	1005470	It's umbrella for five different extension, which is split per privilege level.
1005470	1013890	And also there is additionally two virtual kind of extension that only describe execution environment, but they have no bearing in the hardware implementation.
1013890	1018270	Just mandate that you must have support of pointer masking in the U mode or S mode.
1018270	1020170	And there is some method to be able to enable that.
1020170	1025510	We also obviously create software ecosystem support for hardware ASAN which is listed here.
1025510	1032830	And internally, when we actually finish all of those work, we added the software support for our customer ecosystem.
1032930	1038170	So as of today, we actually run the GSP firmware with the hardware ASAN.
1038170	1043710	And we're also running as of today resource manager microcode also with the hardware ASAN.
1043710	1050030	And we're also working to enable hardware ASAN on the bar metal files in microcode as well as the firmware under RTOS.
1050530	1056860	So there is more people involved in and that's the list and kudos to everybody who are involved in this great research.
1057690	1064510	Another extension which we believe makes sense, it's very effective from the security perspective, is actually hardware control flow integrity.
1064510	1066730	Not software CFI, but hardware CFI.
1066730	1074230	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.
1074230	1076610	But this is some visualization on the right slide.
1076610	1084670	However, CFI protects against code reuse attacks, protects against return to rip-seal, protects against the ROP, drop, and this type of attacks.
1084910	1089050	And CFI is actually a sub... it's a two extension.
1089050	1091350	There's two sub-extensions inside of the CFI.
1091350	1100630	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.
1100630	1103790	It's visualized on the right side of the slide.
1103790	1110250	And it also preserves original stack ABI, and we introduce new register and also new instruction for shadow stack management.
1110490	1117830	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.
1117830	1121470	And the shadow stack region is protected by the hardware, so attacker doesn't have access to it.
1121470	1125030	So then you cannot actually overwrite the copy of the return address.
1125050	1131830	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.
1131830	1138510	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.
1138510	1151750	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.
1151750	1155130	And it's much more effective than stack cookies, so why keeping both?
1155490	1171010	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.
1171010	1171790	It's a new instruction.
1171790	1175710	However, this new instruction additionally encodes 20-bit label.
1176390	1182470	And whenever we have enforcements of the landing pad, then any indirect branch must always land in the landing pad.
1182470	1186050	Additionally, this landing pad must always have correct hash.
1186050	1188530	It can't be just random landing pads.
1188530	1189990	It must be specific hash.
1189990	1200910	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.
1200910	1205850	So as today, we believe the RISC-V hardware CFI is the strongest CFI ISA implementation.
1206430	1213130	And again, we also are working with the RISC-V profiles and RISC-V international to include CFI profile.
1213310	1217390	And actually, hardware CFI is mandated to some profile and optional to another one.
1217390	1219750	We also have software ecosystem support for those.
1219750	1226450	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.
1227490	1233390	And again, there's more people involved in the CFI than just us and other folks.
1233390	1240030	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.
1240270	1241290	And also, what's next?
1241290	1242310	What we are planning to?
1242310	1246490	Obviously, memory tagging, because this was the main idea also behind the point I'm asking, yes?
1246490	1250150	It addresses the performance issue, which you can still have with the hardware ASIN.
1250150	1256390	And additionally, memory tagging is targeting to be enabled in the production binaries.
1256710	1266510	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.
1266510	1276290	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.
1276690	1285590	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.
1285590	1291930	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.
1291930	1294830	If the tag matches, it means you're inbound of access.
1294830	1299470	Otherwise, the hardware will detect that you're touching different tag, different color, and tries the exception.
1299570	1310470	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.
1310470	1314710	But what is important, it's detected before corruption happens.
1314710	1316730	Most of the mitigation detects post-corruption.
1316730	1317910	This is before corruption.
1317910	1324970	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.
1324970	1337830	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.
1337830	1344390	So we want to extend ShadowStack to the M mode as well, using PMP to be able to protect also critical M mode software.
1344510	1354770	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.
1354770	1356390	We are interested on that feature as well.
1356390	1362850	There's no TG yet, but we are evaluating the benefits of bringing such sandbox to our software ecosystem.
1363030	1364370	So how it works?
1364370	1369050	In principle, HFI introduced something like user mode concept of memory region.
1369050	1372830	Doesn't need to be on the user mode, but it can be enabled also in the user mode.
1372830	1376510	It's similar to concept of x86 segmentation.
1376830	1381370	So any access outside of this region, predefined region, will generate a hardware trap.
1381370	1397250	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.
1397290	1398930	And it's enforced by the hardware.
1399350	1405550	And there's another interest of interest for us, which is post-quantum cryptography, PQC.
1405550	1408070	We also evaluate side channel protection hardening.
1408070	1414810	We're also looking in the cherry, and we're also looking on the enhanced hardware fault injection protection.
1414870	1417890	So what I was speaking about, it's a hardware foundation security.
1417890	1419150	What about the software?
1419150	1421450	So this is what Marco will speak about next.
1423090	1424410	Thank you, Adam.
1424470	1427650	Now let's go over software layers that form this foundation.
1428670	1441290	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.
1441730	1460210	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.
1460670	1473490	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.
1474030	1483470	And partition policies are parsed by separation kernel, which then further configures hardware and thereby defines a partition where application software runs.
1483470	1493530	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.
1494830	1503090	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.
1504090	1508710	So the separation kernel is that software component that creates and manages partitions.
1509150	1520330	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.
1520750	1533730	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.
1534090	1541710	From separation kernel's perspective, scheduling is simple, it's cooperative, but different scheduling policies can be built on top.
1541710	1550970	And there are mechanisms to detect when a partition is stuck, preempt it, and then transfer execution to a predefined fallback partition.
1551610	1560150	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.
1561370	1570370	But before separation kernel, we have the bootstrap, which is immutable in hardware, embedded in hardware, and also written in Spark language.
1570750	1575890	Because of its nature and importance, we added specific extensions to further secure its execution.
1576330	1586470	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.
1586470	1590490	So even if you somehow manage to get the core to jump back, it won't work.
1590670	1594090	And we have execute-only memory, so the code cannot be dumped out.
1594870	1599790	All functions are leaf functions, so there is no return address, bill, and stack.
1600270	1607500	And during the core software execution, the core is in lockdown state, so all external access is disabled.
1608930	1623550	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.
1624730	1630050	And as I said before, depending on what microcontroller does, some cores may be in DCLS mode.
1630050	1635570	Essentially this means that there is another core that's in lock step with the main core just delayed by a few cycles.
1635810	1641610	So if there is a mismatch between the execution, it means something off is going on and it will be detected.
1641970	1647230	This is added for safety, but it also makes glitch attacks less successful.
1647870	1648490	Harder.
1649590	1652190	Okay, now let's talk about language-based security a bit.
1652190	1654850	As I mentioned Spark multiple times now.
1655530	1664090	So traditionally we rely on tests to show program's correctness, or to point that there is a security vulnerability somewhere in the code.
1664130	1671750	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.
1671970	1676970	But with Spark we can prove that whole classes of vulnerabilities will not ever happen.
1677350	1686150	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.
1687730	1692510	So here I have one simple procedure in pre- and post-condition contracts.
1692510	1693970	And this is the implementation.
1694510	1699210	So with Spark we can prove that this implementation is correct given the contracts.
1699990	1707330	And this is done through this high-level pipeline that involves multiple steps and some fancy tools like SMT solvers.
1707910	1726410	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.
1726910	1730150	So the pipeline would actually look more like this.
1730230	1745910	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.
1745910	1752510	And then you would go back, change specification, implementation, or even the contracts, and do it again.
1753670	1759610	But most likely you won't be able to implement 100% everything you want with just Spark.
1759610	1763470	So you would need to make calls into A to C or assembly.
1763630	1767170	In this case, you would test for what you cannot prove.
1767170	1777190	Essentially, if you make a call into C, your preconditions should be tested because non-Spark code is invisible to Spark and its tools.
1777350	1788430	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.
1790430	1796910	Now you may be wondering why you can't do all this with C, Ada, or Rust, for example.
1797030	1800730	And what follows is my modified section of a talk.
1800730	1808730	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.
1809530	1816910	So let's say this is a finite machine state set of a given machine, so all possible combinations of memory, registers, everything.
1817670	1823210	And this would be a subset of that machine state set that is attainable through a programming language.
1824590	1831510	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.
1832150	1833970	And C is the most powerful language.
1833970	1841670	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.
1842470	1852650	But Spark is a very strict subset of Ada programming language with no ambiguities, with no undefined behavior, with formally defined specification.
1852970	1862830	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.
1863770	1875870	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.
1876170	1885110	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.
1885590	1902990	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.
1904470	1916610	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.
1916670	1928880	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.
1929550	1934490	The AORT, or absence of runtime errors, is a common term used for this.
1935930	1943870	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.
1943870	1948110	So we designed our hardware and configured it such that we mitigate against those.
1948830	1963170	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.
1963490	1973990	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.
1976110	1991870	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.
1992090	2000610	So things like confidential compute and virtualization introduced requirements we had to consider from the very beginning when we started building this foundation.
2001790	2010830	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.
2011950	2020290	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.
2020290	2023730	And we saw how memory safety is a harder problem as well.
2023990	2030330	But ultimately there are no silver bullets in security, and defense in depth remains the most reliable guiding principle.
2030730	2034510	And now over to Adam, and he's going to close with some lessons learned.
2036470	2038770	So yes, what are the lessons learned?
2038770	2042330	So actually, hardware extensions are not enough, yes?
2042510	2046370	The biggest attack surface is still actually a software, as we discussed at the beginning.
2046370	2057410	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.
2057410	2064110	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.
2064110	2067370	So that's why it's so important to co-design and software and the hardware.
2067370	2069670	There's no silver bullet in just one layer.
2069870	2074090	Also, formally verified language like Spark or memory-safe language like Rust, they are great.
2074090	2075070	They're awesome.
2075230	2080310	And they have significant security return of the investments, but costs are actually substantial.
2080310	2081650	It's not cheap, yes?
2081650	2097550	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.
2097550	2098590	We just don't know.
2098590	2102470	So it's very likely it's going to be a hybrid world for a while.
2102470	2106150	And also, it's worth to keep in mind there is also non-memory safety issues.
2106150	2108690	Any type of the language, yes?
2108830	2115730	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.
2116030	2118850	And I think this is the most important bullet from the entire talk.
2118950	2122230	So actually, how to create innovative ecosystem?
2122310	2127970	You actually need to have, it's a demand, you must have a forward-thinking mindset.
2128190	2132070	At first, you don't know how you're going to evolve, so you must be flexible.
2132110	2143450	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.
2143710	2148850	But you must be flexible enough to be able to have such kind of primitive to be flexible, yes?
2148850	2150190	And also, how to do it?
2150190	2155230	You must kind of predict the industry trends, some kind of informed prediction of the industry trends.
2155230	2156250	How to do that?
2156250	2167590	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.
2167710	2174110	And sometimes, you know, it's not obvious, but you can read them from the air on this type of discussion in the organization.
2174290	2180650	And also, scalability, flexibility, reliability, performance, and security must be taken collectively, not separately.
2180650	2192550	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.
2192870	2201530	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.
2201770	2211270	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.
2211270	2215190	They are hybrid attacks, and we believe they are going to be on the rise.
2215330	2217030	So that's it what we have today.
2217030	2219270	If we have any questions, we are happy to answer.
2219290	2219690	Thank you very much.
