Attention is currently required from: Martin L Roth, Subrata Banik, Patrick Rudolph, Benjamin Doron, Julius Werner, Maximilian Brune, Arthur Heymans, Jan Samek.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/67735 )
Change subject: cpu/x86/smm_stub.S: Add a retpoline around the main C handler
......................................................................
Patch Set 2:
(2 comments)
File src/cpu/x86/smm/smm_stub.S:
https://review.coreboot.org/c/coreboot/+/67735/comment/60aae84f_b21a7b50
PS2, Line 256: 2f
What are these offsets targeting?
The `2:` below (f for forward).
https://review.coreboot.org/c/coreboot/+/67735/comment/3040493b_1ac0e963
PS2, Line 268: 1b
Ditto.
The `1:` above (b for backward).
I didn't look into retpolines before, but by the name it's a trampoline (jumping
around) using a ret(urn) somehow. It's indeed not easy to follow, here is what
happens:
* we have a stack frame #0
* jump to 2:
* call 1: (creates a new stack frame #1)
* call call_c_handler: (creates new stack frame #2)
* `movq %rax, (%rsp)` overwrites the return address with c_handler that is still in `rax` since line 253
* `ret` returns to stack frame #1, but execution is in the c_handler now oO
* when c_handler returns we return to frame #0, hence continue after the call in line 268
So `trap:` never gets executed and the `lfence` only instructs the speculators
(that would assume that the `ret` in line 265 returns to `trap:`) to stop speculating,
AIUI.
--
To view, visit
https://review.coreboot.org/c/coreboot/+/67735
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I93be3cd6a8c5f1ec29b3bc43195823ac49ec61c5
Gerrit-Change-Number: 67735
Gerrit-PatchSet: 2
Gerrit-Owner: Arthur Heymans
arthur@aheymans.xyz
Gerrit-Reviewer: Benjamin Doron
benjamin.doron00@gmail.com
Gerrit-Reviewer: Jan Samek
jan.samek@siemens.com
Gerrit-Reviewer: Julius Werner
jwerner@chromium.org
Gerrit-Reviewer: Lean Sheng Tan
sheng.tan@9elements.com
Gerrit-Reviewer: Martin L Roth
gaumless@gmail.com
Gerrit-Reviewer: Maximilian Brune
maximilian.brune@9elements.com
Gerrit-Reviewer: Nico Huber
nico.h@gmx.de
Gerrit-Reviewer: Patrick Rudolph
patrick.rudolph@9elements.com
Gerrit-Reviewer: Subrata Banik
subratabanik@google.com
Gerrit-Reviewer: build bot (Jenkins)
no-reply@coreboot.org
Gerrit-Attention: Martin L Roth
gaumless@gmail.com
Gerrit-Attention: Subrata Banik
subratabanik@google.com
Gerrit-Attention: Patrick Rudolph
patrick.rudolph@9elements.com
Gerrit-Attention: Benjamin Doron
benjamin.doron00@gmail.com
Gerrit-Attention: Julius Werner
jwerner@chromium.org
Gerrit-Attention: Maximilian Brune
maximilian.brune@9elements.com
Gerrit-Attention: Arthur Heymans
arthur@aheymans.xyz
Gerrit-Attention: Jan Samek
jan.samek@siemens.com
Gerrit-Comment-Date: Tue, 02 May 2023 11:50:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Jan Samek
jan.samek@siemens.com
Gerrit-MessageType: comment