WEBVTT

00:00.640 --> 00:01.780
Hello everyone.

00:01.780 --> 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.

00:10.120 --> 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.

00:20.860 --> 00:25.100
However, are we even the right people to speak about such an important topic?

00:25.100 --> 00:27.660
I don't want to spend too much time here, but here we are.

00:27.660 --> 00:30.960
Currently, I'm working in NVIDIA as a Director of Offensive Security.

00:30.960 --> 00:37.480
My name is Adam Zabrocki, and I'm leading various offensive security research efforts across the entire company.

00:37.480 --> 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.

00:46.560 --> 00:50.580
And I'm also security architect of the GPU and next generation NVIDIA product.

00:50.580 --> 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.

00:59.300 --> 01:02.540
And he also GPU product security and RISC officer and lead.

01:03.000 --> 01:07.900
So the most important question, I think, is why we even have this talk today.

01:08.040 --> 01:13.060
So NVIDIA is known from their data platform product, who looks like this.

01:13.060 --> 01:14.380
You can see on the screen.

01:14.420 --> 01:17.300
And this is not just a specific product.

01:17.300 --> 01:18.200
It's a platform.

01:18.200 --> 01:22.700
It's an entire platform who handles very complicated workloads, including AI workloads.

01:22.700 --> 01:24.100
This is the most known.

01:24.120 --> 01:25.860
And it's a huge machine.

01:25.860 --> 01:28.120
But that's not the only product which NVIDIA has.

01:28.120 --> 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.

01:40.500 --> 01:43.400
But we also have traditional GPUs who looks like this.

01:43.400 --> 01:46.580
The one which is on the left, it's actually consumer GPU.

01:46.580 --> 01:52.180
But on the right, it's actually also server type GPU, which is different computer architecture.

01:52.260 --> 01:54.400
Then we also have other products like that.

01:54.540 --> 01:59.400
We have system on the chips like Tegra, which is used in various products.

01:59.400 --> 02:02.320
We also have upcoming NVIDIA Digits and Spark.

02:02.400 --> 02:06.400
But what is important, even all of those products has completely different features.

02:06.400 --> 02:07.960
They look even completely different.

02:07.960 --> 02:09.820
They have completely different functionality.

02:09.820 --> 02:11.640
They have different security expectations.

02:11.640 --> 02:13.240
They have different threat model.

02:13.240 --> 02:18.800
On their core, on their heart, they're still running only one specific NVIDIA processor.

02:19.120 --> 02:26.340
So even they have completely different security warranties, they still are based on the ecosystem, which is NVIDIA processor.

02:26.360 --> 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.

02:34.640 --> 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.

02:43.480 --> 02:48.760
There's various level microcontrollers like functional level controllers, like memory controllers, chip-to-chip interface.

02:48.760 --> 02:53.400
There is chip-system level controllers like RM, like PMU, like security and more.

02:53.400 --> 02:54.900
There is also data processing.

02:54.900 --> 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.

03:03.560 --> 03:11.200
However, our demand of grow and our demand of adaptability was much, much faster than Falcon could actually keep up.

03:11.200 --> 03:13.920
The legacy architecture couldn't keep up.

03:13.920 --> 03:20.200
So we have different trajectory of the grow, and it was very difficult to scale on the Falcon architecture.

03:20.500 --> 03:25.840
So it was sufficient at the time when we used it, but requirements and expectation changed.

03:25.840 --> 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?

03:34.220 --> 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.

03:42.920 --> 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.

03:54.040 --> 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.

04:07.340 --> 04:09.580
And we decided to do this on the RISC-V.

04:09.580 --> 04:11.000
Why did we choose RISC-V?

04:11.000 --> 04:12.380
Mark will speak to you more about.

04:12.920 --> 04:15.640
Thank you, Adam.

04:15.640 --> 04:16.320
Hello, everyone.

04:16.320 --> 04:17.920
I'm really happy to be here.

04:17.940 --> 04:21.320
So let me continue with answering why did we choose RISC-V.

04:21.420 --> 04:28.520
So first, we wanted to retire our proprietary Falcon architecture and move towards an open and more future-proof foundation.

04:29.180 --> 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.

04:39.100 --> 04:43.800
But the layered security isolation primitives were the key factor here.

04:44.100 --> 04:49.120
So essentially, we wanted to build a strong isolation model as strong as physically separate controllers.

04:49.560 --> 04:55.240
We did not want to keep adding new standalone controllers whenever we wanted stronger isolation for something.

04:55.800 --> 05:01.200
So we needed a common configurable platform for all microcontrollers across all products.

05:01.420 --> 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.

05:07.380 --> 05:10.560
And RISC-V met all our requirements.

05:12.000 --> 05:15.360
This shows the rate of adoption of RISC-V at NVIDIA.

05:15.380 --> 05:22.560
So naturally, with more applications we run on controllers, we have more cores in each of the products.

05:23.020 --> 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.

05:35.140 --> 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.

05:45.480 --> 05:52.160
So there are many aspects to forming a secure execution, and this list here is by no means an exhaustive one.

05:52.300 --> 05:56.560
What I highlighted are just items that our talk will be touching on today.

05:57.720 --> 06:03.840
And now let's go briefly over some RISC-V basics as it's important to follow what's coming.

06:03.920 --> 06:09.060
So most commonly RISC-V has three privilege modes, machine mode, supervisor mode, and user mode.

06:09.060 --> 06:14.060
And there is also this HS mode, or HS mode when hypervisor extension is present.

06:15.040 --> 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.

06:24.500 --> 06:31.020
PMP and IOPMP are the most fundamental isolation primitives, isolation units.

06:31.020 --> 06:39.600
So PMP, physical memory protection, this is what restricts code running at different privilege levels from accessing certain memory regions.

06:39.600 --> 06:44.040
And IOPMP would be pretty much the same thing, just for peripheral devices.

06:44.040 --> 06:49.820
So essentially it restricts devices like DMA or crypto to access some memory ranges.

06:50.240 --> 06:56.440
And from processor's perspective, IOPMP is used to restrict access to devices' control registers.

06:57.200 --> 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.

07:08.400 --> 07:13.950
And apart from memory protection, it also does virtual to physical address translation.

07:15.660 --> 07:19.700
So NVRISC-V would be NVIDIA's implementation of the RISC-V ISA.

07:19.700 --> 07:24.640
It is highly configurable, and it has several NVIDIA custom extensions.

07:24.660 --> 07:32.160
I only listed security extensions here, and I believe we'll cover most of them throughout our talk today.

07:33.860 --> 07:39.800
And Peregrine is our hardware subsystem that includes NVRISC-V processor and peripheral devices.

07:39.900 --> 07:47.040
Within Peregrine there may be multiple NVRISC-V cores, and the RISC-V extensions may or may not be present.

07:47.300 --> 07:51.200
We also have certain configurability within the peripheral devices as well.

07:51.840 --> 07:58.160
And depending on what microcontroller does, some cores may be in DCLS mode for safety and security.

07:59.980 --> 08:04.860
So internally we describe this Peregrine ecosystem as one core strategy.

08:04.860 --> 08:11.580
Essentially having one foundational hardware software architecture for all microcontrollers across all products.

08:11.600 --> 08:18.040
This way, investments we make in these foundational elements, everything benefits from these investments.

08:18.880 --> 08:27.120
So on a given microcontroller, execution starts in immutable bootrom, or boot plugin if bootrom is not present.

08:27.220 --> 08:33.640
And then we have separation kernel software which creates and manages these isolated execution environments we call partitions.

08:34.220 --> 08:40.700
And partitions are where all the application software runs, where all the use cases are implemented.

08:40.900 --> 08:47.480
And this partition architecture is our foundation for running mixed criticality applications on a single NVRISC-V controller.

08:47.480 --> 08:52.560
And at the same time, that's also a foundation for our GPU software security.

08:53.320 --> 09:00.100
So because majority of applications, majority of software runs within partitions, it's very important to secure that execution environment.

09:00.140 --> 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.

09:07.730 --> 09:08.890
Thanks, Marko.

09:08.950 --> 09:13.730
So yes, as Marko mentioned, the Peregrine ecosystem is actually much more than RISC-V, yes?

09:13.730 --> 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.

09:21.930 --> 09:25.890
And it's architecture flexibility which RISC-V gave us is awesome, yes?

09:25.890 --> 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.

09:35.070 --> 09:41.990
So open source and flexibility, despite their undeniable advantages, they are actually some caveats that you need to take into account.

09:41.990 --> 09:43.590
Like, for example, fragmentation.

09:43.670 --> 09:46.070
What actually is implemented in the hardware?

09:46.070 --> 09:47.350
What software can expect?

09:47.370 --> 09:50.230
Specific optional extension exist or not?

09:50.230 --> 09:52.250
Is this specific functionality exist or not?

09:52.250 --> 09:54.950
How do I run securely on that specific hardware?

09:54.950 --> 09:58.510
Does this even include the hardware functionality which software expects?

09:58.510 --> 10:01.230
We don't know, because it's optional or mandatory.

10:01.250 --> 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.

10:13.130 --> 10:15.730
Some extensions are mandatory or optional.

10:15.730 --> 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.

10:28.710 --> 10:35.070
And the remediation is that RISC-V partners are trying to close that gap and fulfill that gap.

10:35.070 --> 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.

10:43.030 --> 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.

10:52.210 --> 10:58.650
However, speaking about the profiles, they are great at addressing the fragmentation, but there are still some caveats there.

10:58.650 --> 11:00.710
They may not always be mutually compatible.

11:00.710 --> 11:04.190
For example, RVA is not compatible with profile RVB.

11:04.450 --> 11:10.150
Also, even RVA profile does the best job to be backward compatible, still there are some caveats.

11:10.150 --> 11:14.530
For example, profile RVA22 has vector extension as optional.

11:14.530 --> 11:19.090
However, RVA23 mandates vector extension, so there are still some caveats.

11:19.190 --> 11:25.710
And also, custom extension must be actually costly, and so we always say, please contribute to the RISC-V.

11:25.710 --> 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?

11:32.290 --> 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.

11:41.250 --> 11:46.690
Then you will find out yourself that your custom extension might be incompatible with the official ratified one, yes?

11:46.690 --> 11:49.330
So please contribute to the RISC-V to avoid this problem.

11:49.330 --> 11:54.730
And also, new extension may actually solve your problem in the better or maybe not way, so contribute to RISC-V.

11:54.750 --> 11:58.690
And also, if you have custom hardware, it means you also must have custom software support.

11:58.690 --> 12:00.490
Nobody else is going to do it for you.

12:00.490 --> 12:04.930
So it's better just to contribute to RISC-V and make this ecosystem grow together.

12:05.690 --> 12:11.170
So also speaking about the Peregrine, as Marco mentioned, Peregrine is much, much more than just RISC-V.

12:11.170 --> 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.

12:23.370 --> 12:25.870
In our implementation, which is NVIDIA RISC-V.

12:25.870 --> 12:28.750
So how do we secure this new execution environment?

12:28.750 --> 12:30.930
At first, we wanted to learn from the past, yes?

12:30.930 --> 12:32.830
We don't want to repeat some mistakes.

12:32.830 --> 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.

12:43.470 --> 12:45.090
But it's still not free.

12:45.090 --> 12:47.590
You still need to pay cost of having ASLR.

12:47.610 --> 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.

12:58.910 --> 13:00.710
It's more efficient from the security perspective.

13:00.710 --> 13:04.630
Instead of buying these resources for something which, you know, would have a limited value.

13:04.630 --> 13:07.710
Also, Peregrine, it's not the only one ecosystem there.

13:07.710 --> 13:09.330
There is other Peregrines in the die.

13:09.330 --> 13:13.050
As I mentioned, there could be between 10 to 50 Peregrines on the one core.

13:13.150 --> 13:17.530
Some Peregrines have different security levels, some have different threat models, some have different warranties.

13:17.530 --> 13:20.050
We need to take this into account when we design the ecosystem.

13:20.050 --> 13:25.290
Also, how do we communicate between this ecosystem or between these different privilege level Peregrines?

13:25.290 --> 13:28.110
We must have a complicated software and firmware.

13:28.110 --> 13:32.390
So we found out that still the software is the biggest attack surface for us.

13:32.430 --> 13:35.950
So how to actually effectively find the software vulnerabilities?

13:36.270 --> 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.

13:46.010 --> 13:49.730
But actually, that's not sufficient because it's neither scalable solution, yes?

13:49.730 --> 13:51.530
We cannot just rely on those.

13:51.530 --> 13:53.850
It's something which we must have, but it's not enough.

13:54.150 --> 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.

14:00.150 --> 14:01.710
So fuzzing can help here.

14:01.770 --> 14:03.990
And how to increase the effectiveness of the fuzzing?

14:03.990 --> 14:08.670
Obviously, we need to have some other sanitizer and code coverage driver instrumentation.

14:08.670 --> 14:10.210
That can help, yes?

14:10.210 --> 14:14.090
The problem is that RISC-V did not support that at that time.

14:14.250 --> 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.

14:21.070 --> 14:27.150
Over the time, also software community pick it up and now everybody can use other sanitizer on the RISC-V.

14:27.150 --> 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.

14:33.690 --> 14:37.490
So we needed to have hardware support for the better fuzzing and automation.

14:37.510 --> 14:40.930
So that's how I created pointer masking extension for the RISC-V.

14:41.090 --> 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.

14:48.790 --> 14:50.710
But our ecosystem is unique.

14:50.710 --> 14:55.410
So among standard use case like S and U mode, we also have unusual use case.

14:55.410 --> 14:56.970
We need to support M mode.

14:56.970 --> 15:00.330
We need to support bar metal code for fuzzing microcode, yes?

15:00.330 --> 15:03.270
We also needed to support with and without OS layer.

15:03.370 --> 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.

15:12.670 --> 15:17.350
However, when I've done that, I realized and I met other folks working on the similar problems.

15:17.350 --> 15:24.310
It turns out that independently people from the Google were also working on the somehow similar pointer masking solution.

15:24.310 --> 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?

15:34.690 --> 15:37.710
So that's how pointer masking extension was created.

15:37.710 --> 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.

15:45.370 --> 15:46.930
And there's various more use case.

15:46.930 --> 15:49.730
They could be hardware agent and member tagging like we wanted.

15:49.750 --> 15:51.290
They could be pointer authentication code.

15:51.290 --> 15:52.930
They could be hardware memory sandbox.

15:53.030 --> 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.

16:00.930 --> 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.

16:13.810 --> 16:15.430
And we actually achieved that.

16:15.490 --> 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.

16:23.230 --> 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.

16:28.970 --> 16:34.970
So some of the profiles actually mandate pointer masking to be implemented in the hardware and other profiles make them optional.

16:35.110 --> 16:40.050
And in total, we spent more than four years of work to be able to introduce pointer masking.

16:40.090 --> 16:42.010
And it's actually not one extension.

16:42.010 --> 16:45.470
It's umbrella for five different extension, which is split per privilege level.

16:45.470 --> 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.

16:53.890 --> 16:58.270
Just mandate that you must have support of pointer masking in the U mode or S mode.

16:58.270 --> 17:00.170
And there is some method to be able to enable that.

17:00.170 --> 17:05.510
We also obviously create software ecosystem support for hardware ASAN which is listed here.

17:05.510 --> 17:12.830
And internally, when we actually finish all of those work, we added the software support for our customer ecosystem.

17:12.930 --> 17:18.170
So as of today, we actually run the GSP firmware with the hardware ASAN.

17:18.170 --> 17:23.710
And we're also running as of today resource manager microcode also with the hardware ASAN.

17:23.710 --> 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.

17:30.530 --> 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.

17:37.690 --> 17:44.510
Another extension which we believe makes sense, it's very effective from the security perspective, is actually hardware control flow integrity.

17:44.510 --> 17:46.730
Not software CFI, but hardware CFI.

17:46.730 --> 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.

17:54.230 --> 17:56.610
But this is some visualization on the right slide.

17:56.610 --> 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.

18:04.910 --> 18:09.050
And CFI is actually a sub... it's a two extension.

18:09.050 --> 18:11.350
There's two sub-extensions inside of the CFI.

18:11.350 --> 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.

18:20.630 --> 18:23.790
It's visualized on the right side of the slide.

18:23.790 --> 18:30.250
And it also preserves original stack ABI, and we introduce new register and also new instruction for shadow stack management.

18:30.490 --> 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.

18:37.830 --> 18:41.470
And the shadow stack region is protected by the hardware, so attacker doesn't have access to it.

18:41.470 --> 18:45.030
So then you cannot actually overwrite the copy of the return address.

18:45.050 --> 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.

18:51.830 --> 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.

18:58.510 --> 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.

19:11.750 --> 19:15.130
And it's much more effective than stack cookies, so why keeping both?

19:15.490 --> 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.

19:31.010 --> 19:31.790
It's a new instruction.

19:31.790 --> 19:35.710
However, this new instruction additionally encodes 20-bit label.

19:36.390 --> 19:42.470
And whenever we have enforcements of the landing pad, then any indirect branch must always land in the landing pad.

19:42.470 --> 19:46.050
Additionally, this landing pad must always have correct hash.

19:46.050 --> 19:48.530
It can't be just random landing pads.

19:48.530 --> 19:49.990
It must be specific hash.

19:49.990 --> 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.

20:00.910 --> 20:05.850
So as today, we believe the RISC-V hardware CFI is the strongest CFI ISA implementation.

20:06.430 --> 20:13.130
And again, we also are working with the RISC-V profiles and RISC-V international to include CFI profile.

20:13.310 --> 20:17.390
And actually, hardware CFI is mandated to some profile and optional to another one.

20:17.390 --> 20:19.750
We also have software ecosystem support for those.

20:19.750 --> 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.

20:27.490 --> 20:33.390
And again, there's more people involved in the CFI than just us and other folks.

20:33.390 --> 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.

20:40.270 --> 20:41.290
And also, what's next?

20:41.290 --> 20:42.310
What we are planning to?

20:42.310 --> 20:46.490
Obviously, memory tagging, because this was the main idea also behind the point I'm asking, yes?

20:46.490 --> 20:50.150
It addresses the performance issue, which you can still have with the hardware ASIN.

20:50.150 --> 20:56.390
And additionally, memory tagging is targeting to be enabled in the production binaries.

20:56.710 --> 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.

21:06.510 --> 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.

21:16.690 --> 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.

21:25.590 --> 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.

21:31.930 --> 21:34.830
If the tag matches, it means you're inbound of access.

21:34.830 --> 21:39.470
Otherwise, the hardware will detect that you're touching different tag, different color, and tries the exception.

21:39.570 --> 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.

21:50.470 --> 21:54.710
But what is important, it's detected before corruption happens.

21:54.710 --> 21:56.730
Most of the mitigation detects post-corruption.

21:56.730 --> 21:57.910
This is before corruption.

21:57.910 --> 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.

22:04.970 --> 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.

22:17.830 --> 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.

22:24.510 --> 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.

22:34.770 --> 22:36.390
We are interested on that feature as well.

22:36.390 --> 22:42.850
There's no TG yet, but we are evaluating the benefits of bringing such sandbox to our software ecosystem.

22:43.030 --> 22:44.370
So how it works?

22:44.370 --> 22:49.050
In principle, HFI introduced something like user mode concept of memory region.

22:49.050 --> 22:52.830
Doesn't need to be on the user mode, but it can be enabled also in the user mode.

22:52.830 --> 22:56.510
It's similar to concept of x86 segmentation.

22:56.830 --> 23:01.370
So any access outside of this region, predefined region, will generate a hardware trap.

23:01.370 --> 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.

23:17.290 --> 23:18.930
And it's enforced by the hardware.

23:19.350 --> 23:25.550
And there's another interest of interest for us, which is post-quantum cryptography, PQC.

23:25.550 --> 23:28.070
We also evaluate side channel protection hardening.

23:28.070 --> 23:34.810
We're also looking in the cherry, and we're also looking on the enhanced hardware fault injection protection.

23:34.870 --> 23:37.890
So what I was speaking about, it's a hardware foundation security.

23:37.890 --> 23:39.150
What about the software?

23:39.150 --> 23:41.450
So this is what Marco will speak about next.

23:43.090 --> 23:44.410
Thank you, Adam.

23:44.470 --> 23:47.650
Now let's go over software layers that form this foundation.

23:48.670 --> 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.

24:01.730 --> 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.

24:20.670 --> 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.

24:34.030 --> 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.

24:43.470 --> 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.

24:54.830 --> 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.

25:04.090 --> 25:08.710
So the separation kernel is that software component that creates and manages partitions.

25:09.150 --> 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.

25:20.750 --> 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.

25:34.090 --> 25:41.710
From separation kernel's perspective, scheduling is simple, it's cooperative, but different scheduling policies can be built on top.

25:41.710 --> 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.

25:51.610 --> 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.

26:01.370 --> 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.

26:10.750 --> 26:15.890
Because of its nature and importance, we added specific extensions to further secure its execution.

26:16.330 --> 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.

26:26.470 --> 26:30.490
So even if you somehow manage to get the core to jump back, it won't work.

26:30.670 --> 26:34.090
And we have execute-only memory, so the code cannot be dumped out.

26:34.870 --> 26:39.790
All functions are leaf functions, so there is no return address, bill, and stack.

26:40.270 --> 26:47.500
And during the core software execution, the core is in lockdown state, so all external access is disabled.

26:48.930 --> 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.

27:04.730 --> 27:10.050
And as I said before, depending on what microcontroller does, some cores may be in DCLS mode.

27:10.050 --> 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.

27:15.810 --> 27:21.610
So if there is a mismatch between the execution, it means something off is going on and it will be detected.

27:21.970 --> 27:27.230
This is added for safety, but it also makes glitch attacks less successful.

27:27.870 --> 27:28.490
Harder.

27:29.590 --> 27:32.190
Okay, now let's talk about language-based security a bit.

27:32.190 --> 27:34.850
As I mentioned Spark multiple times now.

27:35.530 --> 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.

27:44.130 --> 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.

27:51.970 --> 27:56.970
But with Spark we can prove that whole classes of vulnerabilities will not ever happen.

27:57.350 --> 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.

28:07.730 --> 28:12.510
So here I have one simple procedure in pre- and post-condition contracts.

28:12.510 --> 28:13.970
And this is the implementation.

28:14.510 --> 28:19.210
So with Spark we can prove that this implementation is correct given the contracts.

28:19.990 --> 28:27.330
And this is done through this high-level pipeline that involves multiple steps and some fancy tools like SMT solvers.

28:27.910 --> 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.

28:46.910 --> 28:50.150
So the pipeline would actually look more like this.

28:50.230 --> 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.

29:05.910 --> 29:12.510
And then you would go back, change specification, implementation, or even the contracts, and do it again.

29:13.670 --> 29:19.610
But most likely you won't be able to implement 100% everything you want with just Spark.

29:19.610 --> 29:23.470
So you would need to make calls into A to C or assembly.

29:23.630 --> 29:27.170
In this case, you would test for what you cannot prove.

29:27.170 --> 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.

29:37.350 --> 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.

29:50.430 --> 29:56.910
Now you may be wondering why you can't do all this with C, Ada, or Rust, for example.

29:57.030 --> 30:00.730
And what follows is my modified section of a talk.

30:00.730 --> 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.

30:09.530 --> 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.

30:17.670 --> 30:23.210
And this would be a subset of that machine state set that is attainable through a programming language.

30:24.590 --> 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.

30:32.150 --> 30:33.970
And C is the most powerful language.

30:33.970 --> 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.

30:42.470 --> 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.

30:52.970 --> 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.

31:03.770 --> 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.

31:16.170 --> 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.

31:25.590 --> 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.

31:44.470 --> 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.

31:56.670 --> 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.

32:09.550 --> 32:14.490
The AORT, or absence of runtime errors, is a common term used for this.

32:15.930 --> 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.

32:23.870 --> 32:28.110
So we designed our hardware and configured it such that we mitigate against those.

32:28.830 --> 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.

32:43.490 --> 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.

32:56.110 --> 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.

33:12.090 --> 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.

33:21.790 --> 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.

33:31.950 --> 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.

33:40.290 --> 33:43.730
And we saw how memory safety is a harder problem as well.

33:43.990 --> 33:50.330
But ultimately there are no silver bullets in security, and defense in depth remains the most reliable guiding principle.

33:50.730 --> 33:54.510
And now over to Adam, and he's going to close with some lessons learned.

33:56.470 --> 33:58.770
So yes, what are the lessons learned?

33:58.770 --> 34:02.330
So actually, hardware extensions are not enough, yes?

34:02.510 --> 34:06.370
The biggest attack surface is still actually a software, as we discussed at the beginning.

34:06.370 --> 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.

34:17.410 --> 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.

34:24.110 --> 34:27.370
So that's why it's so important to co-design and software and the hardware.

34:27.370 --> 34:29.670
There's no silver bullet in just one layer.

34:29.870 --> 34:34.090
Also, formally verified language like Spark or memory-safe language like Rust, they are great.

34:34.090 --> 34:35.070
They're awesome.

34:35.230 --> 34:40.310
And they have significant security return of the investments, but costs are actually substantial.

34:40.310 --> 34:41.650
It's not cheap, yes?

34:41.650 --> 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.

34:57.550 --> 34:58.590
We just don't know.

34:58.590 --> 35:02.470
So it's very likely it's going to be a hybrid world for a while.

35:02.470 --> 35:06.150
And also, it's worth to keep in mind there is also non-memory safety issues.

35:06.150 --> 35:08.690
Any type of the language, yes?

35:08.830 --> 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.

35:16.030 --> 35:18.850
And I think this is the most important bullet from the entire talk.

35:18.950 --> 35:22.230
So actually, how to create innovative ecosystem?

35:22.310 --> 35:27.970
You actually need to have, it's a demand, you must have a forward-thinking mindset.

35:28.190 --> 35:32.070
At first, you don't know how you're going to evolve, so you must be flexible.

35:32.110 --> 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.

35:43.710 --> 35:48.850
But you must be flexible enough to be able to have such kind of primitive to be flexible, yes?

35:48.850 --> 35:50.190
And also, how to do it?

35:50.190 --> 35:55.230
You must kind of predict the industry trends, some kind of informed prediction of the industry trends.

35:55.230 --> 35:56.250
How to do that?

35:56.250 --> 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.

36:07.710 --> 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.

36:14.290 --> 36:20.650
And also, scalability, flexibility, reliability, performance, and security must be taken collectively, not separately.

36:20.650 --> 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.

36:32.870 --> 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.

36:41.770 --> 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.

36:51.270 --> 36:55.190
They are hybrid attacks, and we believe they are going to be on the rise.

36:55.330 --> 36:57.030
So that's it what we have today.

36:57.030 --> 36:59.270
If we have any questions, we are happy to answer.

36:59.290 --> 36:59.690
Thank you very much.

