diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-04-16 21:32:38 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-16 21:32:38 +0000 |
commit | 816a3d3c4bb4e2337285c7b6be1872bc469d7c45 (patch) | |
tree | dfaa93c4959feccb21a5b40a04b4e4472112d753 /runsc/mitigate | |
parent | 5d72f80b7af550f473cd71d32111a66501228629 (diff) | |
parent | 025cff180cb412ec49a85b99c60b8ce2e267704b (diff) |
Merge release-20210408.0-41-g025cff180 (automated)
Diffstat (limited to 'runsc/mitigate')
-rw-r--r-- | runsc/mitigate/mitigate.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/runsc/mitigate/mitigate.go b/runsc/mitigate/mitigate.go index 24f67414c..88409af8f 100644 --- a/runsc/mitigate/mitigate.go +++ b/runsc/mitigate/mitigate.go @@ -50,7 +50,7 @@ const ( type CPUSet map[threadID]*ThreadGroup // NewCPUSet creates a CPUSet from data read from /proc/cpuinfo. -func NewCPUSet(data []byte, vulnerable func(Thread) bool) (CPUSet, error) { +func NewCPUSet(data []byte) (CPUSet, error) { processors, err := getThreads(string(data)) if err != nil { return nil, err @@ -67,7 +67,7 @@ func NewCPUSet(data []byte, vulnerable func(Thread) bool) (CPUSet, error) { core = &ThreadGroup{} set[p.id] = core } - core.isVulnerable = core.isVulnerable || vulnerable(p) + core.isVulnerable = core.isVulnerable || p.IsVulnerable() core.threads = append(core.threads, p) } @@ -446,6 +446,7 @@ func buildRegex(key, match string) *regexp.Regexp { func parseRegex(data, key, match string) (string, error) { r := buildRegex(key, match) matches := r.FindStringSubmatch(data) + if len(matches) < 2 { return "", fmt.Errorf("failed to match key %q: %q", key, data) } |