Expose internal testing flag

Never to used outside of runsc tests!

PiperOrigin-RevId: 225919013
Change-Id: Ib3b14aa2a2564b5246fb3f8933d95e01027ed186
This commit is contained in:
Michael Pratt
2018-12-17 17:35:06 -08:00
committed by Shentubot
parent e9c4f69f36
commit b62591e6a8
3 changed files with 10 additions and 5 deletions
+6 -1
View File
@@ -218,7 +218,7 @@ type Config struct {
// ToFlags returns a slice of flags that correspond to the given Config.
func (c *Config) ToFlags() []string {
return []string{
f := []string{
"--root=" + c.RootDir,
"--debug=" + strconv.FormatBool(c.Debug),
"--log=" + c.LogFilename,
@@ -237,4 +237,9 @@ func (c *Config) ToFlags() []string {
"--panic-signal=" + strconv.Itoa(c.PanicSignal),
"--trace-signal=" + strconv.Itoa(c.TraceSignal),
}
if c.TestOnlyAllowRunAsCurrentUserWithoutChroot {
// Only include if set since it is never to be used by users.
f = append(f, "-TESTONLY-unsafe-nonroot=true")
}
return f
}
+3
View File
@@ -64,6 +64,8 @@ var (
watchdogAction = flag.String("watchdog-action", "log", "sets what action the watchdog takes when triggered: log (default), panic.")
panicSignal = flag.Int("panic-signal", -1, "register signal handling that panics. Usually set to SIGUSR2(12) to troubleshoot hangs. -1 disables it. This takes precendence over -trace-signal.")
traceSignal = flag.Int("trace-signal", -1, "register signal handling that logs a traceback of all goroutines. Usually set to SIGUSR2(12) to troubleshoot hangs. -1 disables it.")
testOnlyAllowRunAsCurrentUserWithoutChroot = flag.Bool("TESTONLY-unsafe-nonroot", false, "TEST ONLY; do not ever use! This skips many security measures that isolate the host from the sandbox.")
)
// gitRevision is set during linking.
@@ -146,6 +148,7 @@ func main() {
WatchdogAction: wa,
PanicSignal: *panicSignal,
TraceSignal: *traceSignal,
TestOnlyAllowRunAsCurrentUserWithoutChroot: *testOnlyAllowRunAsCurrentUserWithoutChroot,
}
if len(*straceSyscalls) != 0 {
conf.StraceSyscalls = strings.Split(*straceSyscalls, ",")
+1 -4
View File
@@ -11,10 +11,7 @@ go_library(
"testutil_race.go",
],
importpath = "gvisor.googlesource.com/gvisor/runsc/test/testutil",
visibility = [
"//runsc:__subpackages__",
"//test:__subpackages__",
],
visibility = ["//:sandbox"],
deps = [
"//runsc/boot",
"//runsc/specutils",