mitigate

package
v0.0.0-...-ff2c174 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2021 License: Apache-2.0, MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mitigate provides libraries for the mitigate command. The mitigate command mitigates side channel attacks such as MDS. Mitigate shuts down CPUs via /sys/devices/system/cpu/cpu{N}/online.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUSet

type CPUSet map[threadID]*ThreadGroup

CPUSet contains a map of all CPUs on the system, mapped by Physical ID and CoreIDs. threads with the same Core and Physical ID are Hyperthread pairs.

func NewCPUSet

func NewCPUSet(data []byte) (CPUSet, error)

NewCPUSet creates a CPUSet from data read from /proc/cpuinfo.

func NewCPUSetFromPossible

func NewCPUSetFromPossible(data []byte) (CPUSet, error)

NewCPUSetFromPossible makes a cpuSet data read from /sys/devices/system/cpu/possible. This is used in enable operations where the caller simply wants to enable all CPUS.

func (CPUSet) GetRemainingList

func (c CPUSet) GetRemainingList() []Thread

GetRemainingList returns the list of threads that will remain active after mitigation.

func (CPUSet) GetShutdownList

func (c CPUSet) GetShutdownList() []Thread

GetShutdownList returns the list of threads that will be shutdown on mitigation.

func (CPUSet) String

func (c CPUSet) String() string

String implements the String method for CPUSet.

type Thread

type Thread struct {
	// contains filtered or unexported fields
}

Thread represents pertinent info about a single hyperthread in a pair.

func GetThreadsFromPossible

func GetThreadsFromPossible(data []byte) ([]Thread, error)

GetThreadsFromPossible makes threads from data read from /sys/devices/system/cpu/possible.

func (Thread) Disable

func (t Thread) Disable() error

Disable turns off the CPU by writing 0 to /sys/devices/cpu/cpu{N}/online.

func (Thread) Enable

func (t Thread) Enable() error

Enable turns on the CPU by writing 1 to /sys/devices/cpu/cpu{N}/online.

func (Thread) IsVulnerable

func (t Thread) IsVulnerable() bool

IsVulnerable checks if a CPU is vulnerable to mds.

func (Thread) SimilarTo

func (t Thread) SimilarTo(other Thread) bool

SimilarTo checks family/model/bugs fields for equality of two processors.

func (Thread) String

func (t Thread) String() string

String implements the String method for thread.

type ThreadGroup

type ThreadGroup struct {
	// contains filtered or unexported fields
}

ThreadGroup represents Hyperthread pairs on the same physical/core ID.

func (ThreadGroup) String

func (c ThreadGroup) String() string

String implements the String method for threadGroup.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL