النص 🔗
WEBVTT
00:00:00.007 --> 00:00:03.007
Ierengaym.
00:00:03.007 --> 00:00:09.016
com ierengaym.
00:00:09.016 --> 00:00:10.609
com
00:00:10.609 --> 00:00:11.470
Hey, everybody.
00:00:11.619 --> 00:00:14.890
Welcome back to tricky bits with Rob and PJ.
00:00:16.260 --> 00:00:26.429
So one of the interesting articles that have come out over the last month has to do with Apple's M series of chips.
00:00:26.429 --> 00:00:28.949
So the M1, the M two, and the M three.
00:00:29.920 --> 00:00:41.189
And issue in question is that have successfully attacked the chip to extract.
00:00:42.020 --> 00:00:45.049
Encrypted data, specifically encryption keys.
00:00:45.740 --> 00:00:51.240
And it's a really unique or interesting way by which they've gotten access to this.
00:00:51.240 --> 00:00:53.439
And it has to do with a performance.
00:00:54.204 --> 00:01:01.795
Gain that the chip is attempting to do, or does do, which is this topic around instruction prefetching.
00:01:02.625 --> 00:01:12.385
So the M Series has a particularly aggressive set of prefetching that it does when it's examining the information coming in.
00:01:12.944 --> 00:01:22.834
And because of the particular side effects that can occur, this allows attackers to potentially get access to sensitive data.
00:01:24.344 --> 00:01:38.394
Rob, this, uh, this is a unfortunate situation because I think you've pointed out this is occurring all the way down at this level of the silicon and everyone raved at the performance for so long.
00:01:39.405 --> 00:01:42.295
But we, we end up in this kind of situation.
00:01:43.260 --> 00:01:48.280
Well, one correction I'll point out, it's data pre fetching, not instruction pre fetching, that causes the problem here.
00:01:49.034 --> 00:01:49.344
Oh,
00:01:49.439 --> 00:01:56.219
And, it's not something unique to the Apple chips, everybody does it, it's just how they do it.
00:01:57.010 --> 00:02:02.890
But before we can really understand what's going on here, we have to go all the way back, way, way back.
00:02:04.269 --> 00:02:05.109
Why do we do this?
00:02:05.489 --> 00:02:08.060
Why do we prefetch is the ultimate question.
00:02:08.800 --> 00:02:11.069
And why do we prefetch instructions?
00:02:11.099 --> 00:02:13.060
And why do we prefetch data?
00:02:13.990 --> 00:02:16.590
And what are we prefetching from and to?
00:02:17.500 --> 00:02:21.439
It's, it's an architectural question that goes back about 30 years.
00:02:21.740 --> 00:02:25.580
And it all comes back to why do we have a cache on processors?
00:02:26.814 --> 00:02:30.604
The reason we have a cache is because processor speeds and memory speeds.
00:02:31.254 --> 00:02:33.895
are so far apart these days.
00:02:34.485 --> 00:02:39.425
We can, today we can get processors that are boosted to over five gigahertz clock speeds.
00:02:40.155 --> 00:02:49.245
You have memory as yes, it's faster than it was, but three, 4, 000 mega transactions a second is about as fast as you're going to get.
00:02:49.254 --> 00:02:54.435
So processor have gone up 10X in speed, 20X, 30X, whatever it may be over the last few years.
00:02:54.444 --> 00:02:56.444
And memory has gone up maybe 5X.
00:02:57.194 --> 00:02:59.164
So there's huge speed discrepancy.
00:03:00.014 --> 00:03:00.474
So.
00:03:02.185 --> 00:03:08.715
And this started in the 80s, like the original ARM 3 processor, the 386 processors back then had the same problem.
00:03:09.384 --> 00:03:11.444
Processors were getting much faster than memory.
00:03:11.444 --> 00:03:17.925
Maybe it was 30 megahertz for the processor, uh, and it was 8 megahertz for the memory.
00:03:18.884 --> 00:03:22.365
What happens is if you access memory, you have to make the processor wait.
00:03:23.349 --> 00:03:24.770
And it takes time.
00:03:24.810 --> 00:03:27.169
So to fix this problem, we added cache.
00:03:28.009 --> 00:03:38.439
Cache runs at the same speed, or almost the same speed as the processor, and single, one, two cycles, maybe, at access speed.
00:03:39.419 --> 00:03:44.789
So then, you load data, it's in the cache, you load the same data, and you get it for free.
00:03:44.830 --> 00:03:46.060
You don't pay that delay.
00:03:46.060 --> 00:03:51.500
But what happens if you make the memory orders of magnitude slower than the processor?
00:03:51.500 --> 00:03:55.039
You end up with a problem where you now miss the cache and the processor has to wait.
00:03:55.469 --> 00:03:58.289
a thousand clock cycles while it sits there doing nothing.
00:03:58.289 --> 00:03:59.409
And that's not acceptable.
00:03:59.409 --> 00:04:05.539
So every architectural improvement in processor speed is basically addressing this problem.
00:04:05.919 --> 00:04:08.360
And it has been that way for, like I said, 30 years.
00:04:08.360 --> 00:04:09.199
So what did we do?
00:04:09.199 --> 00:04:12.659
We started doing things like, well, first of all, we'll split instructions and data.
00:04:12.659 --> 00:04:13.800
So they're in their own cache.
00:04:14.389 --> 00:04:16.839
And the way you prefetch each of them is very different.
00:04:17.029 --> 00:04:24.235
Like instructions have Branch predictors, branch target predictors to have a guess as to like, okay, the code's going to go this way.
00:04:24.235 --> 00:04:26.634
I assume this branch is going to be taken.
00:04:27.095 --> 00:04:31.235
So I'll fetch instructions from the other side of the branch and won't go this way.
00:04:31.384 --> 00:04:34.564
And if it's wrong, it throws them away, comes back and fetches the real way.
00:04:35.154 --> 00:04:36.605
So it only pays the price.
00:04:36.814 --> 00:04:37.685
if it's wrong.
00:04:38.204 --> 00:04:42.245
And if it can predict that early enough, then it doesn't pay.
00:04:42.735 --> 00:04:46.165
If it can't predict early enough, it pays a percentage of the full cost.
00:04:46.175 --> 00:04:48.535
If it can predict early enough, it doesn't pay any cost.
00:04:48.535 --> 00:04:58.115
I was gonna say from a statistical standpoint, if you can keep
Load full transcript
that prediction in a high enough basically order, like 90 percent
00:04:58.305 --> 00:04:59.274
and that's where it is.
00:04:59.394 --> 00:05:06.120
you effectively are are able to guess the right path and therefore proceed unimpeded most of the time.
00:05:06.120 --> 00:05:10.100
It's only the sort of hiccup if you mispredict every once in a while.
00:05:10.245 --> 00:05:10.584
Yep.
00:05:10.925 --> 00:05:15.745
And that's the same for, so that's the instruction side and that they have their own system for fetching instructions.
00:05:15.745 --> 00:05:19.944
I said, where's the code flow going to go on the data side?
00:05:20.134 --> 00:05:21.144
It's a whole nother.
00:05:21.870 --> 00:05:22.879
Prediction system.
00:05:23.430 --> 00:05:27.720
And initially it was just, have you used this cache line before?
00:05:27.759 --> 00:05:28.720
Is it in the cache?
00:05:28.740 --> 00:05:30.319
If so, it's cheap.
00:05:31.410 --> 00:05:34.120
And we started adding prefetches.
00:05:34.129 --> 00:05:36.720
So, you know, I know I'm going to access this data.
00:05:36.730 --> 00:05:40.480
So I'll issue an instruction to say, prefetch this before I get to it.
00:05:40.480 --> 00:05:41.839
How far ahead do you prefetch?
00:05:42.120 --> 00:05:46.560
Because the discrepancy between CPU and memory speed is variable on everyone's machine.
00:05:46.569 --> 00:05:48.029
You might have five speed memory.
00:05:48.029 --> 00:05:52.240
I might have medium speed memory, same CPU, same code, same optimization.
00:05:52.560 --> 00:05:53.410
The time changes.
00:05:54.060 --> 00:06:03.310
So manual prefetching is actually very difficult to implement efficiently, but those instructions exist and have existed for a long time and they did work for a while.
00:06:03.829 --> 00:06:09.759
And the cool thing about the prefetch is instructions is you can give them a hint as to like, I am not going to use this again.
00:06:10.310 --> 00:06:12.519
So prefetch it, but don't leave it in the cache.
00:06:13.310 --> 00:06:20.019
So it's not polluting the cache for that could be taken by other memory, which is more useful to you.
00:06:21.029 --> 00:06:27.935
So there are some benefits to these non temporal prefetches as they're So that's where we went initially.
00:06:28.245 --> 00:06:33.754
But then we started to do things like, well, let's have a look at what data's going to be accessed.
00:06:33.754 --> 00:06:35.884
And this is where it gets really difficult.
00:06:36.295 --> 00:06:38.935
Out of order processes are needed to get here.
00:06:38.985 --> 00:06:45.345
You need the prefetcher, the instruction prefetcher, to be way ahead of where the data is.
00:06:46.125 --> 00:06:50.014
Actual execution point is where are the instructions being retired from?
00:06:50.824 --> 00:06:59.654
Because that gives the processor a huge window to pre look at load instructions and be like, okay, I see a load here and I've computed the address already.
00:06:59.995 --> 00:07:01.084
So I can issue this load.
00:07:01.154 --> 00:07:05.024
And it may be hundreds of cycles early, which takes away that cache load delay.
00:07:05.574 --> 00:07:06.814
It also may be wrong.
00:07:06.824 --> 00:07:13.795
And this is where we get into speculation errors and side channel effects on speculation.
00:07:13.795 --> 00:07:24.355
There is a unspoken contract, which has been violated a lot in architecture, which says, whatever the hardware does, there should be no visible side effects.
00:07:24.745 --> 00:07:33.764
So if the processor predicts, I'm going to go down branch A and it goes down branch A and starts fetching instructions.
00:07:33.805 --> 00:07:36.254
And in those instructions, they're all load instructions.
00:07:36.944 --> 00:07:40.774
And it starts issuing cache fetches for those load instructions.
00:07:41.084 --> 00:07:45.204
Those loads are now in the cache early enough that they could be used without penalty.
00:07:45.204 --> 00:07:48.004
But what if that branch was predicted wrong?
00:07:48.004 --> 00:07:52.144
It doesn't unflush those loads from the cache, it just lets them speed.
00:07:53.504 --> 00:08:00.115
So the process that gets to the retirement port of this branch, which it predicted to go Down a, but it actually went down B.
00:08:00.115 --> 00:08:07.394
So now it'll throw all that work away as far as executing instructions goes, but the prefetches are still visible.
00:08:08.185 --> 00:08:24.495
Now it starts executing down path B and there are visible side effects from the path it didn't go down this is the root of like the, the Spectre bug that we had a few years ago of tricking the processor into prefetching things and seeing the side effects of that.
00:08:24.495 --> 00:08:34.975
And the way that we see these side effects is by basically probing the cache, seeing how long it takes to access a memory address.
00:08:35.075 --> 00:08:40.554
If you kind of guess the address that is fetched, you can then access that in a different thread or a different process.
00:08:40.884 --> 00:08:41.455
And.
00:08:42.235 --> 00:08:49.934
see the fact that, oh, this memory was accessed quickly, so therefore must be in the cache, where if it's not in the cache, it's take a long time to access.
00:08:49.945 --> 00:08:58.745
And then by doing timing, side channel timing effects on the cache and statistical analysis, you can figure out what the speculation of the processor did.
00:08:59.404 --> 00:09:02.475
And that caused all sorts of problems with the Spectre days.
00:09:02.475 --> 00:09:07.815
But, those problems, these side effects, which are supposed to be invisible, still exist.
00:09:08.534 --> 00:09:11.195
The recent Apple problem is related to these.
00:09:11.735 --> 00:09:20.825
So going back to memory prefetching of, and specifically data prefetching, so we talked about like, okay, we can see an address that we're gonna load from, let's prefetch that.
00:09:20.825 --> 00:09:24.904
The processors also got a little smarter in
spotting patterns.
00:09:25.524 --> 00:09:30.524
Say you're loading through an array of data structures and you're accessing memory every 600 bytes.
00:09:30.995 --> 00:09:35.274
The processor will spot that and be like, okay, I see you're fetching 600 byte intervals.
00:09:35.294 --> 00:09:38.105
I'll just automatically fetch far enough out.
00:09:38.105 --> 00:09:41.634
That maybe not fetch the next one, but I'll skip three and I'll fetch the fourth one.
00:09:41.884 --> 00:09:45.865
And I'll go from there and hopefully get this into the cache in time.
00:09:46.514 --> 00:09:49.934
And obviously the last time around the loop, it might get that wrong.
00:09:49.995 --> 00:09:51.475
It might fetch one that you don't need.
00:09:51.475 --> 00:09:57.384
Again, it should be invisible and probably isn't if you look close enough.
00:09:58.054 --> 00:10:02.884
So we have these automatic prefetches, which will fetch data in sequential patterns.
00:10:03.304 --> 00:10:05.644
We have prefetches like you could hint.
00:10:05.644 --> 00:10:08.794
But what if the data isn't so easy to prefetch?
00:10:09.625 --> 00:10:13.825
What if it's the prefetch destination is dependent on the data itself?
00:10:13.825 --> 00:10:15.134
For example, a linked list.
00:10:15.475 --> 00:10:22.325
If you load a linked list node, if you never access the next node in the data, the processor will never see it.
00:10:22.335 --> 00:10:25.115
And it's totally random where the next node is.
00:10:25.465 --> 00:10:26.884
So it can't predict anything.
00:10:27.575 --> 00:10:30.975
So we added things called data dependent prefetches.
00:10:31.595 --> 00:10:51.825
And what they are is As you load the node, even before you issue the load for the next node, which is too late to prefetch, typically, the processor will look at the, the node, the cache line that the node's in and go, Oh, I see things that look like addresses, and I will prefetch that just in case.
00:10:51.825 --> 00:10:55.784
And that's the root of the, problem on the Apple processors.
00:10:56.245 --> 00:10:58.085
Now, Intel do the same thing.
00:10:58.105 --> 00:11:03.524
They have a data dependent pre fetcher, but it's not as aggressive as the Apple one.
00:11:03.534 --> 00:11:07.325
The Apple one will basically look at multiple levels and fetch from there.
00:11:08.154 --> 00:11:12.274
So, It's far more likely to have visible side effects.
00:11:12.304 --> 00:11:23.554
And in fact, the go fetch people who found that's the name of the security flaw that they gave it, can't get it to work on an Intel or AMD processor, but they do get it to work on the Apple processes.
00:11:23.554 --> 00:11:30.495
Another reason is Intel have a lot of controls, which can switch these things on and off and Apple don't seem to have them at least in the M one and the M two.
00:11:30.544 --> 00:11:32.495
Maybe the M three has some controls.
00:11:32.495 --> 00:11:32.945
And.
00:11:33.759 --> 00:11:41.720
It all comes back to this Violation of
a contract that the hardware isn't doing what the software Said
00:11:41.720 --> 00:11:46.799
So what do you mean by this is, the hardware is trying to be smart.
00:11:46.809 --> 00:11:48.110
it's over eager.
00:11:48.269 --> 00:12:17.365
For example, like you gave a non coherent Or a data structure that has sort of non coherent memory, like a list or an STL map or set where you could be bouncing across all over the place for pointers, like the Apple prefetcher is basically like examining every single one of these nodes, picking out all the memory and going after it, even though you may not actually be exploring that in the software, you may never go down any of those nodes,
00:12:17.610 --> 00:12:22.350
it might not actually be an address It might not be an address and there's the problem.
00:12:22.909 --> 00:12:24.259
Obviously there's a lot of logic here.
00:12:24.259 --> 00:12:25.490
It's not just going, Oh, that's an address.
00:12:25.490 --> 00:12:26.960
I'll fetch it because what's an address.
00:12:27.019 --> 00:12:34.580
It has to kind of have some smarts to be like, okay, this is an address which makes sense for this process or what I've seen before access wise.
00:12:35.070 --> 00:12:36.870
So there are some smarts there.
00:12:36.879 --> 00:12:41.440
It's just an endo smarts and how many levels of prefetch do you do?
00:12:41.440 --> 00:12:43.509
If you fetch the next cache line, do you look at that?
00:12:43.509 --> 00:12:45.039
Do you look at the next one you fetch?
00:12:45.100 --> 00:12:47.169
Do you recursively do this?
00:12:47.169 --> 00:12:51.309
All of these smarts is where the difference between Apple and Intel are.
00:12:51.710 --> 00:12:55.139
And Apple was a little over aggressive, which probably gave them a few percent.
00:12:55.320 --> 00:12:58.779
And that's all we're talking is a few percent speed increase.
00:12:59.860 --> 00:13:03.809
But it breaks this fundamental contract of what the software and the hardware is doing.
00:13:04.409 --> 00:13:06.159
So how does it actually work?
00:13:07.034 --> 00:13:10.754
What is this, uh, GoFetch doing?
00:13:11.284 --> 00:13:19.985
It's looking at the side effects of this prefetching, and then making fake data to reveal a security key.
00:13:20.225 --> 00:13:23.554
And you can hack over things with it too, but obviously security keys are the big one.
00:13:23.554 --> 00:13:24.544
Is this a big deal?
00:13:24.725 --> 00:13:37.465
Kind of, yes, because you could have another non root process running alongside some app that's used in OpenSSL, and it could derive the private keys, or the AES key, if it's a symmetrical system.
00:13:38.125 --> 00:13:48.644
It takes a long time, but it doesn't take that long, and it doesn't take that much processing power, so if you had a rogue process on your Mac, you may not know it's there.
00:13:49.215 --> 00:13:59.434
It's just sitting there trying to guess keys and it may guess wrong most of the time, but in the end, it will get the key and it
seems to be pretty reliable from the test.
00:13:59.434 --> 00:14:06.544
I've not seen the code yet, but from the videos of the tests, it seems to be pretty reliable given enough time.
00:14:07.095 --> 00:14:09.504
And so what is it?
00:14:09.884 --> 00:14:10.845
How's it doing this?
00:14:11.504 --> 00:14:14.664
So encryption code, first of all, you should never write yourself.
00:14:14.695 --> 00:14:20.495
You should use open SSL or something that's been written by somebody who really knows encryption.
00:14:20.909 --> 00:14:31.769
Because you don't want the code to have different execution paths based on the bits of the private key.
00:14:32.440 --> 00:14:35.899
If it does a lot more work for a 1 bit than it does for a 0 bit.
00:14:35.899 --> 00:14:51.980
Then it's really easy to detect by cache analysis, power analysis, thermal analysis, there's a whole bunch of ways to determine how it's executed, various bits of the key and easy to derive the private key, regardless of the data.
00:14:51.980 --> 00:15:05.580
So you do things like, okay, we'll write code that has no difference in execution time for zero and one bits of the key and Intel have a whole execution mode where you can kind of do constant time.
00:15:05.580 --> 00:15:09.779
execution for a whole bunch of instructions regardless of what the input parameters are.
00:15:10.120 --> 00:15:13.600
So, if you're loading from memory, it's this cost.
00:15:13.610 --> 00:15:17.210
If you're loading from memory plus an offset, it's the same cost.
00:15:17.230 --> 00:15:18.620
They're all slower instructions.
00:15:18.620 --> 00:15:21.809
You don't get the maximum performance of each variation of the instruction.
00:15:22.059 --> 00:15:28.460
They all go to a lowest common denominator, but it makes it real easy to do constant speed execution.
00:15:28.460 --> 00:15:28.980
And same thing.
00:15:28.990 --> 00:15:30.350
You want constant branching.
00:15:30.629 --> 00:15:34.769
You want everything to be as constant as possible, regardless of what the input key is.
00:15:35.389 --> 00:15:37.320
So you can't side channel attack the key.
00:15:37.889 --> 00:15:43.340
And this is kind of getting into the territory of where the hardware violates that software contract.
00:15:43.340 --> 00:15:47.980
Because the software went through all these, all this effort to make sure there's no visible side effects.
00:15:48.190 --> 00:15:50.200
Every instruction takes the same amount of time.
00:15:50.389 --> 00:15:51.379
There's no branches.
00:15:51.669 --> 00:15:53.559
There's no 0, 1 variation.
00:15:53.779 --> 00:15:54.379
Blah, blah, blah.
00:15:54.379 --> 00:15:59.009
There's a whole list of these things that X security, code implements.
00:15:59.549 --> 00:16:01.940
But the hardware then just goes and runs wild with it.
00:16:01.940 --> 00:16:02.720
They're like, Oh, I'll do this.
00:16:02.720 --> 00:16:03.220
I'll do that.
00:16:03.230 --> 00:16:04.029
I'll speculate.
00:16:04.029 --> 00:16:04.679
I'll prefetch.
00:16:05.129 --> 00:16:07.539
And you start to reveal data about the key.
00:16:08.100 --> 00:16:09.730
And that's exactly what GoFetch does.
00:16:09.730 --> 00:16:10.360
GoFetch.
00:16:11.095 --> 00:16:16.235
Interjects fake data in the data side.
00:16:16.235 --> 00:16:21.715
So you've got the data side, you've got the key side and the key side is what you don't know, but if you can't control the data side.
00:16:22.004 --> 00:16:27.715
So if you start injecting data you can control things that look like addresses and whatnot.
00:16:27.745 --> 00:16:30.725
there's a few hoops to jump through, but basically you're generating fake data.
00:16:30.725 --> 00:16:44.014
To pass through this constant speed, constant time, constant power encryption code, and using the side effects of that fake data from the pre fetcher to guess what the keys of the bit, the bits of the key were, and it takes time.
00:16:44.065 --> 00:16:46.825
It takes a while, but it's very effective.
00:16:47.365 --> 00:16:50.735
you're taking advantage of the fact this was all supposed to run in constant time.
00:16:51.115 --> 00:17:01.995
But I'm now going to inject fake data to induce this hardware variation that I can detect, which then gives me information about the underlying key.
00:17:02.065 --> 00:17:07.244
So I can actually find out information by, again, statistically running this enough times.
00:17:07.474 --> 00:17:09.575
let's talk about order of magnitude of time.
00:17:09.585 --> 00:17:13.755
Are we talking that it's going to take hours to crack a code, or seconds, or somewhere in between?
00:17:13.755 --> 00:17:29.505
It's somewhere in between cracking a RSA 2048 key takes on the order of 25 to 30 minutes, a 2048 bit Diffie Hellman key, 127 minutes, and there's no offline processing.
00:17:29.825 --> 00:17:44.484
On those, when you get to the matrix lattice encryption schemes, which are supposed to be secure against quantum computers, like Kyber 512 and, dilithelium two and things like that.
00:17:44.775 --> 00:17:46.964
It, uh, Cracks, those two.
00:17:47.265 --> 00:17:59.795
So CBER 5, 12 43 minutes, but it also takes about 300 minutes of offline processing time where the RSA and Diffy Helman keys didn't take any offline time.
00:18:00.644 --> 00:18:02.480
So none of the keys are pretty.
00:18:02.480 --> 00:18:02.980
Safe.
00:18:03.119 --> 00:18:05.460
It's like, it's quite bad.
00:18:06.579 --> 00:18:09.240
And like I said, it's for 26 minutes to crack an RSA key.
00:18:09.240 --> 00:18:09.759
That's,
00:18:10.035 --> 00:18:10.204
It's
00:18:10.430 --> 00:18:12.779
that's quite, that's quite quick.
00:18:13.200 --> 00:18:16.640
And that's how long it is to be reliable.
00:18:16.650 --> 00:18:18.039
It may not take that long.
00:18:18.345 --> 00:18:29.055
and, and, you know, to drive a point home, this is all the way down in the silicon, like, any fixes need to be some sort of software fixes on top.
00:18:29.055 --> 00:18:31.434
I mean, it's, it's in,
it's in the hardware.
00:18:31.684 --> 00:18:33.375
There's nothing you can do to fix that.
00:18:33.900 --> 00:18:37.140
Yeah, and it's actually quite hard to avoid these side effects.
00:18:37.140 --> 00:18:47.880
You've basically got to randomize the code such that the side effects Aren't visible or at least way down in the noise floor that you can't isolate what the hardware did.
00:18:48.369 --> 00:18:50.740
And this RSA has done this for quite a while.
00:18:50.740 --> 00:18:58.099
Well, they'll, they'll just have random bits associated with the key and it makes it much harder to analyze what the actual algorithm is doing.
00:18:58.099 --> 00:19:02.900
Because from an external point of view, you don't know what the noise is and the random noises and you don't know what the algorithm is.
00:19:02.900 --> 00:19:06.960
So it makes it a very difficult to analyze from side channels.
00:19:06.970 --> 00:19:07.829
So you have to do that.
00:19:08.470 --> 00:19:09.059
And.
00:19:09.059 --> 00:19:20.750
It comes at a huge performance hit and if it's a one off RSA key that performance hit even if it's 10x slower It doesn't really matter if you're just doing a key here and a key there.
00:19:20.750 --> 00:19:29.910
Where it does matter is things like AES, where, yes, it's a symmetrical key, so you're not looking for the private half of the key, you're looking for the key itself, because it's symmetrical.
00:19:29.910 --> 00:19:31.390
But that's used all the time.
00:19:31.460 --> 00:19:40.555
All of HTTPS, all of the drive encryption, all Everything that's basically encrypted is ultimately an AAS key that because it's fast to encrypt.
00:19:41.055 --> 00:19:44.684
So VPNs, all of that is all done with AAS.
00:19:44.684 --> 00:19:46.595
And then that key is protected by an RSA key.
00:19:46.595 --> 00:19:50.765
So getting the RSA key could give you the actual AAS key that's being used.
00:19:50.775 --> 00:19:52.285
So now you can decrypt the hard drive.
00:19:52.315 --> 00:19:55.214
You can decrypt HTTPS sessions and things like that.
00:19:55.634 --> 00:19:58.765
and that becomes a huge problem.
00:19:59.164 --> 00:20:04.565
And to put it an order of magnitude, did I read correctly in the paper that it's like a 2x difference?
00:20:04.575 --> 00:20:11.474
So, I mean, if would effectively, you know, say cut my speeds in half if I was on the
00:20:11.734 --> 00:20:12.724
Not really,
00:20:12.944 --> 00:20:13.355
No.
00:20:13.400 --> 00:20:20.160
Maybe, maybe not because you're not, if encryption is your bottleneck, then slowing it down by two X is a problem.
00:20:20.545 --> 00:20:20.875
Yeah.
00:20:23.059 --> 00:20:26.529
encryption and decryption is typically not the bottleneck in these systems.
00:20:26.680 --> 00:20:27.930
The internet itself is.
00:20:28.210 --> 00:20:34.220
So even if you slow the encryption down by two X, are you likely to see the result?
00:20:34.349 --> 00:20:40.105
Probably not, but maybe in some scenarios, in the grand scheme
of things, not a big deal.
00:20:40.105 --> 00:20:43.755
I mean, Spectre had all these other things that had to be slowed down.
00:20:43.835 --> 00:20:45.565
Some people noticed it, a lot didn't.
00:20:46.154 --> 00:20:47.275
And I think this is the same.
00:20:47.555 --> 00:21:04.204
I think the workarounds are viable to make this attack at least difficult because the data will be in the noise and statistically analyzing the backend gets a lot more difficult to pinpoint what actually happened and if it's 2x, who cares, it's.
00:21:05.244 --> 00:21:06.474
Much better than having this there.
00:21:06.494 --> 00:21:08.724
Like I said, it's 20, 30 minutes to crack a key.
00:21:09.924 --> 00:21:15.595
You could quite easily have a rogue app running for 30 minutes before you even notice that it's draining your battery or that it's there.
00:21:16.095 --> 00:21:23.535
How many people have run the process monitor on a Mac to see what's actually running as bare service level processes that don't have any UI?
00:21:23.730 --> 00:21:26.599
and quite honestly, how many people would know what to look for?
00:21:26.630 --> 00:21:27.460
Because I mean, there's
00:21:27.684 --> 00:21:28.305
Exactly,
00:21:28.839 --> 00:21:35.450
that are running and it'd be like, Oh, like, unless you're looking each of these things up online, you could easily have a rogue process there.
00:21:35.500 --> 00:21:35.950
Exactly.
00:21:35.980 --> 00:21:37.829
And it doesn't need to be root access.
00:21:37.859 --> 00:21:38.940
It's just any process.
00:21:38.940 --> 00:21:51.325
So as long as, if a malicious software can launch a process, With minimal user rights, then it can crack the keys of all the processes, which is the big, that's the big problem right there.
00:21:51.775 --> 00:21:55.434
And like I said, who knows what's meant to be there, what isn't supposed to be there.
00:21:55.795 --> 00:21:57.384
And this was reported to Apple last year.
00:21:57.384 --> 00:21:59.565
So a lot of the fixes are already in place.
00:21:59.605 --> 00:22:04.184
OpenSSL will get updated to have a different code path for the machines.
00:22:04.184 --> 00:22:08.484
But the problem is, is that Apple don't have any controls over this prefetcher.
00:22:08.795 --> 00:22:10.255
Intel have some controls.
00:22:10.674 --> 00:22:12.295
So you can turn it off and things like that.
00:22:12.775 --> 00:22:16.835
I think the ultimate fix is like the cacheable fix in memory pages.
00:22:17.285 --> 00:22:17.654
Of.
00:22:18.025 --> 00:22:24.224
When we added memory managers and we added caches, there was always a need for this memory cannot be cached.
00:22:24.234 --> 00:22:26.414
You can't access this memory out of order.
00:22:26.595 --> 00:22:34.365
This memory is a memory mapped piece of hardware and reads and writes have to go in the order the processor issues them in.
00:22:34.365 --> 00:22:39.464
And so because this problem was already known about when we added caches,
00:22:40.089 --> 00:22:40.509
right.
00:22:40.634 --> 00:22:43.575
we added flags to the memory pages from day one.
00:22:43.914 --> 00:22:45.505
That was this memory is not cacheable.
00:22:46.005 --> 00:22:54.644
And basically, if you set that flag, yeah, you don't get cache performance, but you do get in order memory accesses, which is exactly what we need.
00:22:54.769 --> 00:22:59.029
to be checking, like, when we say we, you're referring to Intel and AMD chips, right?
00:22:59.279 --> 00:22:59.400
Because
00:22:59.434 --> 00:23:00.744
Intel AMD ARM,
00:23:01.047 --> 00:23:01.470
M1
00:23:01.795 --> 00:23:03.634
has flags on the cache pages.
00:23:05.250 --> 00:23:06.529
and M2 would as well, right?
00:23:07.230 --> 00:23:07.750
Oh, absolutely.
00:23:07.799 --> 00:23:13.619
Every processor since 1985 has had these flags because there was always a need for memory that wasn't cached.
00:23:14.289 --> 00:23:16.220
This existed before we added caches.
00:23:16.640 --> 00:23:19.930
So when we added the caches, like, you know what, this is not going to work for all of this.
00:23:20.190 --> 00:23:24.839
VGA hardware, whatever it may be, things that existed back when we first added caches.
00:23:24.839 --> 00:23:27.589
We realized immediately, we need to have flags to switch the cache off.
00:23:28.490 --> 00:23:30.279
And it was done on a memory page basis.
00:23:30.299 --> 00:23:31.720
It can also be done globally.
00:23:31.720 --> 00:23:32.279
What we didn't.
00:23:32.815 --> 00:23:34.515
See, is these problems showing up?
00:23:34.515 --> 00:23:37.924
So we didn't add flags to the memory pages to switch off the prefetch.
00:23:37.954 --> 00:23:42.664
And we should have, that is one of the better fixes is the processor runs as normal.
00:23:42.684 --> 00:23:44.785
You just can't prefetch in these pages.
00:23:45.134 --> 00:23:48.075
You put all your keys and all your encryption go in these pages.
00:23:48.384 --> 00:23:53.825
The architectural difference between regular prefetching and these pages is known and documented.
00:23:54.305 --> 00:23:58.964
And the performance difference between having the prefetch on and having it off is also known.
00:23:59.585 --> 00:24:01.454
So we can write code to take advantage.
00:24:02.170 --> 00:24:03.579
Of the situation that it's in.
00:24:03.930 --> 00:24:08.730
And correct me if I'm wrong, the Intel chips have such a flag on the memory pages, correct?
00:24:08.819 --> 00:24:10.539
they, they do not have on the memory page.
00:24:10.539 --> 00:24:12.700
No, they have it more globally.
00:24:12.720 --> 00:24:13.460
So you can turn it off.
00:24:13.660 --> 00:24:18.789
And I think the M three has a flag that you can turn off, but the Intel one you can access from.
00:24:19.670 --> 00:24:24.150
I believe it's a model specific register and you don't need the kernel to do it for you.
00:24:24.210 --> 00:24:26.690
You can just do it, run it and switch it back on again.
00:24:27.105 --> 00:24:27.365
Got
00:24:27.559 --> 00:24:30.740
the
Apple one is a lot more complicated to switch on and off.
00:24:30.740 --> 00:24:32.809
It requires the kernel to help, et cetera, et cetera.
00:24:32.809 --> 00:24:35.619
So for the early processes don't have that at all.
00:24:35.619 --> 00:24:36.500
You can't turn it off.
00:24:36.569 --> 00:24:38.815
At least at least that we know of there's no architectural way to do it.
00:24:39.365 --> 00:24:40.325
To, uh, turn it off.
00:24:41.134 --> 00:24:50.214
So I think that's the next thing, is to have this memory cannot be pre fetched and just like this memory cannot be cached already exists.
00:24:50.424 --> 00:24:51.355
This needs to be added.
00:24:51.355 --> 00:24:58.055
So the M3 has a control and that is hard to, to work with because as you say, it requires the kernel to help.
00:24:58.335 --> 00:25:00.085
The M1 and the M2 do not.
00:25:00.134 --> 00:25:01.134
They are basically,
00:25:01.394 --> 00:25:03.015
as, far as as, as far as I know,
00:25:03.015 --> 00:25:03.634
is software
00:25:03.835 --> 00:25:04.704
you can't turn it off.
00:25:05.224 --> 00:25:08.345
I assume you can't turn it off at some level because none of them are on.
00:25:08.349 --> 00:25:10.630
When you power the processor, someone enables them.
00:25:10.761 --> 00:25:15.561
So I assume at some level, it may not be practical to turn them off.
00:25:15.571 --> 00:25:19.241
Maybe you have to turn off memory management and the caching and everything to get it to go off.
00:25:19.961 --> 00:25:22.211
Maybe it's controlled by the same flags as the cache.
00:25:22.221 --> 00:25:29.291
I have no idea how it works at this level, but, I assume like I said, when it passed, when it first booted, these things were not enabled,
00:25:30.281 --> 00:25:30.672
Right.
00:25:30.682 --> 00:25:36.342
one enabled it per process, per core, whatever it may be as the process of boots,
00:25:37.051 --> 00:25:45.051
so I think it, it will be useful to talk a little bit about, you know, you've mentioned that the Intel chips also have, data pre fetching.
00:25:45.061 --> 00:25:46.132
I mean, everyone does.
00:25:46.626 --> 00:25:52.557
But why is this not a news story that is affecting Intel as well?
00:25:53.326 --> 00:25:53.457
is
00:25:53.487 --> 00:25:55.446
the Intel one's not, uh, not aggressive.
00:25:55.477 --> 00:26:02.626
I believe the Apple one will look at a cash line, see an address, pre fetch that, and then pre fetch what's in that too.
00:26:02.626 --> 00:26:10.076
And just basically do this over recursive thing where the Intel one only does one layer, which makes it very hard to attack.
00:26:10.886 --> 00:26:14.406
If you look at the paper, which you can find at, gofetch.
00:26:14.416 --> 00:26:15.037
fail
00:26:15.231 --> 00:26:16.241
We'll post a link.
00:26:16.396 --> 00:26:22.297
All the other information is in there, you'll see that they, they actually analyze.
00:26:22.297 --> 00:26:28.707
Access patterns, not just directly access, not just directly looking at what the DMP did.
00:26:28.707 --> 00:26:31.856
They're looking at a whole access pattern across many accesses.
00:26:31.856 --> 00:26:34.047
And the Apple one, because it's more aggressive.
00:26:34.067 --> 00:26:35.797
It reveals more about itself.
00:26:35.797 --> 00:26:48.583
So in terms of a speed difference, then let's say, let's say we had a fictitious knob where the M series could be matched to the Intel aggression, which is not as aggressive.
00:26:49.522 --> 00:26:55.472
would be the percentage difference or, you know, order of magnitude of percentage difference of speeds?
00:26:55.673 --> 00:26:58.333
Barely, barely any.
00:26:58.623 --> 00:26:59.103
Like what?
00:26:59.593 --> 00:27:00.952
1 percent less?
00:27:01.252 --> 00:27:02.053
I have no idea.
00:27:02.063 --> 00:27:09.452
You'd have to look at, you'd have to simulate it or have a chip where you could switch it off at various levels to actually get real numbers.
00:27:10.012 --> 00:27:15.728
I'm guessing that And the more aggressive pre fetcher maybe gives them a percent, two percent.
00:27:15.738 --> 00:27:16.877
It's not going to be much.
00:27:16.877 --> 00:27:24.018
The pre fetcher existed at all, only added a few percent over static analysis pre fetching that the process is used to do.
00:27:24.607 --> 00:27:26.048
And only in certain scenarios too.
00:27:26.048 --> 00:27:29.728
If you're doing the predictable every 500 bytes.
00:27:29.728 --> 00:27:32.548
That can be prefetched much easier without data dependency.
00:27:33.178 --> 00:27:43.248
These are the things like prefetching based on the data itself, which is, like I said, the linked list example is one where you'd need a data dependent prefetcher because you don't know where you're going.
00:27:44.347 --> 00:27:47.768
And doing it one level is all you need to fetch that.
00:27:47.948 --> 00:27:51.867
If you start doing multiple levels, then you start to reveal a lot more.
00:27:51.867 --> 00:27:56.698
Secrets, but the fact that the whole DMP wasn't a major performance increase.
00:27:56.698 --> 00:28:07.028
It was just incremental performance increase leaving the DMP there, but taking away some of it's more aggressiveness wouldn't mitigate the entire DMP being there.
00:28:07.097 --> 00:28:08.397
It still has benefit.
00:28:08.847 --> 00:28:12.887
So if it was 1 percent overall, I'd be amazed.
00:28:13.468 --> 00:28:15.057
But that's the numbers we're working.
00:28:15.067 --> 00:28:18.748
They re architect an entire chip to get 2 or 3 percent speed boosts.
00:28:19.387 --> 00:28:24.117
It's all these 1 2% s on top of each other that give us the performance we have, today.
00:28:24.157 --> 00:28:27.718
And it's all these 1 or 2% s working together which reveal side channels.
00:28:27.962 --> 00:28:51.553
So Rob, I mean, is there a, uh, a macro symptom here that because we've become collectively shittier programmers and have moved to more map sets, dictionaries, things that use kind of this incoherent memory that we've now
designed chips basically to kind of enable that more rather than like, Hey, use a vector and use it right.
00:28:51.563 --> 00:28:53.252
And think about how to lay out your memory.
00:28:53.563 --> 00:28:55.323
did we back ourselves into this problem?
00:28:55.982 --> 00:29:06.518
We have backed ourselves into this problem to some extent by having generic But it's all to enable hardware to be a black box as software engineers like to look at it.
00:29:07.097 --> 00:29:13.948
If we go back to the early days, even not that early, even if you go back to like the 2000s, well, let's go to the game consoles.
00:29:13.958 --> 00:29:15.387
Let's even just, let's just look at these.
00:29:15.387 --> 00:29:16.928
These are concrete, Examples.
00:29:17.228 --> 00:29:26.028
The PC has always been on this generic model where it's, it'll just, the hardware will just figure out what your code does and you don't have to optimize your code, it'll do it for you.
00:29:26.038 --> 00:29:29.637
You can optimize for different things along the way on the Pentium.
00:29:29.978 --> 00:29:35.528
We used to optimize for UV pipes in execution, and then the Pentium Pro went to out of order execution.
00:29:35.528 --> 00:29:41.817
So then you have to optimize for D decode bandwidth because once it's decoded it to micro ops, it will execute them out of order.
00:29:42.097 --> 00:29:42.988
You have no control.
00:29:43.268 --> 00:29:43.788
over it.
00:29:44.137 --> 00:29:54.367
There are some optimizations you can do at a high level, which is what the compilers do to kind of encourage the reordering and after order execution to execute efficiently.
00:29:54.367 --> 00:30:01.218
But it's a very different optimization to what you were doing previously of counting cycles and UV pipe and schedule and things like that.
00:30:01.218 --> 00:30:02.968
And this was true on ARM.
00:30:02.968 --> 00:30:06.157
This was true on everything until they go to out of order.
00:30:06.198 --> 00:30:08.708
When they go to out of order, Optimizing becomes real hard.
00:30:08.718 --> 00:30:10.667
You kind of optimize for register pressure.
00:30:10.678 --> 00:30:13.657
You optimize for decoder bandwidth and things like that.
00:30:13.657 --> 00:30:16.817
And ARM and Intel today are no different, but that's the PC path.
00:30:16.827 --> 00:30:19.097
And all we're doing now is trying to get the most out of it.
00:30:19.097 --> 00:30:21.137
We can prefetch predictable access patterns.
00:30:21.137 --> 00:30:25.167
We do data dependent prefetching to find unpredictable access patterns.
00:30:25.688 --> 00:30:31.548
And it's just the next step along the way, and it just allows code to be code and just work.
00:30:32.268 --> 00:30:33.367
If we go back to.
00:30:34.057 --> 00:30:37.788
The PlayStation 2, for example, it had a scratch pad.
00:30:38.137 --> 00:30:43.778
Like it was a very fast cache performance level piece of memory.
00:30:43.788 --> 00:30:44.817
You could DMA into it.
00:30:44.817 --> 00:30:48.438
You could DMA out of it, and you would access it with the, uh, with the CPU.
00:30:48.938 --> 00:30:54.407
So you could pre, you could preload this thing with CPU instructions.
00:30:54.407 --> 00:30:57.887
You could preload it with DMA and then get very fast performance.
00:30:58.087 --> 00:31:00.407
So to write real fast engine code on the PlayStation 2.
00:31:01.472 --> 00:31:14.182
It was critical that you use the scratch pad and at Insomniac we ran the entire engine outta scratch Padd, it was over like 16 K, but we DM EDMA in like we have this list of things that need to be culled.
00:31:15.113 --> 00:31:18.383
So rather than go through them in memory and let them load into the cache in the natural way.
00:31:18.853 --> 00:31:22.673
And this was early days, so it was basically on demand caching.
00:31:22.673 --> 00:31:23.593
It was no prefetch.
00:31:23.593 --> 00:31:29.542
Rather than do that, we DMA 4k, 8k or something into the scratchpad, process it from the scratchpad.
00:31:29.762 --> 00:31:32.212
And then while we're doing that, we double buffer.
00:31:32.212 --> 00:31:35.558
So we, while we're processing buffer A with DMA and buffer B, and then we'd.
00:31:35.608 --> 00:31:37.048
We'd switch between them.
00:31:37.269 --> 00:31:42.028
We never missed the cache because we, uh,, always had the next buffer available when we got there.
00:31:42.038 --> 00:31:44.739
And then we'd size it based on how much work were we doing?
00:31:44.739 --> 00:31:46.118
How quick could we go through the list?
00:31:46.269 --> 00:31:48.388
How big was it was the list in total?
00:31:48.709 --> 00:31:50.439
how many working buffers did we need?
00:31:50.449 --> 00:31:54.429
If you need an input and output and a process buffer, then obviously you have to make them smaller.
00:31:54.429 --> 00:32:00.298
Cause they all have to fit in this 16 K and you can work out data structures for any scenario, which.
00:32:00.689 --> 00:32:01.709
fit in this model.
00:32:02.298 --> 00:32:13.398
Link lists are still really difficult because you can't DMA the next node until you've seen the current node, but you can't put the whole list in a small block and then move the whole thing into Scratchpad and then work it that way.
00:32:13.398 --> 00:32:20.679
It requires programmers to rethink all of the classical data structures to be like, how can we run this from Scratchpad?
00:32:20.679 --> 00:32:23.808
And then you get to the PlayStation 3, which had the SPUs.
00:32:23.808 --> 00:32:31.669
A lot of what we'd learned on the PS2 already applied to the PS3, because we already had the mindset of making these data structures, which could be DMA'd.
00:32:31.669 --> 00:32:34.898
The PS2 was slightly more difficult that it wasn't the same processor.
00:32:35.449 --> 00:32:39.459
At least on the PS2, it was the EE core that was accessing scratchpad.
00:32:39.459 --> 00:32:44.388
You was just doing DMA, effectively pre filling a cache in a way that made sense to you.
00:32:44.739 --> 00:32:51.939
So you controlled how you fill the scratchpad versus the cache hardware controlling how it filled the cache.
00:32:52.548 --> 00:32:53.169
And you could.
00:32:53.689 --> 00:32:56.909
Basically eliminate all stalls because we can make data that fits.
00:32:57.199 --> 00:33:00.308
Data structures were not designed to work in these.
00:33:00.338 --> 00:33:02.449
I know what I'm accessing, where and when.
00:33:02.449 --> 00:33:04.189
So I'll prefetch my data.
00:33:04.979 --> 00:33:13.138
The PC is always relied on the fact that it'll just figure it out and how well it figures it out is based on how well you write the code.
00:33:13.499 --> 00:33:16.084
So today you'll get more performance from a PC by.
00:33:16.794 --> 00:33:22.263
Semi optimizing your prefetch bandwidth and semi optimizing your access patterns.
00:33:22.854 --> 00:33:26.284
But you don't have to take it to the extreme that the early machines did.
00:33:27.003 --> 00:33:28.013
And, yeah, I do agree.
00:33:28.044 --> 00:33:35.374
We have become shittier programmers because we just write generic code for generic architecture and Intel and ARM are both in the same boat.
00:33:35.584 --> 00:33:41.384
They're both the same thing, RISC versus CISC is Been gone for years.
00:33:41.473 --> 00:33:45.683
anybody who argues, oh, it's a RISC chip, so it's better than an Intel chip is an idiot.
00:33:46.334 --> 00:33:49.183
The only real difference between the two chips is the decoder.
00:33:50.003 --> 00:33:54.284
Everything behind there is all state of the art out of order architecture.
00:33:54.489 --> 00:33:57.358
Let's double click a little bit more on the Intel side here.
00:33:57.358 --> 00:34:00.378
So why didn't Intel fall to the same issues?
00:34:00.378 --> 00:34:03.558
We've talked about it being less aggressive, but I think there's a little
00:34:03.653 --> 00:34:04.334
That's really it.
00:34:04.384 --> 00:34:10.844
Less aggressive makes it statistically more difficult to predict those patterns.
00:34:10.873 --> 00:34:15.083
Cause like I said, it's statistically analyzing what the prefetcher does.
00:34:15.083 --> 00:34:15.523
And if you're only.
00:34:16.193 --> 00:34:19.784
If you're less aggressive, it doesn't reveal, it's still revealing data.
00:34:19.784 --> 00:34:20.963
It's still filling the cache.
00:34:21.443 --> 00:34:29.463
It's just maybe impossible to analyze or needs more aggressive examples to be able to analyze.
00:34:30.018 --> 00:34:32.929
The signal to noise ratio is unfavorable in that case.
00:34:33.483 --> 00:34:33.934
Yeah.
00:34:34.164 --> 00:34:35.713
So they're not saying it can't be done.
00:34:35.733 --> 00:34:37.273
They're just saying that this code can't do it.
00:34:37.514 --> 00:34:48.864
right, you mentioned to me an interesting fact, which is that Intel will publish what they're going to do way ahead of time in a way to almost invite folks to critique their designs.
00:34:48.864 --> 00:34:50.974
And that seemed really interesting to me.
00:34:51.184 --> 00:34:57.023
I think that was like interesting difference of like, Hey, come take a look at it.
00:34:57.023 --> 00:35:00.353
Security folks, see what we could be doing wrong.
00:35:00.373 --> 00:35:02.483
And we'll take some feedback on these things.
00:35:02.483 --> 00:35:03.034
Absolutely.
00:35:03.063 --> 00:35:05.244
Intel have always been really good at doing that.
00:35:05.264 --> 00:35:09.434
They don't always publish upfront what they're going to do, obviously for competitive reasons.
00:35:09.963 --> 00:35:18.224
But they do to certain people and they also have lots of white papers on the general idea of what is a data dependent prefetcher
00:35:18.594 --> 00:35:18.994
Right.
00:35:21.193 --> 00:35:27.844
DMPs, data memory prefetchers, that go by various names, they have a white paper on how they work, what they do, and then prefetchers.
00:35:28.103 --> 00:35:34.634
People will comment on the white paper and say like, Oh, this could be a big problem or it's violating this or violating that.
00:35:34.704 --> 00:35:36.364
So in theory, this is how it works.
00:35:36.384 --> 00:35:40.364
And the implementation will be different from the initial white paper due to the feedback.
00:35:41.373 --> 00:35:45.114
And Intel have always had a lot of bells and whistles of like switch things on and off.
00:35:45.114 --> 00:35:48.153
So I'm not surprised that Intel could turn those off a lot easier.
00:35:48.204 --> 00:35:52.793
They also published a post white papers of the effect it had.
00:35:52.804 --> 00:35:54.824
You can see like exactly how it works.
00:35:54.923 --> 00:35:58.744
The performance increase, like it expected the performance increase that it got.
00:35:59.534 --> 00:36:00.853
Apple don't do any of this.
00:36:01.153 --> 00:36:01.534
Yeah,
00:36:01.563 --> 00:36:03.824
don't even know how Apple's DNP works.
00:36:03.914 --> 00:36:05.054
It's like, we have no idea.
00:36:05.074 --> 00:36:06.273
We have nobody was in there.
00:36:06.574 --> 00:36:09.614
We assumed it was there we had, because they don't tell us anything.
00:36:09.724 --> 00:36:12.773
It's like, Oh, it's better, better by whose standards.
00:36:13.273 --> 00:36:18.264
There's that culture, of wanting to create a big splash and it's secrecy culture, right?
00:36:18.614 --> 00:36:18.773
Yeah.
00:36:18.833 --> 00:36:21.773
The secrecy culture at this level for security cannot exist.
00:36:21.824 --> 00:36:26.583
They need to be more open into what they're doing and not rely on people.
00:36:27.148 --> 00:36:30.969
Basically side channel attacking it to see what it's doing.
00:36:31.148 --> 00:36:34.588
And this is the same for like, how big are the reorder buffers in the Apple chips?
00:36:34.759 --> 00:36:35.759
They never tell you.
00:36:35.798 --> 00:36:39.378
Like, how many reorder working registers does it have?
00:36:39.679 --> 00:36:40.248
They don't tell you.
00:36:40.838 --> 00:36:45.969
People figure it out by just
writing in creative sequences of code, and seeing how the performance changes.
00:36:45.978 --> 00:36:47.489
Again, it's a side channel attack.
00:36:47.498 --> 00:36:49.608
It's not a direct measure.
00:36:50.188 --> 00:37:06.893
It's It's like if I write code in this really academic, very inefficient, potentially, most likely, way, but I can see some measurable difference for when it runs out of internal renaming registers, then I can start to figure out how many of those registers there are.
00:37:07.494 --> 00:37:08.523
Apple could just tell us.
00:37:09.068 --> 00:37:10.068
We can figure it out.
00:37:10.099 --> 00:37:11.548
So they're not saving themselves.
00:37:11.599 --> 00:37:18.039
It's all they're doing is delaying people and in figuring out people figure these other things out too.
00:37:18.219 --> 00:37:18.889
So
00:37:19.063 --> 00:37:19.463
Right.
00:37:19.699 --> 00:37:20.778
just need to come clean.
00:37:20.869 --> 00:37:21.498
I've said it before.
00:37:21.498 --> 00:37:22.048
I'll say it again.
00:37:22.059 --> 00:37:22.668
I'll always say it.
00:37:22.708 --> 00:37:24.989
Apple suck that they don't document anything.
00:37:25.018 --> 00:37:29.599
I'm curious how much of this you think is, is really the, the culture and the hubris.
00:37:29.858 --> 00:37:32.539
And this isn't just Apple, this is the big tech problem.
00:37:32.704 --> 00:37:34.373
Oh, it's the culture full stop.
00:37:34.824 --> 00:37:36.393
It's the culture in Apple full stop.
00:37:36.423 --> 00:37:38.563
It's like, Oh, we'll add one of these.
00:37:38.563 --> 00:37:39.063
We'll do this.
00:37:39.063 --> 00:37:39.603
We'll do that.
00:37:39.634 --> 00:37:43.173
And all the people in Apple probably don't know what they're doing.
00:37:43.213 --> 00:37:49.684
Nevermind external, anybody external security, which is, as of the last on the list that Apple want to talk to
00:37:50.108 --> 00:37:57.108
It's fascinating because obviously a lot of the appeal of Apple is the vertical integration, the hey, we're secure.
00:37:57.108 --> 00:37:57.123
Right.
00:37:57.454 --> 00:38:04.514
It's this closed system, but it's a really interesting example of how this closed system actually creates these security issues.
00:38:04.923 --> 00:38:06.853
Which is driven by the secrecy.
00:38:07.034 --> 00:38:10.773
It's driven by probably managers who want to have it all.
00:38:10.804 --> 00:38:12.893
Oh, I'm 1 percent faster than Intel.
00:38:13.184 --> 00:38:17.003
Like, ah, that'll get me my, my promotion next year.
00:38:17.603 --> 00:38:22.530
Definitely some of that there for sure, but, security at any level cannot be done through secrecy.
00:38:22.530 --> 00:38:29.780
And if there's any effect on security, how it executes, what it executes, it has to be fully understood before it's released.
00:38:30.231 --> 00:38:38.311
And that goes to things like says leaking speculative data, things that you think like, oh, well, I didn't use this code path.
00:38:38.311 --> 00:38:39.251
So it doesn't matter.
00:38:39.251 --> 00:38:42.070
Was the mindset of the original speculation.
00:38:42.070 --> 00:38:52.070
It's like, we'll just throw that work away, but there are some visible side effects, which can reveal sequence if used correctly or incorrectly.
00:38:52.550 --> 00:38:53.130
And.
00:38:53.130 --> 00:38:53.960
That's the problem.
00:38:54.110 --> 00:39:00.181
I mean, one option could be if you pre fetch everything into a second cache, that was just for pre fetching, you had no other access to it.
00:39:00.931 --> 00:39:05.460
All it did was pre fetch into this cache, and then if you use it, transfer to the real cache.
00:39:05.771 --> 00:39:07.630
If you used it, so it could be done real quick.
00:39:07.630 --> 00:39:12.041
That would solve, that would solve a lot of pre fetching problems, of speculation, attack problems.
00:39:12.570 --> 00:39:13.621
That's a hardware solution.
00:39:14.021 --> 00:39:15.485
That's all, That's a hardware fix.
00:39:15.485 --> 00:39:20.440
And it's a cache that you could be using for general cache, which would make everything slightly faster.
00:39:21.360 --> 00:39:27.701
But now you've got this huge cache, which is just sitting there as a prefetch buffer, which you have no internal access to, but things like that.
00:39:27.701 --> 00:39:33.130
Like it's architectural difference from what we currently do, which fixes some problems.
00:39:33.130 --> 00:39:36.331
It may also reveal all the problems, is it worth it?
00:39:36.581 --> 00:39:39.740
Is it worth having another megabyte cache where we could have a two megabyte cache?
00:39:40.070 --> 00:39:41.170
Everything gets faster.
00:39:41.251 --> 00:39:50.431
We'll have, Some of the visible side channels, no matter what you do over the directly executing instructions as they are, it's going to have something that could be attacked.
00:39:50.626 --> 00:40:01.735
But, again, in the difference with the Intel example, it's, you know, or not those statistics are raised to a level of detection, depends upon like how you actually approach this.
00:40:01.746 --> 00:40:05.976
So, I mean, Intel gets away with it by virtue of the fact that it's not as aggressive.
00:40:06.025 --> 00:40:06.235
Yeah.
00:40:06.235 --> 00:40:09.175
By being less aggressive, they avoided some of these problems.
00:40:09.215 --> 00:40:18.206
And it's, it's a case of when they first found Spectre, they found it on, I think And then they, Oh, Intel have the same problem.
00:40:18.206 --> 00:40:24.936
Oh, ARM have the same problem because everybody was doing the same speculation with the same side effects.
00:40:24.936 --> 00:40:28.706
And then it's like, Oh, you know, well, all modern processors are affected by Meltdown and Spectre.
00:40:29.255 --> 00:40:33.396
A lot of different fixes were put in for specter mitigation things.
00:40:33.715 --> 00:40:39.315
the way it's changing the way speculation worked, but again, it was new hardware, not old hardware, although it still has the same problems.
00:40:40.005 --> 00:40:42.106
You could change software to mitigate it.
00:40:42.126 --> 00:40:43.896
You couldn't prevent it, but you could mitigate it.
00:40:44.565 --> 00:40:46.235
And we kind of moved on from it.
00:40:46.235 --> 00:40:47.346
I think this will be the same thing.
00:40:47.376 --> 00:40:49.056
New hardware won't have these problems.
00:40:49.056 --> 00:40:56.456
It'll either have controls or it'll have less aggression and software will get changed to make it so it's statistically.
00:40:56.891 --> 00:41:09.215
Next to impossible to get the keys and we'll move on it'll just be a blip in history, but it could have been Prevented it to some extent if Apple would have been more open as to how their system works Like we still don't know how it works.
00:41:09.226 --> 00:41:18.501
I mean we haven't reverse engineered it We don't know that Intel aren't doing what Apple's doing and we don't know why Intel is immune to this particular attack, but Apple isn't.
00:41:18.501 --> 00:41:22.440
We don't have any architectural details as to what they're actually doing.
00:41:22.471 --> 00:41:23.920
And we don't know what's the trigger.
00:41:24.271 --> 00:41:29.871
We assume it's Intel's being less aggressive and they're not doing dependent dependent lookups, but we don't know.
00:41:30.701 --> 00:41:35.541
All we know is statistically, we can't get the data out of Intel, but we can get it out of Apple.
00:41:36.260 --> 00:41:40.041
It'd be nice if we could have an architectural review of both and see what the trigger is.
00:41:40.070 --> 00:41:40.391
Okay.
00:41:40.451 --> 00:41:40.641
This.
00:41:41.251 --> 00:41:47.351
One tiny feature, it's probably insignificant feature is what's making Intel, Apple not.
00:41:47.900 --> 00:41:51.391
We don't know because we always have reverse engineered how they both work.
00:41:51.451 --> 00:41:55.371
From a cultural standpoint, is Apple an outlier or is it like everyone else?
00:41:55.380 --> 00:42:09.860
Meaning like we've talked about how it's different from Intel, but you know, Nvidia, AMD arm, like, do they tend to be more like Intel in terms of their here's how it works or more like Apple in terms of no, trust us, we've closed it all off or somewhere in between.
00:42:09.860 --> 00:42:13.871
AMD is usually the most open of everybody.
00:42:13.920 --> 00:42:19.630
Fact that they have open source video drivers, they started to open source the firmware inside the GPU.
00:42:20.081 --> 00:42:23.740
They started to open source lots of little bits that you would normally not have access to.
00:42:23.780 --> 00:42:28.951
I think AMD's ultimate goal is to have an open source from first instruction.
00:42:29.521 --> 00:42:31.581
Everything running could be open source.
00:42:32.240 --> 00:42:35.621
And that includes like board management and firmware and.
00:42:36.001 --> 00:42:37.351
BIOS and everything.
00:42:37.760 --> 00:42:40.501
So AMD have all traditionally always been a lot
better.
00:42:40.621 --> 00:42:49.661
I think Intel, if you sign the correct NDAs and you have platform integrator or a system vendor, then you get that same level of access, but not open source.
00:42:49.951 --> 00:42:50.530
Hmm.
00:42:50.760 --> 00:42:53.891
do give you that access, just not in an open source way.
00:42:53.940 --> 00:42:56.510
AMD tend to, A, they have the same NDAs too.
00:42:56.510 --> 00:42:58.380
If you need access to stuff, that's not open source.
00:42:58.951 --> 00:43:02.471
But AMD is going down the path of we'll just open source all of it in the end.
00:43:02.471 --> 00:43:05.871
And there's legal issues, legal reviews and things like that.
00:43:05.871 --> 00:43:08.971
I assume is what stops them just going, fuck it, open source everything.
00:43:09.481 --> 00:43:10.771
AMD is traditionally a lot better.
00:43:11.351 --> 00:43:15.775
Intel do give you the access with the correct, NDAs and, uh, licensing.
00:43:15.896 --> 00:43:16.976
Apple, zero.
00:43:16.976 --> 00:43:17.356
Got it.
00:43:18.650 --> 00:43:26.349
the flaw is present on the iPhone, but there's no attack vector because you can't get the same access that we know of, correct?
00:43:26.349 --> 00:43:27.920
Potentially, it's definitely there.
00:43:27.920 --> 00:43:30.869
I mean, the M series and the A series are kind of the same cause.
00:43:30.869 --> 00:43:34.980
just to have that package in the SOC is different speeds and things like that are different.
00:43:35.130 --> 00:43:44.570
Cash sizes of caches are different, but front architecturally, the same things, the firestorm, ice storm, low performance, high performance calls are the same between the M's and the A's.
00:43:45.230 --> 00:43:49.329
So yes, this problem does exist on the iPhone Debatable whether the attack vector exists.
00:43:49.530 --> 00:43:51.530
It's hard to run background processes on
00:43:51.704 --> 00:43:52.204
On iOS,
00:43:52.360 --> 00:43:52.820
a.
00:43:52.994 --> 00:43:53.275
yeah.
00:43:54.034 --> 00:43:57.114
On the iPhone, it's hard to just know what it's doing at any given time.
00:43:57.114 --> 00:43:58.175
Like, is it running right now?
00:43:58.175 --> 00:43:59.375
Is it not running right now?
00:43:59.375 --> 00:44:01.905
Where on OS X, it's a lot easier to do that.
00:44:02.605 --> 00:44:07.994
So if you can get the apps to run at the same time, the same problem exists on iPhone.
00:44:07.994 --> 00:44:13.105
It's just the vector is a lot more complicated due to the user interface and backgrounding of tasks and things like that.
00:44:13.105 --> 00:44:15.025
But in theory, it does exist.
00:44:15.335 --> 00:44:15.844
Got it.
00:44:16.985 --> 00:44:19.355
Well, folks, I think that's a good lesson.
00:44:19.585 --> 00:44:21.454
Watch out for what you're downloading.
00:44:21.735 --> 00:44:26.125
recognize that issues exist.
00:44:26.385 --> 00:44:28.885
This is just a part of computing.
00:44:29.375 --> 00:44:37.414
It's been a part of computing and it's a balance back
and forth between performance security and, know, in many ways, the hubris side of things.
00:44:37.414 --> 00:44:43.385
And I will also throw out that, The people who found the problem did do this responsible disclosure to Apple.
00:44:43.425 --> 00:44:50.684
They told Apple about this in December of 23, 107 days before it was publicly released.
00:44:50.715 --> 00:44:52.875
So Apple did have time to start implementing mitigations.
00:44:53.824 --> 00:44:59.974
So by the time this hit the public, a lot of this was already mitigated, not fixed.
00:45:00.344 --> 00:45:01.114
But mitigated.
00:45:01.284 --> 00:45:06.605
they are definitely still attack vectors, but some of them will have been removed.
00:45:06.614 --> 00:45:10.905
The most common uses of the attack vector will have been mitigated.
00:45:11.534 --> 00:45:14.775
So it's not as dangerous as it sounds, but it's still a big problem.
00:45:15.364 --> 00:45:17.784
Hopefully by the M4, we'll have it all fixed, right?
00:45:17.784 --> 00:45:29.724
Well, I assume they're going back now and redesigning a lot of the M4 to fix this problem, or at least have page memory, page controls on off controls, constant time execution, whatever it may be that they're going to have to add to it.
00:45:30.275 --> 00:45:31.534
To get some of this to work.
00:45:32.235 --> 00:45:33.735
and M4 might be too close.
00:45:33.755 --> 00:45:34.896
It might be M5.
00:45:34.896 --> 00:45:37.835
That's going to have changes because M4 would have already been laid out by now.
00:45:38.005 --> 00:45:39.856
a, that's going to be an interesting question, I think.
00:45:39.925 --> 00:45:45.856
Uh, do you think, Rob, this is actually enough to either delay the M4?
00:45:47.021 --> 00:45:56.110
prompt a change in culture to be if not completely open, but more open, maybe on the level of Intel NDAs.
00:45:56.655 --> 00:45:57.596
Never going to happen.
00:45:58.365 --> 00:45:59.186
Never going to happen.
00:46:00.365 --> 00:46:01.655
Apple are never going to be open.
00:46:01.655 --> 00:46:02.815
It's just not in their culture.
00:46:02.846 --> 00:46:04.255
They just don't know how to do it.
00:46:04.255 --> 00:46:22.106
I find it fascinating maybe on a, on a long term scale then, because it really is almost a conflict in my mind between this desire for vertical integration that Apple has been going after forever, and as well as them touting themselves to be the most superior in security.
00:46:22.536 --> 00:46:27.195
It feels like one of those two things are going to have to Oh, plus the secrecy.
00:46:27.206 --> 00:46:29.726
It seems like one of those three things is going to have to break.
00:46:30.005 --> 00:46:32.425
And in this case, it broke the security side.
00:46:32.425 --> 00:46:40.876
Yeah, it's they, I just wish they were more open, more analysis and more investigations into what they're doing would put people's mind at risk.
00:46:40.885 --> 00:46:46.846
Cause we know like a lot of this good security is from the fact that they don't document anything.
00:46:46.856 --> 00:46:49.675
And it's not that any more secure than anybody else.
00:46:49.675 --> 00:46:55.135
Once you dive into the details, it's just getting access is difficult, which is a level of security.
00:46:55.146 --> 00:46:57.166
It shouldn't be the ultimate level of security.
00:46:57.865 --> 00:47:00.135
The old security by obscurity line.
00:47:00.135 --> 00:47:00.385
Yep.
00:47:00.675 --> 00:47:01.126
Don't do it.
00:47:01.126 --> 00:47:02.985
I mean, it helps, but don't rely on it.