[5.0] remove EOS VM OC's erroneous GS register is not as expected
message
#2406
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For some background and history see #1216 (comment), I'm not going to repeat that research here. But the TLDR of it is that since some CPUs ignore setting the GS register to 0x00, expecting the register to be 0x00 (and printing this warning otherwise) seems dubious: it sounds as if the kernel does not and can not guarantee that upon the start of a new process GS is 0x00.
Now that said, I can't reproduce any cases where GS is not cleared to 0x00 on the start of a new process. I even dug out a Zen 1 CPU, confirmed
/proc/cpuinfo
shows thenull_seg
bug, and still GS is reset to 0x00 on a new process after the parent process sets it to some value. Not sure what nuance I am misunderstanding about this 'bug', maybe some x86 guru can chime in.But it doesn't matter: we're still seeing this warning regardless. What's going on?
Creating a new thread on Linux has defined behavior of copying the current registers -- this includes the segment registers. You can see the copying of GS here,
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/process.c?h=v6.10#n182
This is not new behavior, for example going back to 4.19 (just picking oldest current LTS version) can find similar code,
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/process_64.c?h=v4.19#n306
Empirically can also observe this behavior,
The output can be,
Thus, once we added read-only threads we introduced behavior that causes this
GS register is not as expected
message to erroneously print after a replay: the main thread's Executor will have set GS to its WASM memory for the replay, and when the read only threads are spawned after replay, they will inherit the non-zero GS register causing the read only threads' Executor to print this warning upon construction. This will look something likeSince now with RO threads it is clearly wrong to be printing this scary warning I'm suggesting removal of it back to 5.0.