Skip to content

Commit

Permalink
Merge pull request #292 from yihuaf/yihuaf/seccomp
Browse files Browse the repository at this point in the history
Implemented seccomp and pass the integration test
  • Loading branch information
utam0k authored Sep 16, 2021
2 parents c0a344e + c0c51b1 commit eca4dee
Show file tree
Hide file tree
Showing 12 changed files with 2,108 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
working-directory: ./cgroups
- run: rustup component add rustfmt clippy
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Check formatting
run: cargo fmt --all -- --check
working-directory: ${{matrix.dirs}}
Expand All @@ -68,7 +68,7 @@ jobs:
with:
working-directory: ./cgroups
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Run tests
run: cargo test --all --all-features --no-fail-fast
coverage:
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
- name: Update System Libraries
run: sudo apt-get -y update
- name: Install System Libraries
run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev
run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Run Test Coverage for youki
run: |
cargo llvm-cov clean --workspace
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
with:
working-directory: ./cgroups
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Build
run: ./build.sh --release
- uses: actions/setup-go@v2
Expand Down
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description = "A container runtime written in Rust"
[workspace]
members = [
"cgroups",
"seccomp",
]

[features]
Expand Down Expand Up @@ -41,6 +42,7 @@ dbus = "0.9.2"
tabwriter = "1"
fastrand = "1.4.1"
crossbeam-channel = "0.5"
seccomp = { version = "0.1.0", path = "./seccomp" }

[dev-dependencies]
oci-spec = { git = "https://github.com/utam0k/oci-spec-rs/", tag = "v0.4.0-with-bugfix", features = ["proptests"] }
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ $ sudo apt-get install \
libsystemd-dev \
libdbus-glib-1-dev \
build-essential \
libelf-dev
libelf-dev \
libseccomp-dev
```

### Fedora, Centos, RHEL and related distributions
Expand All @@ -86,6 +87,7 @@ $ sudo dnf install \
systemd-devel \
dbus-devel \
elfutils-libelf-devel \
libseccomp-devel
```

## Build
Expand Down
2 changes: 1 addition & 1 deletion integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test_cases=(
# "linux_process_apparmor_profile/linux_process_apparmor_profile.t"
"linux_readonly_paths/linux_readonly_paths.t"
# "linux_rootfs_propagation/linux_rootfs_propagation.t"
# "linux_seccomp/linux_seccomp.t"
"linux_seccomp/linux_seccomp.t"
"linux_sysctl/linux_sysctl.t"
"linux_uid_mappings/linux_uid_mappings.t"
"misc_props/misc_props.t"
Expand Down
9 changes: 9 additions & 0 deletions seccomp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "seccomp"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
libc = "0.2.84"
11 changes: 11 additions & 0 deletions seccomp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Bindings to libseccomp

This crate contains a rust FFI binding to
[libseccomp](https://github.com/seccomp/libseccomp).

The code is adapted from auto generated code using
[rust-bindgen](https://github.com/rust-lang/rust-bindgen). The `rust-bindgen`
has some issue with detecting function macro, which `libseccomp` uses. We
decided to manually fix the issue and include the bindings in this crate.

The header file used: <https://github.com/seccomp/libseccomp/blob/main/include/seccomp.h.in>
Loading

0 comments on commit eca4dee

Please sign in to comment.