~emersion/drmdb

8e3ac6c585333ddb093c57ccd6e3e5ce28a9d4cc — Simon Ser 8 months ago 613b5ba
Print some tainted kernel warnings on snapshot page
3 files changed, 58 insertions(+), 5 deletions(-)

M drmtree/drmtree.go
M public/assets/style.css
M public/snapshot.html
M drmtree/drmtree.go => drmtree/drmtree.go +42 -5
@@ 40,14 40,51 @@ func (ver *DriverVersion) Less(other *DriverVersion) bool {
	return false
}

// https://www.kernel.org/doc/html/latest/admin-guide/tainted-kernels.html
type Tainted uint64

const (
	taintedProprietary Tainted = 1 << iota
	taintedModuleForceLoaded
	taintedOutOfSpecSystem
	taintedModuleForceUnloaded
	taintedMCE
	taintedBadPage
	taintedUserspace
	taintedOops
	taintedACPIOverridden
	taintedWarn
	taintedStagingDriver
	taintedWorkaround
	taintedExternalModule
	taintedUnsignedModule
	taintedSoftLockup
	taintedLivePatched
	taintedAuxiliary
	taintedStructRandomization
	taintedInKernelTestRan
)

func (t Tainted) Proprietary() bool {
	return t&taintedProprietary != 0
}

func (t Tainted) StagingDriver() bool {
	return t&taintedStagingDriver != 0
}

func (t Tainted) ExternalModule() bool {
	return t&taintedExternalModule != 0
}

type Kernel struct {
	SysName string  `json:"sysname"`
	Release string  `json:"release"`
	Version string  `json:"version"`
	Tainted *uint64 `json:"tainted"`
	SysName string   `json:"sysname"`
	Release string   `json:"release"`
	Version string   `json:"version"`
	Tainted *Tainted `json:"tainted"`
}

func (k Kernel) String() string {
func (k *Kernel) String() string {
	if k.SysName == "" {
		return "unknown kernel"
	}

M public/assets/style.css => public/assets/style.css +4 -0
@@ 153,3 153,7 @@ dd.muted {
    text-decoration: none;
    color: white;
}

.warning {
    color: red;
}

M public/snapshot.html => public/snapshot.html +12 -0
@@ 127,6 127,18 @@
</ul>
{{end}}

{{with .Node.Driver.Kernel.Tainted}}
  {{if .Proprietary}}
    <p class="warning">⚠ This snapshot was captured with a proprietary driver loaded.</p>
  {{end}}
  {{if .StagingDriver}}
    <p class="warning">⚠ This snapshot was captured with a staging driver loaded.</p>
  {{end}}
  {{if .ExternalModule}}
    <p class="warning">⚠ This snapshot was captured with an external module loaded.</p>
  {{end}}
{{end}}

{{with .Node}}
<ul class="pre">
	{{with .Driver}}