3 ms·
I am the author of this article. Sorry for the misleading article. First, I admitted I didn't describe the problem clearly. And now, I'd like to have some expl
by yfractal 1y ago
I am the author of this article. Sorry for the misleading article.
First, I admitted I didn't describe the problem clearly. And now, I'd like to have some explanation.
In the intro, the issue with rbspy is that it reads invalid addresses, see this https://github.com/rbspy/rbspy/blob/8d501946f75335154c493473ae91f1e7de356345/src/core/types.rs#L59 https://github.com/rbspy/rbspy/blob/8d501946f75335154c493473....
Data race refers to incorrect data, not an invalid address error.
And the citations, they are 2, one is the Ruby memory model(the third ref), and then a MIT course. I referred to this because it supposes 64-bit aligned memory reading is atomic, but I can't find other sources. And if you read the MIT course reference, you will see it's about RCU, and the RCU is valid only when 64-bit memory operations are atomic.
Yeah, sometimes, the compiler may compile a 64-bit memory access into two instructions, such as Rust, but it's not Ruby. It should be fine not consider this.
- nightpool 1y agoThanks for the reply! I'm sorry for coming off as too harsh. > Yeah, sometimes, the compiler may compile a 64-bit memory access into two instructions, such as Rust, but it's not Ruby. It should be fine not consider this. This sounds like it probably depends on the compiler or toolchain used. So Ruby compiled with LLVM would have issues with this approach, but Ruby compiled with GCC might not. Also it would be interesting to see whether yjit would affect this—it has hand-tuned assembly for 64-bit memory access.