Skip to content

Commit

Permalink
Merge pull request #6013 from AkihiroSuda/cherrypick-5982-1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
fuweid committed Sep 16, 2021
2 parents 2726be1 + 9230888 commit 00e5fbe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions contrib/seccomp/seccomp_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func arches() []specs.Arch {

// DefaultProfile defines the allowed syscalls for the default seccomp profile.
func DefaultProfile(sp *specs.Spec) *specs.LinuxSeccomp {
nosys := uint(unix.ENOSYS)
syscalls := []specs.LinuxSyscall{
{
Names: []string{
Expand Down Expand Up @@ -526,6 +527,7 @@ func DefaultProfile(sp *specs.Spec) *specs.LinuxSeccomp {
Names: []string{
"bpf",
"clone",
"clone3",
"fanotify_init",
"fsconfig",
"fsmount",
Expand Down Expand Up @@ -657,6 +659,15 @@ func DefaultProfile(sp *specs.Spec) *specs.LinuxSeccomp {
},
})
}
// clone3 is explicitly requested to give ENOSYS instead of the default EPERM, when CAP_SYS_ADMIN is unset
// https://github.com/moby/moby/pull/42681
s.Syscalls = append(s.Syscalls, specs.LinuxSyscall{
Names: []string{
"clone3",
},
Action: specs.ActErrno,
ErrnoRet: &nosys,
})
}

return s
Expand Down

0 comments on commit 00e5fbe

Please sign in to comment.