Earlier quoted context omitted.
One piece of friction that hurts here is that the C++/Rust and ARM memory models aren't the same, and the consequences of this are unintuitive - compilers and CPUs can both screw with execution ordering. People who write in C++ should technically _only_ be concerned with the C++ memory model, but x86 has let them be very lax and undisciplined with std::memory_order_relaxed. ARM has some alluring constructs that don't…
ARMv8 basically exactly mirrors the C++ memory model without any explicit memory orderings (the default on atomics being sequentially consistent).
A bug that doesn’t exist on x86: Exploiting an ARM-only race condition
131–140 of 141 posts
Re: A bug that doesn’t exist on x86: Exploiting an ARM-only race condition
#132Earlier quoted context omitted.
It's not "don't invent it". It's "be competent before you invent it, because it's hard". And if you aren't, then let someone who is do the inventing.
the best way to _get_ competent is to try so yes - invent your own synchronization primitives. please. just dont believe they are correct without being serious about trying to prove they are. and dont hold up your whole project for self-enrichment. but try to layer as much in as you can. developers these days are so productive, until they fall down and cant get up. and then they are completely useless.
Re: A bug that doesn’t exist on x86: Exploiting an ARM-only race condition
#133Earlier quoted context omitted.
But Peterson's algorithm requires explicit memory barriers even on x86, it doesn't seem the best example to show the difference.
Here are my slides from back then: https://reinference.net/mp-talk.pdf You made me wonder, because I definitely remember using Peterson's Algorithm, so I went back to my slides and turns out: I first showed the problem with x86, then indeed added an MFENCE at the right place, and then showed how that was not enough for ARM. So the point back then was to show how weaker memory models can bite you with the example of x…
Re: A bug that doesn’t exist on x86: Exploiting an ARM-only race condition
#134Either I'm not understanding something that I thought I understood very well, or TFA's author's don't understand something that they think they understand very well. Their code is unsafe even on x86. You cannot write a single-writer, single-reader FIFO on modern processors without the use of memory barriers. Their attempt to use "volatile" instead of memory barriers is not appropriate. It could easily cause problems…
I think their point is you only need compiler barriers not actual barrier instructions on x86. volatile in practice has been the de facto way to get the effect of a compiler memory barrier for a long time even though it's not the best way to do it nowadays. The original purpose of it is literally preventing the compiler from getting rid of loads and stores and reordering them which is exactly what is needed when impl…
See [1] for example the implementation of smp_store_release and smp_load_acquire in the linux kernel (barrier() is just a compiler barrier and {READ,WRITE}_ONCE are a cast to volatile).
Volatile only prevents reordering of volatile statements (and IO), not all load and stores.
[1] https://elixir.bootlin.com/linux/latest/source/tools/arch/x8...
Re: A bug that doesn’t exist on x86: Exploiting an ARM-only race condition
#135Earlier quoted context omitted.
To draw together the two answers here to the original question. 1) Emulating an ISA includes emulating its memory model. As saagarjha says, this means that Rosetta 2 must (and does) correctly implement total store ordering. 2) There are various ways to implement this. For emulators that include a binary translation layer (that is, that translate x86 opcodes into a sequence of ARM opcodes), one route is to generate th…
TSO is a per-thread flag; it’s implemented as a write to a MSR on context switch to switch it on or off.
Re: A bug that doesn’t exist on x86: Exploiting an ARM-only race condition
#136Earlier quoted context omitted.
the best way to _get_ competent is to try so yes - invent your own synchronization primitives. please. just dont believe they are correct without being serious about trying to prove they are. and dont hold up your whole project for self-enrichment. but try to layer as much in as you can. developers these days are so productive, until they fall down and cant get up. and then they are completely useless.
Disagreed. There are some problems, and low level hardware is one of them, where you need understanding and not just experience.
Re: A bug that doesn’t exist on x86: Exploiting an ARM-only race condition
#137Earlier quoted context omitted.
the best way to _get_ competent is to try so yes - invent your own synchronization primitives. please. just dont believe they are correct without being serious about trying to prove they are. and dont hold up your whole project for self-enrichment. but try to layer as much in as you can. developers these days are so productive, until they fall down and cant get up. and then they are completely useless.
Disagreed. There are some problems, and low level hardware is one of them, where you need understanding and not just experience.
Re: A bug that doesn’t exist on x86: Exploiting an ARM-only race condition
#138Re: A bug that doesn’t exist on x86: Exploiting an ARM-only race condition
#139Earlier quoted context omitted.
A Dataflow architecture ISA would. It's been tried before. But, working out the entire software stack from scratch is a moonshot.
High-performance processors are data flow processors, which infer the data flow graph from the instruction stream using Tomasulo's algorithm.
Re: A bug that doesn’t exist on x86: Exploiting an ARM-only race condition
#140Earlier quoted context omitted.
Disagreed. There are some problems, and low level hardware is one of them, where you need understanding and not just experience.
so what would qualify one to do this kind of work? a graduate class in parallel programming?
- For low level hardware grovelling, you need a sufficient understanding of the workings of modern chip internals.
- For crypto, another "don't invent your own" thing, probably a specialised degree in cryptography and a lot of practical experience.
The bar is simply higher than "I have access to a programming language and think my idea would work".