Skip to content

Commit f75557b

Browse files
committed
*: bump min libseccomp to 2.2.1
Looks like we can drop libseccomp 2.2.0 support, and require version 2.2.1 or greater. Checking for libseccomp versions shipped with various old (but still supported) releases, here is what I found out: * Ubuntu 14.04 "Trusty Tahr": 2.1.1 (unsupported by this pkg), with 2.2.3 available in backports repo [1] * Debian "Stretch" (aka oldoldstable): 2.3.1 [2] * RHEL/CentOS 7: 2.3.1 [3] * SLES 15 SP1: 2.4.3 [4] * openSUSE Leap 15.2: 2.4.1 [4] * Alpine 3.11: 2.4.2 [5] * Arch, Gentoo: 2.5.x [1] https://launchpad.net/ubuntu/+source/libseccomp [2] https://packages.debian.org/search?keywords=libseccomp [3] https://rpmfind.net/linux/rpm2html/search.php?query=libseccomp [4] https://software.opensuse.org/package/libseccomp [5] https://pkgs.alpinelinux.org/packages?name=libseccomp&branch=v3.11 Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent bb05781 commit f75557b

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

seccomp.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,9 +1028,6 @@ func (f *ScmpFilter) AddRuleExact(call ScmpSyscall, action ScmpAction) error {
10281028
// AddRuleConditional adds a single rule for a conditional action on a syscall.
10291029
// Returns an error if an issue was encountered adding the rule.
10301030
// All conditions must match for the rule to match.
1031-
// There is a bug in library versions below v2.2.1 which can, in some cases,
1032-
// cause conditions to be lost when more than one are used. Consequently,
1033-
// AddRuleConditional is disabled on library versions lower than v2.2.1
10341031
func (f *ScmpFilter) AddRuleConditional(call ScmpSyscall, action ScmpAction, conds []ScmpCondition) error {
10351032
return f.addRuleGeneric(call, action, false, conds)
10361033
}
@@ -1042,9 +1039,6 @@ func (f *ScmpFilter) AddRuleConditional(call ScmpSyscall, action ScmpAction, con
10421039
// The rule will function exactly as described, but it may not function identically
10431040
// (or be able to be applied to) all architectures.
10441041
// Returns an error if an issue was encountered adding the rule.
1045-
// There is a bug in library versions below v2.2.1 which can, in some cases,
1046-
// cause conditions to be lost when more than one are used. Consequently,
1047-
// AddRuleConditionalExact is disabled on library versions lower than v2.2.1
10481042
func (f *ScmpFilter) AddRuleConditionalExact(call ScmpSyscall, action ScmpAction, conds []ScmpCondition) error {
10491043
return f.addRuleGeneric(call, action, true, conds)
10501044
}

seccomp_internal.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build linux
12
// +build linux
23

34
// Internal functions for libseccomp Go bindings
@@ -27,10 +28,10 @@ import (
2728
#include <stdlib.h>
2829
#include <seccomp.h>
2930
30-
#if SCMP_VER_MAJOR < 2
31-
#error Minimum supported version of Libseccomp is v2.2.0
32-
#elif SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR < 2
33-
#error Minimum supported version of Libseccomp is v2.2.0
31+
#if (SCMP_VER_MAJOR < 2) || \
32+
(SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR < 2) || \
33+
(SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR == 2 && SCMP_VER_MICRO < 1)
34+
#error Minimum supported version of Libseccomp is v2.2.1
3435
#endif
3536
3637
#define ARCH_BAD ~0
@@ -324,7 +325,7 @@ func checkVersion(op string, major, minor, micro uint) error {
324325
}
325326

326327
func ensureSupportedVersion() error {
327-
return checkVersion("seccomp", 2, 2, 0)
328+
return checkVersion("seccomp", 2, 2, 1)
328329
}
329330

330331
// Get the API level
@@ -442,11 +443,6 @@ func (f *ScmpFilter) addRuleGeneric(call ScmpSyscall, action ScmpAction, exact b
442443
return err
443444
}
444445
} else {
445-
// We don't support conditional filtering in library version v2.1
446-
if err := checkVersion("conditional filtering", 2, 2, 1); err != nil {
447-
return err
448-
}
449-
450446
argsArr := C.make_arg_cmp_array(C.uint(len(conds)))
451447
if argsArr == nil {
452448
return fmt.Errorf("error allocating memory for conditions")

0 commit comments

Comments
 (0)