Live data from Hacker News

Debugging an evil Go runtime bug

marcan.st

1–10 of 51 posts

Re: Debugging an evil Go runtime bug

#3

Why doesn't the vDSO code just use MOV in its stack probe probe rather than an OR?

My best guess would be to prevent the 'useless instruction' from being optimized out, but an or with 0 is still useless, and I don't see what optimizer lies between this GCC feature and the final binary.

Maybe the segfault only occurs on a write?

Re: Debugging an evil Go runtime bug

#5
post #4

Why doesn't the vDSO code just use MOV in its stack probe probe rather than an OR?

Apparently, because it's shorter [0]. [0]: See https://lkml.org/lkml/2017/11/10/348

Why is it shorter? Both MOV and OR have one byte encodings, and with the OR you either have to use an immediate zero (which burns a byte) or materialize zero in some other way. As that email points out, the entire sequence would be shorter using a different addressing mode anyways. And a read-modify-write is definitely slower at runtime.

Re: Debugging an evil Go runtime bug

#10
Marcan's attitude is great; I know of a ton of people (myself included) who would've written that article with far more complaining interleaved. Super informative as well, I learned a ton from this article (GRUB 2 feature for marking off bad RAM? Wow!). Very well written, informative, humorous, etc. Love it
Post reply on HN