mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
seccomp: review update
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
1603af9689
commit
e76380b67b
3 changed files with 18 additions and 17 deletions
|
@ -374,7 +374,7 @@
|
|||
"args": null,
|
||||
"comment": "",
|
||||
"includes": {
|
||||
"minKernel": "4.8.0"
|
||||
"minKernel": "4.8"
|
||||
},
|
||||
"excludes": {}
|
||||
},
|
||||
|
|
|
@ -96,21 +96,6 @@ func setupSeccomp(config *types.Seccomp, rs *specs.Spec) (*specs.LinuxSeccomp, e
|
|||
|
||||
newConfig.DefaultAction = specs.LinuxSeccompAction(config.DefaultAction)
|
||||
|
||||
var currentKernelVersion *kernel.VersionInfo
|
||||
kernelGreaterEqualThan := func(v string) (bool, error) {
|
||||
version, err := kernel.ParseRelease(v)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if currentKernelVersion == nil {
|
||||
currentKernelVersion, err = kernel.GetKernelVersion()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
return kernel.CompareKernelVersion(*version, *currentKernelVersion) <= 0, nil
|
||||
}
|
||||
|
||||
Loop:
|
||||
// Loop through all syscall blocks and convert them to libcontainer format after filtering them
|
||||
for _, call := range config.Syscalls {
|
||||
|
@ -188,3 +173,19 @@ func createSpecsSyscall(name string, action types.Action, args []*types.Arg) spe
|
|||
}
|
||||
return newCall
|
||||
}
|
||||
|
||||
var currentKernelVersion *kernel.VersionInfo
|
||||
|
||||
func kernelGreaterEqualThan(v string) (bool, error) {
|
||||
version, err := kernel.ParseRelease(v)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if currentKernelVersion == nil {
|
||||
currentKernelVersion, err = kernel.GetKernelVersion()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
return kernel.CompareKernelVersion(*version, *currentKernelVersion) <= 0, nil
|
||||
}
|
||||
|
|
|
@ -360,7 +360,7 @@ func DefaultProfile() *types.Seccomp {
|
|||
Names: []string{"ptrace"},
|
||||
Action: types.ActAllow,
|
||||
Includes: types.Filter{
|
||||
MinKernel: "4.8.0",
|
||||
MinKernel: "4.8",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue