-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
seccomp: add support for flags #3390
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1016,14 +1016,22 @@ func SetupSeccomp(config *specs.LinuxSeccomp) (*configs.Seccomp, error) { | |
return nil, nil | ||
} | ||
|
||
// We don't currently support seccomp flags. | ||
if len(config.Flags) != 0 { | ||
return nil, errors.New("seccomp flags are not yet supported by runc") | ||
} | ||
|
||
newConfig := new(configs.Seccomp) | ||
newConfig.Syscalls = []*configs.Syscall{} | ||
|
||
// The list of flags defined in runtime-spec is a subset of the flags | ||
// in the seccomp() syscall | ||
for _, flag := range config.Flags { | ||
switch flag { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add support for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
case "SECCOMP_FILTER_FLAG_TSYNC": | ||
// Tsync can be silently ignored | ||
case specs.LinuxSeccompFlagLog, specs.LinuxSeccompFlagSpecAllow: | ||
newConfig.Flags = append(newConfig.Flags, flag) | ||
default: | ||
return nil, fmt.Errorf("seccomp flag %q not yet supported by runc", flag) | ||
} | ||
} | ||
|
||
if len(config.Architectures) > 0 { | ||
newConfig.Architectures = []string{} | ||
for _, arch := range config.Architectures { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I think we should have them as consts in the runtime spec. I proposed that change in opencontainers/runtime-spec#1138
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that seccomp-golang sets this flag unconditionally, and we (runc/libcontainer/seccomp/patchbpf) do not set this at all (not sure if this was by design or just forgotten; @cyphar WDYT?)
From what I see, it seems that for runc it does not make sense to do so, as we execute runc init right after applying seccomp rules, and it does not matter much whether these rules were applied to all threads or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was an issue with setting it in patchbpf, I can't remember the exact details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SECCOMP_FILTER_FLAG_TSYNC is not a flag on the bpf instructions but a flag for the seccomp() syscall, so I don't think patchbpf can do something with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TSYNC is set by libseccomp-golang by default, and there's no way to remove it. So adding it here does not make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, OK, here we're ignoring it, which I guess is a good thing to do.