diff options
author | Adin Scannell <ascannell@google.com> | 2020-04-17 22:18:36 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-17 22:19:47 -0700 |
commit | 9a233c94f1bd54c7c3c11f7166a09e2eacd179c5 (patch) | |
tree | 1a3f2b5c6865edefebcecce975f28091d824d9a9 | |
parent | e838290e671c9d72dbaa3aba13bf0c35f1147de4 (diff) |
Fix watchdog skipStack: the meaning was reversed.
PiperOrigin-RevId: 307166317
-rw-r--r-- | pkg/sentry/watchdog/watchdog.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/pkg/sentry/watchdog/watchdog.go b/pkg/sentry/watchdog/watchdog.go index f7d6009a0..fcc46420f 100644 --- a/pkg/sentry/watchdog/watchdog.go +++ b/pkg/sentry/watchdog/watchdog.go @@ -319,8 +319,8 @@ func (w *Watchdog) report(offenders map[*kernel.Task]*offender, newTaskFound boo // Dump stack only if a new task is detected or if it sometime has // passed since the last time a stack dump was generated. - skipStack := newTaskFound || time.Since(w.lastStackDump) >= stackDumpSameTaskPeriod - w.doAction(w.TaskTimeoutAction, skipStack, &buf) + showStack := newTaskFound || time.Since(w.lastStackDump) >= stackDumpSameTaskPeriod + w.doAction(w.TaskTimeoutAction, showStack, &buf) } func (w *Watchdog) reportStuckWatchdog() { @@ -329,16 +329,15 @@ func (w *Watchdog) reportStuckWatchdog() { w.doAction(w.TaskTimeoutAction, false, &buf) } -// doAction will take the given action. If the action is LogWarnind and -// skipStack is true, then the stack printing will be skipped. -func (w *Watchdog) doAction(action Action, skipStack bool, msg *bytes.Buffer) { +// doAction will take the given action. If the action is LogWarning and +// showStack is false, then the stack printing will be skipped. +func (w *Watchdog) doAction(action Action, showStack bool, msg *bytes.Buffer) { switch action { case LogWarning: - if skipStack { + if !showStack { msg.WriteString("\n...[stack dump skipped]...") log.Warningf(msg.String()) return - } log.TracebackAll(msg.String()) w.lastStackDump = time.Now() |