52.1. libseccomp-2.6.1
High-level userspace seccomp interface
| Version | 2.6.1, release 1 |
| Shelf | containers — Container runtimes, image tools, container networking and sandbox primitives |
| Phase | 30_foundation (Build Foundation), 7 of 127 in build order |
| Licence | LGPL-2.1-only |
| Homepage | https://github.com/seccomp/libseccomp |
| Build time | 0.1 SBU |
| Installed size | 387.1 KiB in 44 files |
| Recipe | ports/core/containers/libseccomp/kpkgbuild |
About
libseccomp builds seccomp filters, the kernel’s per-process lists of allowed system calls, from a plain C interface, so a program names the calls it allows instead of writing BPF by hand. In KDOS its main consumer is the container stack behind every box: crun, the runtime podman starts each container with, applies the seccomp profile of the container through it, and podman, buildah, conmon and slirp4netns are built with it as well; see The box. Outside the boxes, qemu (--enable-seccomp) and file (--enable-libseccomp) sandbox themselves with it, and virtiofsd, swtpm, universal-ctags and both WebKitGTK ports depend on it too.
Apart from --disable-static, the port takes upstream’s defaults. The Python bindings are off, as they are unless --enable-python is given; they need Cython.
Sources
libseccomp-2.6.1.tar.gz(640.9 KiB)
sha256501f66c667225d53791b97e1d7cf85ab764c297d04881f60f38f451c4b0ee1be
upstream: https://github.com/seccomp/libseccomp/releases/download/v2.6.1/libseccomp-2.6.1.tar.gz
archive copy: sources-1/containers--libseccomp-2.6.1.tar.gz
Dependencies
Depends on: gperf.
Required by (12): buildah, conmon, crun, file, podman, qemu, slirp4netns, swtpm, universal-ctags, virtiofsd, webkitgtk, webkitgtk6.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/30_foundation/phase.env && kpkg install libseccomp'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/containers/libseccomp.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/containers/libseccomp
echo '501f66c667225d53791b97e1d7cf85ab764c297d04881f60f38f451c4b0ee1be libseccomp-2.6.1.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/libseccomp
SRC=$SRC_ROOT/libseccomp-2.6.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libseccomp-2.6.1.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
./configure --prefix=/usr --disable-static
make
make DESTDIR=$PKG install
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/libseccomp, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf libseccomp-2.6.1-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/libseccomp, and runs the triggers its paths call for.
Contents
Installed programs: scmp_sys_resolver.
Installed libraries: libseccomp.so.
Installed directories: /usr/share/licenses/libseccomp.
Short descriptions
scmp_sys_resolver |
Resolve system calls |
libseccomp.pc |
The enhanced seccomp library |
Notes
configure stops with “please install gperf” when gperf is missing. The release archive already carries the generated system-call lookup table, src/syscalls.perf.c, and the Makefile runs gperf to rebuild it only when syscalls.csv or its template is newer; the configure check is made regardless. gperf is in depends for that check; the library does not use it at run time.