Re:What Adrian Did Next – Part 2 – Sun Microsystems
by bri3d on Sunday January 21, 2024 @06:04PM
(#39083982)
SPARC had instructions (BP, Branch with Prediction) which hinted the branch predictor whether the branch was likely or unlikely. Presumably this script just edited the opcodes in memory to avoid needing to figure out how to change the generated code from the compiler, recompile, and replace the kernel.
Re:What Adrian Did Next – Part 2 – Sun Microsystems
by gumby on Sunday January 21, 2024 @05:51PM
(#39083906)
IIRC you specified the likely path in assembly code, but not all SPARCs had those opcodes. They were some sort of extention. By default they had simple fixed prediction (branch would not be taken, backwards branch would be taken etc).
Some of the pentium series also had settable branch prediction bias flags.
Re:What Adrian Did Next – Part 2 – Sun Microsystems
by Thorrez on Sunday January 21, 2024 @05:32PM
(#39083758)
I would assume you have to be root to do this branch predictor stuff. If you're root, why do you need Spectre? If you're attacking some trusted execution thing, then I assume you wouldn't be able to do the branch predictor stuff.
Re:What Adrian Did Next – Part 2 – Sun Microsystems
by hackmiester on Sunday January 21, 2024 @05:46PM
(#39083874)
Because you might be root in one VM or container, and you are trying to access another VM or container.
Re:What Adrian Did Next – Part 2 – Sun Microsystems
by Thorrez on Sunday January 21, 2024 @06:17PM
(#39084073)
Oh, interesting. I wonder if the hypervisor would be able to prevent the VM from using those features of the CPU.
Re:What Adrian Did Next – Part 2 – Sun Microsystems
by 1oooqooq on Monday January 22, 2024 @01:14AM
(#39086861)
it usually does not. reason why you run security analysts of untrusted code first in a qemu without virtualization.
Re:What Adrian Did Next – Part 2 – Sun Microsystems
by kramerger on Monday January 22, 2024 @02:34AM
(#39087244)
While your hypervisor may not implement it, ARM allows you to configure this kind of operations.
See for example
https://developer.arm.com/documentation/ddi0595/2020-12/AArc...
Re:What Adrian Did Next – Part 2 – Sun Microsystems
by 1oooqooq on Monday January 22, 2024 @08:30AM
(#39089328)
oh qemu supports this alright, since 8.x
but good luck 1. having a cpu with it (can't wait for arm laptops and needing caniuse.org for my assembly code), and 2. figuring out how to use it
Re:What Adrian Did Next – Part 2 – Sun Microsystems
by saagarjha on Sunday January 21, 2024 @06:13PM
(#39084048)
Most processors have hint instructions that let you tell it which branch you think will be likely.
Re:What Adrian Did Next – Part 2 – Sun Microsystems
by hindsightbias on Sunday January 21, 2024 @06:10PM
(#39084034)
It would seem more likely to be a scsi/kex timing issue and there are direct hacks into that when you have a loose dev/kmem philsophy.
If you are/can directly hack the pipeline, Adrian better have included that script in the bmark publish. Probably not, because then directors would be calling him at 2am because XYZ corps workload was slow and “could we have your nop script?”
Re:What Adrian Did Next – Part 2 – Sun Microsystems
by adrianco on Monday January 22, 2024 @12:04AM
(#39086440)
These were simpler RISC implementations in those days, the compiler optimizer stage was in charge of deciding whether to set the branch bit or not, and the prefetch would do what the bit said, and stall if it got it wrong.
SPARC exposed read and write access to branch prediction!? That's... fascinating. Here I thought branch prediction was always a completely opaque thing that the CPU did internally and maybe if you were lucky it might let the program be able to know that it was happening after the fact. Hm... I wonder if it's easier to perform Spectre type attacks if you can just ask the CPU about that kind of behavior? No need to do timing attacks if the CPU will just tell you