feat!: rename supported kernels to targets
BREAKING CHANGE: .out-of-tree.toml: s/[[supported_kernels]]/[[targets]]/
This commit is contained in:
parent
6939d64226
commit
6385ce92e3
2
.github/workflows/ubuntu.yml
vendored
2
.github/workflows/ubuntu.yml
vendored
@ -139,7 +139,7 @@ jobs:
|
||||
echo 'name = "test"' >> .out-of-tree.toml
|
||||
echo 'type = "${{ matrix.type }}"' >> .out-of-tree.toml
|
||||
echo 'script = "script.sh"' >> .out-of-tree.toml
|
||||
echo '[[supported_kernels]]' >> .out-of-tree.toml
|
||||
echo '[[targets]]' >> .out-of-tree.toml
|
||||
echo 'distro = { id = "${{ matrix.os.distro }}", release = "${{ matrix.os.release }}" }' >> .out-of-tree.toml
|
||||
echo 'release_mask = ".*"' >> .out-of-tree.toml
|
||||
|
||||
|
@ -135,7 +135,7 @@ type Artifact struct {
|
||||
Type ArtifactType
|
||||
TestFiles []FileTransfer
|
||||
SourcePath string
|
||||
SupportedKernels []KernelMask
|
||||
Targets []KernelMask
|
||||
|
||||
Script string
|
||||
|
||||
@ -187,7 +187,7 @@ func (ka Artifact) checkSupport(ki KernelInfo, km KernelMask) (
|
||||
|
||||
// Supported returns true if given kernel is supported by artifact
|
||||
func (ka Artifact) Supported(ki KernelInfo) (supported bool, err error) {
|
||||
for _, km := range ka.SupportedKernels {
|
||||
for _, km := range ka.Targets {
|
||||
supported, err = ka.checkSupport(ki, km)
|
||||
if supported {
|
||||
break
|
||||
@ -331,8 +331,8 @@ func ReadArtifactConfig(path string) (ka Artifact, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
for i, _ := range ka.SupportedKernels {
|
||||
km := &ka.SupportedKernels[i]
|
||||
for i, _ := range ka.Targets {
|
||||
km := &ka.Targets[i]
|
||||
if len(km.Kernel.Version) != 0 && km.ReleaseMask != "" {
|
||||
s := "Only one way to define kernel version is allowed"
|
||||
err = errors.New(s)
|
||||
|
@ -17,7 +17,7 @@ func TestMarshalUnmarshal(t *testing.T) {
|
||||
Name: "Put name here",
|
||||
Type: KernelModule,
|
||||
}
|
||||
artifactCfg.SupportedKernels = append(artifactCfg.SupportedKernels,
|
||||
artifactCfg.Targets = append(artifactCfg.Targets,
|
||||
KernelMask{distro.Distro{
|
||||
ID: distro.Ubuntu,
|
||||
Release: "18.04",
|
||||
|
2
debug.go
2
debug.go
@ -229,7 +229,7 @@ func firstSupported(kcfg config.KernelConfig, ka config.Artifact,
|
||||
return
|
||||
}
|
||||
|
||||
ka.SupportedKernels = []config.KernelMask{km}
|
||||
ka.Targets = []config.KernelMask{km}
|
||||
|
||||
for _, ki = range kcfg.Kernels {
|
||||
var supported bool
|
||||
|
@ -3,15 +3,15 @@
|
||||
name = "out-of-tree exploit example"
|
||||
type = "exploit"
|
||||
|
||||
[[supported_kernels]]
|
||||
[[targets]]
|
||||
distro = { id = "Ubuntu", release = "16.04" }
|
||||
release_mask = "4[.]4[.]0-(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116)-.*"
|
||||
|
||||
[[supported_kernels]]
|
||||
[[targets]]
|
||||
distro = { id = "Ubuntu", release = "16.04" }
|
||||
release_mask = "4[.]8[.]0-(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58)-.*"
|
||||
|
||||
[[supported_kernels]]
|
||||
[[targets]]
|
||||
# Can be Ubuntu/CentOS/Debian/etc.
|
||||
distro = { id = "Ubuntu", release = "16.04" }
|
||||
# regex for `uname -r`
|
||||
@ -19,14 +19,14 @@ distro = { id = "Ubuntu", release = "16.04" }
|
||||
# stupid way to generate: $ echo '4.4.0-('$(seq 44 | xargs echo | sed 's/ /|/g')')-.*'
|
||||
release_mask = "4[.]10[.]0-(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42)-.*"
|
||||
|
||||
[[supported_kernels]]
|
||||
[[targets]]
|
||||
distro = { id = "Ubuntu", release = "16.04" }
|
||||
release_mask = "4[.]11[.]0-(1|2|3|4|5|6|7|8|9|10|11|12|13|14)-.*"
|
||||
|
||||
[[supported_kernels]]
|
||||
[[targets]]
|
||||
distro = { id = "Ubuntu", release = "16.04" }
|
||||
# equivalent for "4[.]13[.]0-(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21)-.*"
|
||||
[supported_kernels.kernel]
|
||||
[targets.kernel]
|
||||
version = [ 4 ]
|
||||
major = [ 13 ]
|
||||
minor = [ 0 ]
|
||||
|
@ -3,24 +3,24 @@
|
||||
name = "out-of-tree module example"
|
||||
type = "module"
|
||||
|
||||
[[supported_kernels]]
|
||||
[[targets]]
|
||||
# Can be Ubuntu/CentOS/Debian/etc.
|
||||
distro = { id = "Ubuntu", release = "16.04" }
|
||||
# regex for `uname -r`
|
||||
# See also: regex-golang.appspot.com
|
||||
release_mask = "4[.]4[.]0-70-.*"
|
||||
|
||||
# [[supported_kernels]] may be defined unlimited number of times
|
||||
[[supported_kernels]]
|
||||
# [[targets]] may be defined unlimited number of times
|
||||
[[targets]]
|
||||
distro = { id = "Ubuntu", release = "18.04" }
|
||||
# Also you can use only one kernel
|
||||
release_mask = "4[.]15[.]0-(24|29)-generic"
|
||||
|
||||
[[supported_kernels]]
|
||||
[[targets]]
|
||||
distro = { id = "Ubuntu", release = "18.04" }
|
||||
# Also you can use only one kernel
|
||||
release_mask = "4[.]15[.]0-23-generic"
|
||||
|
||||
[[supported_kernels]]
|
||||
[[targets]]
|
||||
distro = { id = "CentOS", release = "7" }
|
||||
release_mask = "3[.]10[.]0-862.el7.x86_64"
|
||||
|
@ -1,7 +1,7 @@
|
||||
name = "out-of-tree preload"
|
||||
type = "module"
|
||||
|
||||
[[supported_kernels]]
|
||||
[[targets]]
|
||||
distro = { id = "Ubuntu", release = "18.04" }
|
||||
release_mask = ".*"
|
||||
|
||||
|
@ -5,6 +5,6 @@ type = "script"
|
||||
|
||||
script = "script.sh"
|
||||
|
||||
[[supported_kernels]]
|
||||
[[targets]]
|
||||
distro = { id = "Ubuntu", release = "22.04" }
|
||||
release_mask = ".*"
|
||||
|
4
gen.go
4
gen.go
@ -32,11 +32,11 @@ func genConfig(at config.ArtifactType) (err error) {
|
||||
Name: "Put name here",
|
||||
Type: at,
|
||||
}
|
||||
a.SupportedKernels = append(a.SupportedKernels, config.KernelMask{
|
||||
a.Targets = append(a.Targets, config.KernelMask{
|
||||
Distro: distro.Distro{ID: distro.Ubuntu, Release: "18.04"},
|
||||
ReleaseMask: ".*",
|
||||
})
|
||||
a.SupportedKernels = append(a.SupportedKernels, config.KernelMask{
|
||||
a.Targets = append(a.Targets, config.KernelMask{
|
||||
Distro: distro.Distro{ID: distro.Debian, Release: "8"},
|
||||
ReleaseMask: ".*",
|
||||
})
|
||||
|
@ -107,7 +107,7 @@ func (cmd KernelAutogenCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
|
||||
shutdown := false
|
||||
kernel.SetSigintHandler(&shutdown)
|
||||
|
||||
for _, sk := range ka.SupportedKernels {
|
||||
for _, sk := range ka.Targets {
|
||||
if sk.Distro.Release == "" {
|
||||
err = errors.New("Please set distro_release")
|
||||
return
|
||||
|
4
pew.go
4
pew.go
@ -101,11 +101,11 @@ func (cmd *PewCmd) Run(g *Globals) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
ka.SupportedKernels = []config.KernelMask{km}
|
||||
ka.Targets = []config.KernelMask{km}
|
||||
}
|
||||
|
||||
if cmd.Guess {
|
||||
ka.SupportedKernels, err = genAllKernels()
|
||||
ka.Targets, err = genAllKernels()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ func buildPreload(workPath, tmp string, ki config.KernelInfo,
|
||||
Distro: ki.Distro,
|
||||
ReleaseMask: ki.KernelRelease,
|
||||
}
|
||||
ka.SupportedKernels = []config.KernelMask{km}
|
||||
ka.Targets = []config.KernelMask{km}
|
||||
|
||||
if ka.Docker.Timeout.Duration != 0 {
|
||||
dockerTimeout = ka.Docker.Timeout.Duration
|
||||
|
Loading…
Reference in New Issue
Block a user