Re:Branch Privilege Injection: Exploiting branch predictor r...
by formerly_proven on Tuesday May 13, 2025 @01:12PM
(#43975255)
Prepare for another dive maneuver in the benchmarks department I guess.
[ Parent
| on HN ]
Re:Branch Privilege Injection: Exploiting branch predictor r...
by cenamus on Tuesday May 13, 2025 @01:14PM
(#43975288)
And if not, why did they introduce severe bugs for a tiny performance improvement?
Re:Branch Privilege Injection: Exploiting branch predictor r...
by bloppe on Tuesday May 13, 2025 @01:27PM
(#43975431)
It's not tiny. Speculative execution usually makes code run 10-50% faster, depending on how many branches there are
Re:Branch Privilege Injection: Exploiting branch predictor r...
by bee_rider on Tuesday May 13, 2025 @01:40PM
(#43975576)
Yeah… folks who think this is just some easy to avoid thing should go look around and find the processor without branch prediction that they want to use.
On the bright side, they will get to enjoy a much better music scene, because they’ll be visiting the 90’s.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by wbl on Tuesday May 13, 2025 @10:59PM
(#43980279)
IBM Stretch had branch prediction. Pentium in the early 1990s had it. It's a huge win with any pipelining.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by yencabulator on Wednesday May 14, 2025 @10:29AM
(#43984984)
> Does Branch Privilege Injection affect non-Intel CPUs?
> No. Our analysis has not found any issues on the evaluated AMD and ARM systems.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by titzer on Tuesday May 13, 2025 @04:52PM
(#43977596)
That's a vast underestimate. Putting in lfence before every branch is on the order of 10X slowdown.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by grumbelbart2 on Wednesday May 14, 2025 @03:56AM
(#43982052)
There is of course a slight chicken-egg-thing here: If there was no (dynamic) branch prediction, we (as in compilers) would emit different code that is faster for non-predicting CPUs (and presumably slower for predicting CPUs). That would mitigate a bit of that 10x.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by anyfoo on Wednesday May 14, 2025 @06:12PM
(#43989729)
A bit. I think we've shown time and time again that letting the compiler do what the CPU is doing doesn't work out, most recently with Itanium.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by thesz on Wednesday May 14, 2025 @12:29PM
(#43986446)
The issue is with indirect branches. Most branches are direct ones.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by autoexec on Tuesday May 13, 2025 @07:08PM
(#43978830)
How much improvement would there still be if we weren't so lazy when it comes to writing software. If we were working to get as much performance out of the machines as possible and avoiding useless bloat instead of just counting on the hardware to be "good enough" to handle the slowness with some grace.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by cenamus on Wednesday May 14, 2025 @01:20PM
(#43987020)
Of course I know that.
But if the fix for this bug (how many security holes have ther been now in Intel CPUs? 10?) brings only a couple % performance loss, like most of the them so far, how can you even justify that at all? Isn't there a fundamental issue in there?
Re:Branch Privilege Injection: Exploiting branch predictor r...
by umanwizard on Tuesday May 13, 2025 @05:49PM
(#43978151)
A modern processor pipeline is dozens of cycles deep. Without branch prediction, we would need to know the next instruction at all times before beginning to fetch it. So we couldn’t begin fetching anything until the current instruction is decoded and we know it’s not a branch or jump. Even more seriously, if it is a branch, we would need to stall the pipeline and not do anything until the instruction finishes executing and we know whether it’s taken or not (possibly dozens of cycles later, or hundreds if it depends on a memory access). Stalling for so many cycles on every branch is totally incompatible with any kind of modern performance. If you want a processor that works this way, buy a microcontroller.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by superblas on Tuesday May 13, 2025 @08:07PM
(#43979287)
> If you want a processor that works this way, buy a microcontroller.
The ARM Cortex-R5F and Cortex-M7, to name a few, have branch predictors as well, for what it’s worth ;)
Re:Branch Privilege Injection: Exploiting branch predictor r...
by jeffbee on Tuesday May 13, 2025 @09:51PM
(#43979882)
You can still have a static branch predictor. That has surprisingly good coverage. I'm not saying this is a great idea, just pointing it out.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by tremon on Wednesday May 14, 2025 @10:20AM
(#43984889)
But branch prediction doesn't necessarily need complicated logic. If I remember correctly (it's been 20 years since I read any papers on it), the simple heuristic "all relative branches backwards are taken, but forward and absolute branches are not" could achieve 70-80% performance of the state-of-the-art implementations back then.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by anyfoo on Wednesday May 14, 2025 @06:14PM
(#43989740)
Do you mean overall or localized to branch prediction? Assuming all of that is true, you're talking about a 20-30% performance hit?
Re:Branch Privilege Injection: Exploiting branch predictor r...
by tsukikage on Tuesday May 13, 2025 @07:27PM
(#43979009)
We need software and hardware to cooperate on this. Specifically, threads from different security contexts shouldn't get assigned to the same core. If we guarantee this, the fences/flushes/other clearing of shared state can be limited to kernel calls and process lifetime events, leaving all the benefits of caching and speculative execution on the table for things actually doing heavy lifting without worrying about side channel leaks.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by tankenmate on Wednesday May 14, 2025 @02:51AM
(#43981598)
I get you, but devs struggle to configure nginx to serve their overflowing cauldrons of 3rd party npm modules of witches incantations. Getting them securely design and develop security labelled cgroup based micro (nano?) compute services for inferencing text of various security levels is beyond even 95% of coders. I'd posit that it would be a herculean effort even for 1% devs.
Just fix the processors?
Re:Branch Privilege Injection: Exploiting branch predictor r...
by tsukikage on Wednesday May 14, 2025 @05:28AM
(#43982574)
It's not a "just" if the fix cripples performance; it's a tradeoff. It is forced to hurt everything everywhere because the processor alone has no mechanism to determine when the mitigation is actually required and when it is not. It is 2025 and security is part of our world; we need to bake it right into how we think about processor/software interaction instead of attempting to bolt it on after the fact. We learned that lesson for internet facing software decades ago. It's about time we learned it here as well.
Re:Branch Privilege Injection: Exploiting branch predictor r...
by tankenmate on Wednesday May 14, 2025 @07:30AM
(#43983209)
Is the juice worth the squeeze? Not everything needs Orange Book (DoD 5200.28-STD) Class B1 systems.