Skip to content

Commit 00e5fbe

Browse files
authored
Merge pull request #6013 from AkihiroSuda/cherrypick-5982-1.5
2 parents 2726be1 + 9230888 commit 00e5fbe

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

contrib/seccomp/seccomp_default.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func arches() []specs.Arch {
4949

5050
// DefaultProfile defines the allowed syscalls for the default seccomp profile.
5151
func DefaultProfile(sp *specs.Spec) *specs.LinuxSeccomp {
52+
nosys := uint(unix.ENOSYS)
5253
syscalls := []specs.LinuxSyscall{
5354
{
5455
Names: []string{
@@ -526,6 +527,7 @@ func DefaultProfile(sp *specs.Spec) *specs.LinuxSeccomp {
526527
Names: []string{
527528
"bpf",
528529
"clone",
530+
"clone3",
529531
"fanotify_init",
530532
"fsconfig",
531533
"fsmount",
@@ -657,6 +659,15 @@ func DefaultProfile(sp *specs.Spec) *specs.LinuxSeccomp {
657659
},
658660
})
659661
}
662+
// clone3 is explicitly requested to give ENOSYS instead of the default EPERM, when CAP_SYS_ADMIN is unset
663+
// https://github.com/moby/moby/pull/42681
664+
s.Syscalls = append(s.Syscalls, specs.LinuxSyscall{
665+
Names: []string{
666+
"clone3",
667+
},
668+
Action: specs.ActErrno,
669+
ErrnoRet: &nosys,
670+
})
660671
}
661672

662673
return s

0 commit comments

Comments
 (0)