OpenBSD already enables DIT on arm64 in both kernel and userland.
As such, if DIT is already enabled, do not expect that it can be
disabled.
Change-Id: If7aae2ace40d97109beefa71c03e0c138a0995ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/629995
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
t.Skip("CPU does not support DIT")
}
+ ditAlreadyEnabled := sys.DITEnabled()
+
WithDataIndependentTiming(func() {
if !sys.DITEnabled() {
t.Fatal("dit not enabled within WithDataIndependentTiming closure")
}
})
- if sys.DITEnabled() {
+ if !ditAlreadyEnabled && sys.DITEnabled() {
t.Fatal("dit not unset after returning from WithDataIndependentTiming closure")
}
}
t.Skip("CPU does not support DIT")
}
+ ditAlreadyEnabled := sys.DITEnabled()
+
defer func() {
e := recover()
if e == nil {
t.Fatal("didn't panic")
}
- if sys.DITEnabled() {
+ if !ditAlreadyEnabled && sys.DITEnabled() {
t.Error("DIT still enabled after panic inside of WithDataIndependentTiming closure")
}
}()