Update runtime-spec to v1.0.0.rc5
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
b6c022caae
commit
24df2538db
166 changed files with 3544 additions and 15322 deletions
24
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/parse_remove.go
generated
vendored
24
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/parse_remove.go
generated
vendored
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
// RemoveAction takes the argument string that was passed with the --remove flag,
|
||||
// parses it, and updates the Seccomp config accordingly
|
||||
func RemoveAction(arguments string, config *rspec.Seccomp) error {
|
||||
func RemoveAction(arguments string, config *rspec.LinuxSeccomp) error {
|
||||
if config == nil {
|
||||
return fmt.Errorf("Cannot remove action from nil Seccomp pointer")
|
||||
}
|
||||
|
@ -22,28 +22,27 @@ func RemoveAction(arguments string, config *rspec.Seccomp) error {
|
|||
syscallsToRemove = append(syscallsToRemove, arguments)
|
||||
}
|
||||
|
||||
for _, syscall := range syscallsToRemove {
|
||||
for counter, syscallStruct := range config.Syscalls {
|
||||
if syscallStruct.Name == syscall {
|
||||
config.Syscalls = append(config.Syscalls[:counter], config.Syscalls[counter+1:]...)
|
||||
}
|
||||
for counter, syscallStruct := range config.Syscalls {
|
||||
if reflect.DeepEqual(syscallsToRemove, syscallStruct.Names) {
|
||||
config.Syscalls = append(config.Syscalls[:counter], config.Syscalls[counter+1:]...)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveAllSeccompRules removes all seccomp syscall rules
|
||||
func RemoveAllSeccompRules(config *rspec.Seccomp) error {
|
||||
func RemoveAllSeccompRules(config *rspec.LinuxSeccomp) error {
|
||||
if config == nil {
|
||||
return fmt.Errorf("Cannot remove action from nil Seccomp pointer")
|
||||
}
|
||||
newSyscallSlice := []rspec.Syscall{}
|
||||
newSyscallSlice := []rspec.LinuxSyscall{}
|
||||
config.Syscalls = newSyscallSlice
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveAllMatchingRules will remove any syscall rules that match the specified action
|
||||
func RemoveAllMatchingRules(config *rspec.Seccomp, action string) error {
|
||||
func RemoveAllMatchingRules(config *rspec.LinuxSeccomp, action string) error {
|
||||
if config == nil {
|
||||
return fmt.Errorf("Cannot remove action from nil Seccomp pointer")
|
||||
}
|
||||
|
@ -53,16 +52,11 @@ func RemoveAllMatchingRules(config *rspec.Seccomp, action string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
syscallsToRemove := []string{}
|
||||
for _, syscall := range config.Syscalls {
|
||||
if reflect.DeepEqual(syscall.Action, seccompAction) {
|
||||
syscallsToRemove = append(syscallsToRemove, syscall.Name)
|
||||
RemoveAction(strings.Join(syscall.Names, ","), config)
|
||||
}
|
||||
}
|
||||
|
||||
for i := range syscallsToRemove {
|
||||
RemoveAction(syscallsToRemove[i], config)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue