From 89c108b1be6d7b88786e3144b7bce01598b132b1 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 11 Mar 2020 11:39:13 -0700 Subject: [PATCH] Makefile: add selinux and apparmor build tags Both selinux and apparmor subsystem can detect whether it is enabled, and act accordingly. Compiling it in by default should help avoid some frustration cased by missing build tags. This should not change anything in case BUILDTAGS is already set. README.md is amended to clarify what BUILDTAGS are enabled by default. [v2: add apparmor] [v3: add it unconditionally, fix README] Signed-off-by: Kir Kolyshkin --- Makefile | 2 +- README.md | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index c4273f513..9accc2c6d 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g") RUNC_IMAGE := runc_dev$(if $(GIT_BRANCH_CLEAN),:$(GIT_BRANCH_CLEAN)) PROJECT := github.com/opencontainers/runc -BUILDTAGS ?= seccomp +BUILDTAGS ?= seccomp selinux apparmor COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true) COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),"${COMMIT_NO}-dirty","${COMMIT_NO}") diff --git a/README.md b/README.md index b9a97f65d..fb3f49613 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,6 @@ It must be built with Go version 1.6 or higher in order for some features to fun In order to enable seccomp support you will need to install `libseccomp` on your platform. > e.g. `libseccomp-devel` for CentOS, or `libseccomp-dev` for Ubuntu -Otherwise, if you do not want to build `runc` with seccomp support you can add `BUILDTAGS=""` when running make. - ```bash # create a 'github.com/opencontainers' in your GOPATH/src cd github.com/opencontainers @@ -60,19 +58,22 @@ sudo make install #### Build Tags -`runc` supports optional build tags for compiling support of various features. -To add build tags to the make option the `BUILDTAGS` variable must be set. +`runc` supports optional build tags for compiling support of various features, +with some of them enabled by default (see `BUILDTAGS` in top-level `Makefile`). + +To change build tags from the default, set the `BUILDTAGS` variable for make, +e.g. ```bash make BUILDTAGS='seccomp apparmor' ``` -| Build Tag | Feature | Dependency | -|-----------|------------------------------------|-------------| -| seccomp | Syscall filtering | libseccomp | -| selinux | selinux process and mount labeling | | -| apparmor | apparmor profile support | | -| nokmem | disable kernel memory account | | +| Build Tag | Feature | Enabled by default | Dependency | +|-----------|------------------------------------|--------------------|------------| +| seccomp | Syscall filtering | yes | libseccomp | +| selinux | selinux process and mount labeling | yes | | +| apparmor | apparmor profile support | yes | | +| nokmem | disable kernel memory accounting | no | | ### Running the test suite