Adds sys.Walltime and sys.Nanotime for security and determinism (#616)

This adds two clock interfaces: sys.Walltime and sys.Nanotime to
allow implementations to override readings for purposes of security or
determinism.

The default values of both are a fake timestamp, to avoid the sandbox
break we formerly had by returning the real time. This is similar to how
we don't inherit OS Env values.
This commit is contained in:
Crypt Keeper
2022-06-04 15:14:31 +08:00
committed by GitHub
parent 94d1d31733
commit 507ce79080
43 changed files with 1102 additions and 428 deletions

View File

@@ -11,7 +11,7 @@ import (
var testCode, _ = io.ReadAll(io.LimitReader(rand.Reader, 8*1024))
func Test_MmapCodeSegment(t *testing.T) {
if !IsSupported() {
if !CompilerSupported() {
t.Skip()
}
@@ -30,7 +30,7 @@ func Test_MmapCodeSegment(t *testing.T) {
}
func Test_MunmapCodeSegment(t *testing.T) {
if !IsSupported() {
if !CompilerSupported() {
t.Skip()
}