Live data from Hacker News

A survey of attacks against Intel x86 over last 10 years (2015) [pdf]

blog.invisiblethings.org

21–30 of 41 posts

Re: A survey of attacks against Intel x86 over last 10 years (2015) [pdf]

#21
post #12
post #7

Earlier quoted context omitted.

RISC-V inherited all the bad ideas of x86 by now. It has an SMM equivalent, a separate hypervisor mode (instead of full orthogonality which lets you get away without one), resident firmware code outside the OS' control, ...

Please don't spread misinformation. RISC-V has a well-thought out machine layer which is open source in all existing implementations[1]. You can easily modify the M layer if it's interfering with the performance or security of your OS. The virtualization extension hasn't been finalized (but they are working with key KVM people), but it will perform a lot better than a theoretically pure self-virtualizable ISA. [1] ht…

"please don't spread misinformation" followed by confirming that all the mis-features I mentioned exist? (just that you disagree about them being mis-features)

How can I run Linux on RISC-V portably without having to implement the SBI?

Re: A survey of attacks against Intel x86 over last 10 years (2015) [pdf]

#22
post #2

x86 has had a good run. But it's time for it to go. I'm hopeful for RISC-V.

Nice, I hadn't looked at RISC-V before.

The operation of FENCE.I scares me a little:

> FENCE.I does not ensure that other RISC-V harts’ instruction fetches will observe the local hart’s stores in a multiprocessor system. To make a store to instruction memory visible to all RISC-V harts, the writing hart has to execute a data FENCE before requesting that all remote RISC-V harts execute a FENCE.I

Yikes. That sounds cumbersome for multithreaded code patching systems, like modern JIT compilers. (A "hart" here is a hardware thread.) Sounds like all threads must poll periodically to check whether they should run a FENCE.I, and when they do so, they report that they've done it. Doesn't sound like a lot of fun to implement, though maybe better in software than hardware?

Re: A survey of attacks against Intel x86 over last 10 years (2015) [pdf]

#23
post #14

Earlier quoted context omitted.

No they really cannot. Many of the optimizations CPU do on the fly are akin to JIT recompilers. (in microcode and schedule side) These cannot be effectively done ahead of time yet, at least not without an instruction accurate profiling. Not to mention VLIW wastes CPU instruction cache for instructions that aren't ran. It is no accident that CPUs and compilers gravitated towards RISC.

Well, no, point of VLIW is that instead of doing it like a JIT recompiler you do it like a slow recompiler. This is almost always possible and can be done ahead of time. Proof: The CPU itself does it under time constraint, a compiler should be capable of the same minus time constraint. VLIW also doesn't really waste instruction cache if your compiler is being smart and aligns branches to an instruction word, though y…

Your proof is flawed. The CPU has access to the complete current program state, and also complete knowledge of its own hardware. A static compiler has neither. Therefore, it's not at all clear that a compiler can do whatever the CPU can do.

Example: the best order to run a sequence of instructions could depend on which inputs happen to be in the L1 cache at the time. This could differ from one execution to the next. There's no way for a static compiler to get this right.

Re: A survey of attacks against Intel x86 over last 10 years (2015) [pdf]

#24
post #11
post #2

x86 has had a good run. But it's time for it to go. I'm hopeful for RISC-V.

I'm putting my bets on Mill winning the race eventually. Not only Mill, Microsoft has been working on a VLIW too (yes I know, not exactly VLIW, it's close enough). IMO these ISA's are the future, compilers and programming languages are nowadays smart enough to be able to figure out how to handle VLIW compilation (plus having learned from Itanium's failures).

Mill is awesome. I'm afraid it has too many revolutionary ideas in one package, though, which could impede its widespread adoption.

Re: A survey of attacks against Intel x86 over last 10 years (2015) [pdf]

#25
Words are not enough to express my deep and profound disgust of all those morons abusing "... considered harmful". It's somewhat ok, if it was brought up years ago and counts as legacy. But for any new abuse all I find are the words of Honeybunny https://genius.com/Tim-roth-pumpkin-and-honey-bunny-annotate...

Re: A survey of attacks against Intel x86 over last 10 years (2015) [pdf]

#27
post #21
post #12

Earlier quoted context omitted.

Please don't spread misinformation. RISC-V has a well-thought out machine layer which is open source in all existing implementations[1]. You can easily modify the M layer if it's interfering with the performance or security of your OS. The virtualization extension hasn't been finalized (but they are working with key KVM people), but it will perform a lot better than a theoretically pure self-virtualizable ISA. [1] ht…

"please don't spread misinformation" followed by confirming that all the mis-features I mentioned exist? (just that you disagree about them being mis-features) How can I run Linux on RISC-V portably without having to implement the SBI?

You said:

> It has an SMM equivalent,

It really doesn't. It has an open source layer under supervisor mode which works with the OS. This is very different from Intel SMM, a closed source blob that acts against the interests of the OS and the end user.

> a separate hypervisor mode (instead of full orthogonality which lets you get away without one),

As others pointed out also, this is plain wrong.

> resident firmware code outside the OS' control, ...

As explained, it has an open source machine mode, and we regularly modify both OS and machine mode to work together.

> How can I run Linux on RISC-V portably without having to implement the SBI?

Why would you want to? Porting Linux to M mode is going to be tricky because there's no paging, but other OSes could run there.

Re: A survey of attacks against Intel x86 over last 10 years (2015) [pdf]

#28
post #22
post #2

x86 has had a good run. But it's time for it to go. I'm hopeful for RISC-V.

Nice, I hadn't looked at RISC-V before. The operation of FENCE.I scares me a little: > FENCE.I does not ensure that other RISC-V harts’ instruction fetches will observe the local hart’s stores in a multiprocessor system. To make a store to instruction memory visible to all RISC-V harts, the writing hart has to execute a data FENCE before requesting that all remote RISC-V harts execute a FENCE.I Yikes. That sounds cum…

I don't know enough to say if this is accurate or not. However there are working groups reviewing the memory model[1] (also implementing fast ISRs[2]) so if there are performance problems in this area then they're being looked at.

[1] https://content.riscv.org/wp-content/uploads/2018/05/14.25-1... https://content.riscv.org/wp-content/uploads/2018/05/10.40-1...

[2] https://content.riscv.org/wp-content/uploads/2018/05/08.45-0...

Re: A survey of attacks against Intel x86 over last 10 years (2015) [pdf]

#29
post #23
post #14

Earlier quoted context omitted.

Well, no, point of VLIW is that instead of doing it like a JIT recompiler you do it like a slow recompiler. This is almost always possible and can be done ahead of time. Proof: The CPU itself does it under time constraint, a compiler should be capable of the same minus time constraint. VLIW also doesn't really waste instruction cache if your compiler is being smart and aligns branches to an instruction word, though y…

Your proof is flawed. The CPU has access to the complete current program state, and also complete knowledge of its own hardware. A static compiler has neither. Therefore, it's not at all clear that a compiler can do whatever the CPU can do. Example: the best order to run a sequence of instructions could depend on which inputs happen to be in the L1 cache at the time. This could differ from one execution to the next.…

You don't need access to the full current program state, most of OOE can be done with simple graph coloring and the knowledge of the number of registers. A static compiler will know the number of registers available as well as several other hardware intrinsic features (after all it has to use them).

On a VLIW a lot more features would be necessarily exposed and the compiler will have to take advantage of them.

Your example can be optimized by a compiler trivially by optimizing for cache-locality, something compilers already do. It simply means that if you access memory address X and your code accesses this code elsewhere, the compiler will try to keep those two closer together.

Making a simple prediction about cache contents is trivial for compilers and as mentioned, already happens. You can use graphs to build up dependencies on memory and then reduce the distance between connected node points in the execution path. Since this is VLIW and we might be able to tell the CPU which branch is likely we can even not do this in favor of optimizing the happy path better.

A modern optimizer is a very complex beast, it can certainly know some things about the state of the program during runtime and it will make some assumptions about it (enable -O3 if you want to test). Most certainly it is able to optimize your example in atleast a minimal fashion on more aggressive settings.

The CPU pipeline to my knowledge does not optimize by L1 cache as checking contents of the L1 cache is still rather expensive and the lookahead in the command queue is usually limited to a few hundred instructions. Hitting L1 is still a magnitude slower than hitting a register and very expensive to do for every memory access instruction. The pipeline tends to favor using branch predictors and register dependencies, which is simpler and faster, as well as some historical data about previous code run.

Re: A survey of attacks against Intel x86 over last 10 years (2015) [pdf]

#30

...if I have to endure one more abuse of the "considered harmful" idiom, I'm going to puke.

I feel that - normally it's hyperbole - but a full Minix OS with an IP stack we don't have control over on all our servers is actually pretty harmful.
Post reply on HN