Documentation
¶
Overview ¶
Package runtime exposes a curated set of Go runtime internals (secure mode, traceback level, environment variables) that the intra core / tun2socks code needs to control on Android.
It is split out of intra/core into its own sub-package so that the //go:linkname directives below (which require the final link to be invoked with -checklinkname=0) only affect the final link of the tun2socks binary, not every other binary or test that imports intra/core transitively. Without this split, any package that transitively imports intra/core (which is most of the intra tree) would have to be built with -checklinkname=0 too.
Pushing / pulling runtime symbols via //go:linkname works provided the final link uses -ldflags="-checklinkname=0".
Index ¶
- func GetRuntimeEnviron(key string) (val string, found bool)
- func RuntimeEnviron() []string
- func RuntimeFinishDebugVarsSetup()
- func RuntimeGotraceback() (l int32, all, crash bool)
- func RuntimeResetTracebackEnv() (prev uint32)
- func RuntimeSecureMode() (them, us bool)
- func RuntimeWtf(s string)
- func SecureMode(new bool) (prev bool)
- func SetRuntimeEnviron(key, val string) (didSet, overwrote bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRuntimeEnviron ¶
GetRuntimeEnviron gets a value from the Go runtime's cached environment vars.
func RuntimeEnviron ¶
func RuntimeEnviron() []string
RuntimeEnviron returns the Go runtime's cached environment vars. github.com/golang/go/blob/e2fef50def98/src/runtime/runtime1.go#L98
func RuntimeFinishDebugVarsSetup ¶
func RuntimeFinishDebugVarsSetup()
RuntimeFinishDebugVarsSetup resets internal runtime debug variables by re-reading GODEBUG & GOTRACEBACK env vars. github.com/golang/go/blob/e2fef50def98/src/runtime/runtime1.go#L462
func RuntimeGotraceback ¶
RuntimeGotraceback returns the current GOTRACEBACK settings. github.com/golang/go/blob/e2fef50def98/src/runtime/runtime1.go#L38
func RuntimeResetTracebackEnv ¶
func RuntimeResetTracebackEnv() (prev uint32)
traceback_env is the floor value that setTraceback ORs into every call: traceback_env = traceback_cache after finishDebugVarsSetup, so it encodes whatever level+crash bits were in force at that point. This makes traceback a one-way ratchet: once the level goes up (e.g. to "system"), t |= traceback_env prevents it from ever coming back down via a subsequent debug.SetTraceback("single") call. Zeroing it before setTraceback / finishDebugVarsSetup breaks the ratchet so the level can be raised or lowered freely. Must be called before RuntimeFinishDebugVarsSetup / debug.SetTraceback when a lower level than the previously-set one is desired. sample test: go.dev/play/p/VOPFogTh8Ny github.com/golang/go/blob/fed3b0a298/src/runtime/runtime1.go#L27
func RuntimeSecureMode ¶
func RuntimeSecureMode() (them, us bool)
RuntimeSecureMode reports whether the Go runtime is in secure mode. github.com/golang/go/blob/e2fef50def98/src/runtime/os_linux.go#L296
func RuntimeWtf ¶
func RuntimeWtf(s string)
RuntimeWtf uses runtime.writeHeader and emits s to logd. github.com/golang/go/blob/e2fef50def98/src/runtime/write_err_android.go#L39
func SecureMode ¶
func SetRuntimeEnviron ¶
SetRuntimeEnviron sets / adds a key-value pair in the Go runtime's cached environment vars.
Types ¶
This section is empty.