update to use containerd seccomp package
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
9ff5e389ff
commit
09243b740c
8199 changed files with 30742 additions and 1598219 deletions
33
vendor/github.com/opencontainers/runc/script/.validate
generated
vendored
33
vendor/github.com/opencontainers/runc/script/.validate
generated
vendored
|
@ -1,33 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$VALIDATE_UPSTREAM" ]; then
|
||||
# this is kind of an expensive check, so let's not do this twice if we
|
||||
# are running more than one validate bundlescript
|
||||
|
||||
VALIDATE_REPO='https://github.com/opencontainers/runc.git'
|
||||
VALIDATE_BRANCH='master'
|
||||
|
||||
if [ "$TRAVIS" = 'true' -a "$TRAVIS_PULL_REQUEST" != 'false' ]; then
|
||||
VALIDATE_REPO="https://github.com/${TRAVIS_REPO_SLUG}.git"
|
||||
VALIDATE_BRANCH="${TRAVIS_BRANCH}"
|
||||
fi
|
||||
|
||||
VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
|
||||
|
||||
git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH"
|
||||
VALIDATE_UPSTREAM="$(git rev-parse --verify FETCH_HEAD)"
|
||||
|
||||
VALIDATE_COMMIT_LOG="$VALIDATE_UPSTREAM..$VALIDATE_HEAD"
|
||||
VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
|
||||
|
||||
validate_diff() {
|
||||
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
|
||||
git diff "$VALIDATE_COMMIT_DIFF" "$@"
|
||||
fi
|
||||
}
|
||||
validate_log() {
|
||||
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
|
||||
git log "$VALIDATE_COMMIT_LOG" "$@"
|
||||
fi
|
||||
}
|
||||
fi
|
247
vendor/github.com/opencontainers/runc/script/check-config.sh
generated
vendored
247
vendor/github.com/opencontainers/runc/script/check-config.sh
generated
vendored
|
@ -1,247 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# bits of this were adapted from check_config.sh in docker
|
||||
# see also https://github.com/docker/docker/blob/master/contrib/check-config.sh
|
||||
|
||||
possibleConfigs=(
|
||||
'/proc/config.gz'
|
||||
"/boot/config-$(uname -r)"
|
||||
"/usr/src/linux-$(uname -r)/.config"
|
||||
'/usr/src/linux/.config'
|
||||
)
|
||||
possibleConfigFiles=(
|
||||
'config.gz'
|
||||
"config-$(uname -r)"
|
||||
'.config'
|
||||
)
|
||||
|
||||
if ! command -v zgrep &>/dev/null; then
|
||||
zgrep() {
|
||||
zcat "$2" | grep "$1"
|
||||
}
|
||||
fi
|
||||
|
||||
kernelVersion="$(uname -r)"
|
||||
kernelMajor="${kernelVersion%%.*}"
|
||||
kernelMinor="${kernelVersion#$kernelMajor.}"
|
||||
kernelMinor="${kernelMinor%%.*}"
|
||||
|
||||
is_set() {
|
||||
zgrep "CONFIG_$1=[y|m]" "$CONFIG" >/dev/null
|
||||
}
|
||||
is_set_in_kernel() {
|
||||
zgrep "CONFIG_$1=y" "$CONFIG" >/dev/null
|
||||
}
|
||||
is_set_as_module() {
|
||||
zgrep "CONFIG_$1=m" "$CONFIG" >/dev/null
|
||||
}
|
||||
|
||||
color() {
|
||||
local codes=()
|
||||
if [ "$1" = 'bold' ]; then
|
||||
codes=("${codes[@]}" '1')
|
||||
shift
|
||||
fi
|
||||
if [ "$#" -gt 0 ]; then
|
||||
local code
|
||||
case "$1" in
|
||||
# see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
|
||||
black) code=30 ;;
|
||||
red) code=31 ;;
|
||||
green) code=32 ;;
|
||||
yellow) code=33 ;;
|
||||
blue) code=34 ;;
|
||||
magenta) code=35 ;;
|
||||
cyan) code=36 ;;
|
||||
white) code=37 ;;
|
||||
esac
|
||||
if [ "$code" ]; then
|
||||
codes=("${codes[@]}" "$code")
|
||||
fi
|
||||
fi
|
||||
local IFS=';'
|
||||
echo -en '\033['"${codes[*]}"'m'
|
||||
}
|
||||
wrap_color() {
|
||||
text="$1"
|
||||
shift
|
||||
color "$@"
|
||||
echo -n "$text"
|
||||
color reset
|
||||
echo
|
||||
}
|
||||
|
||||
wrap_good() {
|
||||
echo "$(wrap_color "$1" white): $(wrap_color "$2" green)"
|
||||
}
|
||||
wrap_bad() {
|
||||
echo "$(wrap_color "$1" bold): $(wrap_color "$2" bold red)"
|
||||
}
|
||||
wrap_warning() {
|
||||
wrap_color >&2 "$*" red
|
||||
}
|
||||
|
||||
check_flag() {
|
||||
if is_set_in_kernel "$1"; then
|
||||
wrap_good "CONFIG_$1" 'enabled'
|
||||
elif is_set_as_module "$1"; then
|
||||
wrap_good "CONFIG_$1" 'enabled (as module)'
|
||||
else
|
||||
wrap_bad "CONFIG_$1" 'missing'
|
||||
fi
|
||||
}
|
||||
|
||||
check_flags() {
|
||||
for flag in "$@"; do
|
||||
echo "- $(check_flag "$flag")"
|
||||
done
|
||||
}
|
||||
|
||||
check_distro_userns() {
|
||||
source /etc/os-release 2>/dev/null || /bin/true
|
||||
if [[ "${ID}" =~ ^(centos|rhel)$ && "${VERSION_ID}" =~ ^7 ]]; then
|
||||
# this is a CentOS7 or RHEL7 system
|
||||
grep -q "user_namespace.enable=1" /proc/cmdline || {
|
||||
# no user namespace support enabled
|
||||
wrap_bad " (RHEL7/CentOS7" "User namespaces disabled; add 'user_namespace.enable=1' to boot command line)"
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
is_config() {
|
||||
local config="$1"
|
||||
|
||||
# Todo: more check
|
||||
[[ -f "$config" ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
search_config() {
|
||||
local target_dir="$1"
|
||||
[[ "$target_dir" ]] || target_dir=("${possibleConfigs[@]}")
|
||||
|
||||
local tryConfig
|
||||
for tryConfig in "${target_dir[@]}"; do
|
||||
is_config "$tryConfig" && {
|
||||
CONFIG="$tryConfig"
|
||||
return
|
||||
}
|
||||
[[ -d "$tryConfig" ]] && {
|
||||
for tryFile in "${possibleConfigFiles[@]}"; do
|
||||
is_config "$tryConfig/$tryFile" && {
|
||||
CONFIG="$tryConfig/$tryFile"
|
||||
return
|
||||
}
|
||||
done
|
||||
}
|
||||
done
|
||||
|
||||
wrap_warning "error: cannot find kernel config"
|
||||
wrap_warning " try running this script again, specifying the kernel config:"
|
||||
wrap_warning " CONFIG=/path/to/kernel/.config $0 or $0 /path/to/kernel/.config"
|
||||
exit 1
|
||||
}
|
||||
|
||||
CONFIG="$1"
|
||||
|
||||
is_config "$CONFIG" || {
|
||||
if [[ ! "$CONFIG" ]]; then
|
||||
wrap_color "info: no config specified, searching for kernel config ..." white
|
||||
search_config
|
||||
elif [[ -d "$CONFIG" ]]; then
|
||||
wrap_color "info: input is a directory, searching for kernel config in this directory..." white
|
||||
search_config "$CONFIG"
|
||||
else
|
||||
wrap_warning "warning: $CONFIG seems not a kernel config, searching other paths for kernel config ..."
|
||||
search_config
|
||||
fi
|
||||
}
|
||||
|
||||
wrap_color "info: reading kernel config from $CONFIG ..." white
|
||||
echo
|
||||
|
||||
echo 'Generally Necessary:'
|
||||
|
||||
echo -n '- '
|
||||
cgroupSubsystemDir="$(awk '/[, ](cpu|cpuacct|cpuset|devices|freezer|memory)[, ]/ && $3 == "cgroup" { print $2 }' /proc/mounts | head -n1)"
|
||||
cgroupDir="$(dirname "$cgroupSubsystemDir")"
|
||||
if [ -d "$cgroupDir/cpu" -o -d "$cgroupDir/cpuacct" -o -d "$cgroupDir/cpuset" -o -d "$cgroupDir/devices" -o -d "$cgroupDir/freezer" -o -d "$cgroupDir/memory" ]; then
|
||||
echo "$(wrap_good 'cgroup hierarchy' 'properly mounted') [$cgroupDir]"
|
||||
else
|
||||
if [ "$cgroupSubsystemDir" ]; then
|
||||
echo "$(wrap_bad 'cgroup hierarchy' 'single mountpoint!') [$cgroupSubsystemDir]"
|
||||
else
|
||||
echo "$(wrap_bad 'cgroup hierarchy' 'nonexistent??')"
|
||||
fi
|
||||
echo " $(wrap_color '(see https://github.com/tianon/cgroupfs-mount)' yellow)"
|
||||
fi
|
||||
|
||||
if [ "$(cat /sys/module/apparmor/parameters/enabled 2>/dev/null)" = 'Y' ]; then
|
||||
echo -n '- '
|
||||
if command -v apparmor_parser &>/dev/null; then
|
||||
echo "$(wrap_good 'apparmor' 'enabled and tools installed')"
|
||||
else
|
||||
echo "$(wrap_bad 'apparmor' 'enabled, but apparmor_parser missing')"
|
||||
echo -n ' '
|
||||
if command -v apt-get &>/dev/null; then
|
||||
echo "$(wrap_color '(use "apt-get install apparmor" to fix this)')"
|
||||
elif command -v yum &>/dev/null; then
|
||||
echo "$(wrap_color '(your best bet is "yum install apparmor-parser")')"
|
||||
else
|
||||
echo "$(wrap_color '(look for an "apparmor" package for your distribution)')"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
flags=(
|
||||
NAMESPACES {NET,PID,IPC,UTS}_NS
|
||||
CGROUPS CGROUP_CPUACCT CGROUP_DEVICE CGROUP_FREEZER CGROUP_SCHED CPUSETS MEMCG
|
||||
KEYS
|
||||
MACVLAN VETH BRIDGE BRIDGE_NETFILTER
|
||||
NF_NAT_IPV4 IP_NF_FILTER IP_NF_TARGET_MASQUERADE
|
||||
NETFILTER_XT_MATCH_{ADDRTYPE,CONNTRACK}
|
||||
NF_NAT NF_NAT_NEEDED
|
||||
|
||||
# required for bind-mounting /dev/mqueue into containers
|
||||
POSIX_MQUEUE
|
||||
)
|
||||
check_flags "${flags[@]}"
|
||||
echo
|
||||
|
||||
echo 'Optional Features:'
|
||||
{
|
||||
check_flags USER_NS
|
||||
check_distro_userns
|
||||
|
||||
check_flags SECCOMP
|
||||
check_flags CGROUP_PIDS
|
||||
|
||||
check_flags MEMCG_SWAP MEMCG_SWAP_ENABLED
|
||||
if is_set MEMCG_SWAP && ! is_set MEMCG_SWAP_ENABLED; then
|
||||
echo " $(wrap_color '(note that cgroup swap accounting is not enabled in your kernel config, you can enable it by setting boot option "swapaccount=1")' bold black)"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$kernelMajor" -lt 4 ] || [ "$kernelMajor" -eq 4 -a "$kernelMinor" -le 5 ]; then
|
||||
check_flags MEMCG_KMEM
|
||||
fi
|
||||
|
||||
if [ "$kernelMajor" -lt 3 ] || [ "$kernelMajor" -eq 3 -a "$kernelMinor" -le 18 ]; then
|
||||
check_flags RESOURCE_COUNTERS
|
||||
fi
|
||||
|
||||
if [ "$kernelMajor" -lt 3 ] || [ "$kernelMajor" -eq 3 -a "$kernelMinor" -le 13 ]; then
|
||||
netprio=NETPRIO_CGROUP
|
||||
else
|
||||
netprio=CGROUP_NET_PRIO
|
||||
fi
|
||||
|
||||
flags=(
|
||||
BLK_CGROUP BLK_DEV_THROTTLING IOSCHED_CFQ CFQ_GROUP_IOSCHED
|
||||
CGROUP_PERF
|
||||
CGROUP_HUGETLB
|
||||
NET_CLS_CGROUP $netprio
|
||||
CFS_BANDWIDTH FAIR_GROUP_SCHED RT_GROUP_SCHED
|
||||
)
|
||||
check_flags "${flags[@]}"
|
130
vendor/github.com/opencontainers/runc/script/release.sh
generated
vendored
130
vendor/github.com/opencontainers/runc/script/release.sh
generated
vendored
|
@ -1,130 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright (C) 2017 SUSE LLC.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -e
|
||||
|
||||
## --->
|
||||
# Project-specific options and functions. In *theory* you shouldn't need to
|
||||
# touch anything else in this script in order to use this elsewhere.
|
||||
project="runc"
|
||||
root="$(readlink -f "$(dirname "${BASH_SOURCE}")/..")"
|
||||
|
||||
# This function takes an output path as an argument, where the built
|
||||
# (preferably static) binary should be placed.
|
||||
function build_project() {
|
||||
builddir="$(dirname "$1")"
|
||||
|
||||
# Build with all tags enabled.
|
||||
make -C "$root" COMMIT_NO= BUILDTAGS="seccomp selinux apparmor" static
|
||||
mv "$root/$project" "$1"
|
||||
}
|
||||
|
||||
# End of the easy-to-configure portion.
|
||||
## <---
|
||||
|
||||
# Print usage information.
|
||||
function usage() {
|
||||
echo "usage: release.sh [-S <gpg-key-id>] [-c <commit-ish>] [-r <release-dir>] [-v <version>]" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Log something to stderr.
|
||||
function log() {
|
||||
echo "[*] $*" >&2
|
||||
}
|
||||
|
||||
# Log something to stderr and then exit with 0.
|
||||
function bail() {
|
||||
log "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Conduct a sanity-check to make sure that GPG provided with the given
|
||||
# arguments can sign something. Inability to sign things is not a fatal error.
|
||||
function gpg_cansign() {
|
||||
gpg "$@" --clear-sign </dev/null >/dev/null
|
||||
}
|
||||
|
||||
# When creating releases we need to build static binaries, an archive of the
|
||||
# current commit, and generate detached signatures for both.
|
||||
keyid=""
|
||||
commit="HEAD"
|
||||
version=""
|
||||
releasedir=""
|
||||
hashcmd=""
|
||||
while getopts "S:c:r:v:h:" opt; do
|
||||
case "$opt" in
|
||||
S)
|
||||
keyid="$OPTARG"
|
||||
;;
|
||||
c)
|
||||
commit="$OPTARG"
|
||||
;;
|
||||
r)
|
||||
releasedir="$OPTARG"
|
||||
;;
|
||||
v)
|
||||
version="$OPTARG"
|
||||
;;
|
||||
h)
|
||||
hashcmd="$OPTARG"
|
||||
;;
|
||||
\:)
|
||||
echo "Missing argument: -$OPTARG" >&2
|
||||
usage
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
version="${version:-$(<"$root/VERSION")}"
|
||||
releasedir="${releasedir:-release/$version}"
|
||||
hashcmd="${hashcmd:-sha256sum}"
|
||||
goarch="$(go env GOARCH || echo "amd64")"
|
||||
|
||||
log "creating $project release in '$releasedir'"
|
||||
log " version: $version"
|
||||
log " commit: $commit"
|
||||
log " key: ${keyid:-DEFAULT}"
|
||||
log " hash: $hashcmd"
|
||||
|
||||
# Make explicit what we're doing.
|
||||
set -x
|
||||
|
||||
# Make the release directory.
|
||||
rm -rf "$releasedir" && mkdir -p "$releasedir"
|
||||
|
||||
# Build project.
|
||||
build_project "$releasedir/$project.$goarch"
|
||||
|
||||
# Generate new archive.
|
||||
git archive --format=tar --prefix="$project-$version/" "$commit" | xz > "$releasedir/$project.tar.xz"
|
||||
|
||||
# Generate sha256 checksums for both.
|
||||
( cd "$releasedir" ; "$hashcmd" "$project".{"$goarch",tar.xz} > "$project.$hashcmd" ; )
|
||||
|
||||
# Set up the gpgflags.
|
||||
[[ "$keyid" ]] && export gpgflags="--default-key $keyid"
|
||||
gpg_cansign $gpgflags || bail "Could not find suitable GPG key, skipping signing step."
|
||||
|
||||
# Sign everything.
|
||||
gpg $gpgflags --detach-sign --armor "$releasedir/$project.$goarch"
|
||||
gpg $gpgflags --detach-sign --armor "$releasedir/$project.tar.xz"
|
||||
gpg $gpgflags --clear-sign --armor \
|
||||
--output "$releasedir/$project.$hashcmd"{.tmp,} && \
|
||||
mv "$releasedir/$project.$hashcmd"{.tmp,}
|
4
vendor/github.com/opencontainers/runc/script/tmpmount
generated
vendored
4
vendor/github.com/opencontainers/runc/script/tmpmount
generated
vendored
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
mount -t tmpfs none /tmp
|
||||
exec "$@"
|
42
vendor/github.com/opencontainers/runc/script/validate-c
generated
vendored
42
vendor/github.com/opencontainers/runc/script/validate-c
generated
vendored
|
@ -1,42 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.validate"
|
||||
|
||||
IFS=$'\n'
|
||||
files=($(validate_diff --diff-filter=ACMR --name-only -- '*.c' | grep -v '^vendor/' || true))
|
||||
unset IFS
|
||||
|
||||
# indent(1): "You must use the ‘-T’ option to tell indent the name of all the typenames in your program that are defined by typedef."
|
||||
INDENT="indent -linux -l120 -T size_t -T jmp_buf"
|
||||
if [ -z "$(indent --version 2>&1 | grep GNU)" ]; then
|
||||
echo "Skipping C indentation checks, as GNU indent is not installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
badFiles=()
|
||||
for f in "${files[@]}"; do
|
||||
orig=$(mktemp)
|
||||
formatted=$(mktemp)
|
||||
# we use "git show" here to validate that what's committed is formatted
|
||||
git show "$VALIDATE_HEAD:$f" > ${orig}
|
||||
${INDENT} ${orig} -o ${formatted}
|
||||
if [ "$(diff -u ${orig} ${formatted})" ]; then
|
||||
badFiles+=("$f")
|
||||
fi
|
||||
rm -f ${orig} ${formatted}
|
||||
done
|
||||
|
||||
if [ ${#badFiles[@]} -eq 0 ]; then
|
||||
echo 'Congratulations! All C source files are properly formatted.'
|
||||
else
|
||||
{
|
||||
echo "These files are not properly formatted:"
|
||||
for f in "${badFiles[@]}"; do
|
||||
echo " - $f"
|
||||
done
|
||||
echo
|
||||
echo "Please reformat the above files using \"${INDENT}\" and commit the result."
|
||||
echo
|
||||
} >&2
|
||||
false
|
||||
fi
|
30
vendor/github.com/opencontainers/runc/script/validate-gofmt
generated
vendored
30
vendor/github.com/opencontainers/runc/script/validate-gofmt
generated
vendored
|
@ -1,30 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.validate"
|
||||
|
||||
IFS=$'\n'
|
||||
files=($(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true))
|
||||
unset IFS
|
||||
|
||||
badFiles=()
|
||||
for f in "${files[@]}"; do
|
||||
# we use "git show" here to validate that what's committed is formatted
|
||||
if [ "$(git show "$VALIDATE_HEAD:$f" | gofmt -s -l)" ]; then
|
||||
badFiles+=("$f")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#badFiles[@]} -eq 0 ]; then
|
||||
echo 'Congratulations! All Go source files are properly formatted.'
|
||||
else
|
||||
{
|
||||
echo "These files are not properly gofmt'd:"
|
||||
for f in "${badFiles[@]}"; do
|
||||
echo " - $f"
|
||||
done
|
||||
echo
|
||||
echo 'Please reformat the above files using "gofmt -s -w" and commit the result.'
|
||||
echo
|
||||
} >&2
|
||||
false
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue