Allow to force some qemu settings from .out-of-tree.toml
This commit is contained in:
parent
338300eeec
commit
282d99f511
@ -47,6 +47,11 @@
|
|||||||
|
|
||||||
- New command `pack` that perform tests in subdirectories.
|
- New command `pack` that perform tests in subdirectories.
|
||||||
|
|
||||||
|
- Added ability to disable kaslr/smep/smap for in artifact definition.
|
||||||
|
|
||||||
|
- Added ability to change amount of memory/CPUs and set qemu timeout
|
||||||
|
in artifact definition (`.out-of-tree.toml`).
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Now if there's no base image found — out-of-tree will try to use
|
- Now if there's no base image found — out-of-tree will try to use
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/naoina/toml"
|
"github.com/naoina/toml"
|
||||||
)
|
)
|
||||||
@ -83,12 +84,36 @@ func (at ArtifactType) MarshalTOML() (data []byte, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Duration type with toml unmarshalling support
|
||||||
|
type Duration struct {
|
||||||
|
time.Duration
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalTOML for Duration
|
||||||
|
func (d *Duration) UnmarshalTOML(data []byte) (err error) {
|
||||||
|
duration := strings.Replace(string(data), "\"", "", -1)
|
||||||
|
d.Duration, err = time.ParseDuration(duration)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Artifact is for .out-of-tree.toml
|
// Artifact is for .out-of-tree.toml
|
||||||
type Artifact struct {
|
type Artifact struct {
|
||||||
Name string
|
Name string
|
||||||
Type ArtifactType
|
Type ArtifactType
|
||||||
SourcePath string
|
SourcePath string
|
||||||
SupportedKernels []KernelMask
|
SupportedKernels []KernelMask
|
||||||
|
|
||||||
|
Qemu struct {
|
||||||
|
CPUs int
|
||||||
|
Memory int
|
||||||
|
Timeout Duration
|
||||||
|
}
|
||||||
|
|
||||||
|
Mitigations struct {
|
||||||
|
DisableSMEP bool
|
||||||
|
DisableSMAP bool
|
||||||
|
DisableKASLR bool
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ka Artifact) checkSupport(ki KernelInfo, km KernelMask) (
|
func (ka Artifact) checkSupport(ki KernelInfo, km KernelMask) (
|
||||||
|
14
pew.go
14
pew.go
@ -304,6 +304,20 @@ func whatever(swg *sizedwaitgroup.SizedWaitGroup, ka config.Artifact,
|
|||||||
}
|
}
|
||||||
q.Timeout = qemuTimeout
|
q.Timeout = qemuTimeout
|
||||||
|
|
||||||
|
if ka.Qemu.Timeout.Duration != 0 {
|
||||||
|
q.Timeout = ka.Qemu.Timeout.Duration
|
||||||
|
}
|
||||||
|
if ka.Qemu.CPUs != 0 {
|
||||||
|
q.Cpus = ka.Qemu.CPUs
|
||||||
|
}
|
||||||
|
if ka.Qemu.Memory != 0 {
|
||||||
|
q.Memory = ka.Qemu.Memory
|
||||||
|
}
|
||||||
|
|
||||||
|
q.SetKASLR(!ka.Mitigations.DisableKASLR)
|
||||||
|
q.SetSMEP(!ka.Mitigations.DisableSMEP)
|
||||||
|
q.SetSMAP(!ka.Mitigations.DisableSMAP)
|
||||||
|
|
||||||
err = q.Start()
|
err = q.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Qemu start error:", err)
|
log.Println("Qemu start error:", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user