Skip to content

Commit c3bea2c

Browse files
committed
seccomp: Separate conditions for personality syscall into single rule
Separate each syscall condition (argument) for personality syscall into a single rule because the libseccomp can only compare each condition once in a single rule. Otherwise, the adding returns EINVAL on failure. In order to address the failure, general OCI runtimes such as runc add each condition as a separate rule if two or more conditions have the same conditions, but this is a way for keeping compatibility (old behavior). Hence, it will lead wrong behavior because the conditions for the rules will be logical-OR instead of logical-AND. In case of the OCI tests for personality syscall, we should explicitly separate the conditions into a single rule as logical-OR for container runtimes that do not support the above old behavior. Ref. https://man7.org/linux/man-pages/man3/seccomp_rule_add.3.html Signed-off-by: Manabu Sugimoto <[email protected]>
1 parent 17b3287 commit c3bea2c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

generate/seccomp/seccomp_default.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,23 @@ func DefaultProfile(rs *specs.Spec) *rspec.LinuxSeccomp {
354354
Value: 0x0,
355355
Op: rspec.OpEqualTo,
356356
},
357+
},
358+
},
359+
{
360+
Names: []string{"personality"},
361+
Action: rspec.ActAllow,
362+
Args: []rspec.LinuxSeccompArg{
357363
{
358364
Index: 0,
359365
Value: 0x0008,
360366
Op: rspec.OpEqualTo,
361367
},
368+
},
369+
},
370+
{
371+
Names: []string{"personality"},
372+
Action: rspec.ActAllow,
373+
Args: []rspec.LinuxSeccompArg{
362374
{
363375
Index: 0,
364376
Value: 0xffffffff,

0 commit comments

Comments
 (0)