aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_amd64.s
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/sys_linux_amd64.s')
-rw-r--r--src/runtime/sys_linux_amd64.s12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s
index e252a4b914..618553b196 100644
--- a/src/runtime/sys_linux_amd64.s
+++ b/src/runtime/sys_linux_amd64.s
@@ -228,6 +228,18 @@ TEXT runtime·nanotime1(SB),NOSPLIT,$16-8
// due to stack probes inserted to avoid stack/heap collisions.
// See issue #20427.
+#ifdef GOEXPERIMENT_runtimesecret
+ // The kernel might spill our secrets onto g0
+ // erase our registers here.
+ // TODO(dmo): what is the ABI guarantee here? we use
+ // R14 later, but the function is ABI0
+ CMPL g_secret(R14), $0
+ JEQ nosecret
+ CALL ·secretEraseRegisters(SB)
+
+nosecret:
+#endif
+
MOVQ SP, R12 // Save old SP; R12 unchanged by C code.
MOVQ g_m(R14), BX // BX unchanged by C code.