-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
seccompfilter: Use SCMP_ACT_KILL_PROCESS only on compatible kernels #234
Changes from all commits
b04f711
9763e40
0587bbf
62d0028
76e7a52
61da2a6
a15a4f3
189e1ed
bf13e3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,39 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v2 | ||
- run: DOCKER_BUILDKIT=1 docker build -f Dockerfile.buildtests . | ||
test-centos: | ||
runs-on: macos-latest | ||
env: | ||
LIBSECCOMP_COMMIT: v2.3.3 | ||
LIBSLIRP_COMMIT: v4.1.0 | ||
BENCHMARK_IPERF3_DURATION: 3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It probably makes sense to not run the full 4 x 60 seconds benchmark in each CI job. I only reduced the time for the duration for the newly added VM-based job. |
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup CentOS 7 VM | ||
run: | | ||
vagrant up --provision --no-tty | ||
cat > ./run-vagrant-tests <<'EOF' | ||
exec vagrant ssh --no-tty -c " | ||
export LIBSECCOMP_COMMIT=\"${LIBSECCOMP_COMMIT}\" | ||
export LIBSLIRP_COMMIT=\"${LIBSLIRP_COMMIT}\" | ||
export BENCHMARK_IPERF3_DURATION=\"${BENCHMARK_IPERF3_DURATION}\" | ||
/src/build-and-test | ||
" | ||
EOF | ||
- name: Build and test with Debian 10's version of libseccomp | ||
run: sh ./run-vagrant-tests | ||
- name: Build and test with Ubuntu 20.04's versions of libseccomp/libslirp | ||
run: sh ./run-vagrant-tests | ||
env: | ||
LIBSECCOMP_COMMIT: v2.4.3 | ||
LIBSLIRP_COMMIT: v4.1.0 | ||
- name: Build and test with recent versions of libseccomp/libslirp | ||
run: sh ./run-vagrant-tests | ||
env: | ||
LIBSECCOMP_COMMIT: v2.5.0 | ||
LIBSLIRP_COMMIT: v4.2.0 | ||
# Fails with --disable-dns from libslirp >=4.3.0 | ||
# (no timeout in test-slirp4netns-disable-dns.sh). | ||
Comment on lines
+50
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not investigate this further, so can't tell if it's kernel or There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. timeout of what? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/rootless-containers/slirp4netns/blob/v1.1.6/tests/test-slirp4netns-disable-dns.sh#L33-L35 does not get a timeout message to |
||
artifact: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
Vagrant.configure("2") do |config| | ||
require 'etc' | ||
config.vm.provider "virtualbox" do |vbox| | ||
vbox.cpus = [1, Etc.nprocessors].max | ||
end | ||
config.vm.box = "centos/7" | ||
config.vm.synced_folder ".", "/vagrant", disabled: true | ||
config.vm.synced_folder ".", "/src/slirp4netns", type: "rsync" | ||
config.vm.provision "shell", | ||
inline: <<~'SHELL' | ||
set -xeu | ||
sysctl user.max_user_namespaces=65536 | ||
|
||
yum install -y \ | ||
epel-release \ | ||
https://repo.ius.io/ius-release-el7.rpm | ||
|
||
yum install -y \ | ||
autoconf automake make gcc gperf libtool \ | ||
git-core meson ninja-build \ | ||
glib2-devel libcap-devel \ | ||
git-core libtool iproute iputils iperf3 nmap jq | ||
|
||
cd /src | ||
chown vagrant . | ||
|
||
su vagrant -c ' | ||
set -xeu | ||
|
||
git clone --depth=1 --no-checkout https://github.com/seccomp/libseccomp | ||
git -C ./libseccomp fetch --tags --depth=1 | ||
|
||
git clone --depth=1 --no-checkout https://gitlab.freedesktop.org/slirp/libslirp.git | ||
git -C ./libslirp fetch --tags --depth=1 | ||
|
||
touch ./build-and-test | ||
chmod a+x ./build-and-test | ||
' | ||
|
||
cat > ./build-and-test <<'EOS' | ||
Comment on lines
+36
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have only included this static |
||
#! /bin/sh | ||
set -xeu | ||
src_dir='/src' | ||
|
||
prefix="${PREFIX:-${HOME}/prefix}" | ||
build_root="${BUILD_ROOT:-${prefix}/build}" | ||
rm -rf "${prefix}" "${build_root}" | ||
mkdir -p "${build_root}" | ||
|
||
export CFLAGS="-I${prefix}" | ||
export LDFLAGS="-L${prefix} -Wl,-rpath,${prefix}/lib" | ||
export PKG_CONFIG_PATH="${prefix}/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}" | ||
|
||
git -C "${src_dir}/libseccomp" fetch --depth=1 origin "${LIBSECCOMP_COMMIT:-v2.4.3}" | ||
git -C "${src_dir}/libseccomp" checkout FETCH_HEAD | ||
( cd "${src_dir}/libseccomp" && ./autogen.sh ) | ||
mkdir "${build_root}/libseccomp" | ||
pushd "${build_root}/libseccomp" | ||
"${src_dir}/libseccomp/configure" --prefix="${prefix}" | ||
make -j "$( nproc )" CFLAGS+="-I$( pwd )/include" | ||
make install | ||
popd | ||
|
||
git -C "${src_dir}/libslirp" fetch --depth=1 origin "${LIBSLIRP_COMMIT:-v4.1.0}" | ||
git -C "${src_dir}/libslirp" checkout FETCH_HEAD | ||
mkdir "${build_root}/libslirp" | ||
pushd "${build_root}/libslirp" | ||
meson setup --prefix="${prefix}" --libdir=lib . "${src_dir}/libslirp" | ||
ninja -C . install | ||
popd | ||
|
||
( cd "${src_dir}/slirp4netns" && ./autogen.sh ) | ||
mkdir "${build_root}/slirp4netns" | ||
pushd "${build_root}/slirp4netns" | ||
"${src_dir}/slirp4netns/configure" --prefix="${prefix}" | ||
make -j "$( nproc )" | ||
|
||
make ci 'CLANGTIDY=echo skipping:' 'CLANGFORMAT=echo skipping:' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not look into how to install |
||
popd | ||
EOS | ||
SHELL | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,5 +43,5 @@ function cleanup { | |
} | ||
trap cleanup EXIT | ||
|
||
ip=$(nsenter --preserve-credentials -U -n --target=$child ip -json a show dev tun11 | jq -r .[1].addr_info[0].local) | ||
[[ $ip = 10.0.135.228 ]] | ||
result="$(nsenter --preserve-credentials -U -n --target=$child ip a show dev tun11)" | ||
echo "$result" | grep -om1 '^\s*inet .*/' | grep -qF 10.0.135.228 | ||
Comment on lines
+46
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The older |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
set -xeuo pipefail | ||
|
||
. $(dirname $0)/common.sh | ||
|
||
unshare -r -n sleep infinity & | ||
child=$! | ||
|
||
wait_for_network_namespace $child | ||
|
||
slirp4netns -c --enable-seccomp --userns-path=/proc/$child/ns/user $child tun11 & | ||
slirp_pid=$! | ||
|
||
wait_for_network_device $child tun11 | ||
|
||
function cleanup { | ||
kill -9 $child $slirp_pid | ||
} | ||
trap cleanup EXIT | ||
|
||
nsenter --preserve-credentials -U -n --target=$child ip -a netconf | grep tun11 | ||
|
||
nsenter --preserve-credentials -U -n --target=$child ip addr show tun11 | grep inet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the VM setup takes approx. twice as much time as an actual build+test, I opted for a single CI job because it seemed more economical. (But it is also just in the realm of 2 min. setup + 1 min. for each run.)