Skip to content

Commit db4fdd7

Browse files
nixprimegvisor-bot
authored andcommitted
kvm: mark readAndResetDR6 and callees nosplit
Stack expansion, GC preemption, etc. can cause an exit to host ring 3, resulting in #GP when the sentry touches the debug register. PiperOrigin-RevId: 787217537
1 parent 8778ab8 commit db4fdd7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pkg/sentry/platform/kvm/bluepill_amd64.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ TEXT ·rdgsbase(SB), $0-8
102102
MOVQ AX, ret+0(FP)
103103
RET
104104

105-
TEXT ·rdDR6(SB), $0-8
105+
TEXT ·rdDR6(SB),NOSPLIT,$0-8
106106
MOVQ DR6, AX
107107
MOVQ AX, ret+0(FP)
108108
RET
109109

110-
TEXT ·wrDR6(SB), $0-8
110+
TEXT ·wrDR6(SB),NOSPLIT,$0-8
111111
MOVQ val+0(FP), AX
112112
MOVQ AX, DR6
113113
RET

pkg/sentry/platform/kvm/machine_amd64.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ const (
345345
_DR_STEP = 0x4000 // single-step
346346
)
347347

348+
//go:nosplit
348349
func readAndResetDR6() uint64 {
349350
dr6 := rdDR6()
350351
wrDR6(_DR6_RESERVED)

0 commit comments

Comments
 (0)