Skip to content

Commit

Permalink
merge #4152 into opencontainers/runc:main
Browse files Browse the repository at this point in the history
Akihiro Suda (1):
  script/check-config.sh: check CONFIG_CHECKPOINT_RESTORE

Kir Kolyshkin (4):
  script/check-config.sh: check CONFIG_BLK_CGROUP_IOCOST
  scripts/check-config: fix kernel version checks
  script/check-config: disable colors
  scripts/check-config: don't check MEMCG_SWAP on newer kernels

LGTMs: AkihiroSuda cyphar
  • Loading branch information
cyphar committed Jan 7, 2024
2 parents c255024 + 5a4f521 commit cbd852b
Showing 1 changed file with 37 additions and 9 deletions.
46 changes: 37 additions & 9 deletions script/check-config.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -e -u

[ -t 1 ] || NO_COLOR=1

# bits of this were adapted from check_config.sh in docker
# see also https://github.com/docker/docker/blob/master/contrib/check-config.sh

Expand All @@ -27,9 +29,19 @@ kernelMajor="${kernelVersion%%.*}"
kernelMinor="${kernelVersion#"$kernelMajor".}"
kernelMinor="${kernelMinor%%.*}"

# Usage: to check if kernel version is < 4.8, use
# kernel_lt 4 8
# (here "lt" stands for "less than").
kernel_lt() {
[ "$kernelMajor" -lt "$1" ] && return
[ "$kernelMajor" -eq "$1" ] && [ "$kernelMinor" -le "$2" ]
[ "$kernelMajor" -eq "$1" ] && [ "$kernelMinor" -lt "$2" ]
}

# Usage: to check if kernel version is >= 6.1, use
# kernel_ge 6 1
# (here "ge" stands for "greater or equal").
kernel_ge() {
! kernel_lt "$1" "$2"
}

is_set() {
Expand All @@ -43,6 +55,8 @@ is_set_as_module() {
}

color() {
[ -n "${NO_COLOR:-}" ] && return

local codes=()
if [ "$1" = 'bold' ]; then
codes=("${codes[@]-}" '1')
Expand Down Expand Up @@ -230,16 +244,17 @@ flags=(
)
check_flags "${flags[@]}"

if ! kernel_lt 4 14; then
if [ $cgroup = "v2" ]; then
check_flags CGROUP_BPF
fi
# Linux kernel commit 3007098494be.
if kernel_ge 4 10 && [ $cgroup = "v2" ]; then
check_flags CGROUP_BPF
fi

# Linux kernel commit 3bf195ae6037.
if kernel_lt 5 1; then
check_flags NF_NAT_IPV4
fi

# Linux kernel commit 4806e975729f99c7.
if kernel_lt 5 2; then
check_flags NF_NAT_NEEDED
fi
Expand All @@ -255,8 +270,11 @@ echo 'Optional Features:'
check_flags SECCOMP_FILTER
check_flags CGROUP_PIDS

check_flags MEMCG_SWAP

# Linux kernel commit e55b9f96860f.
if kernel_lt 6 1; then
check_flags MEMCG_SWAP
fi
# Linux kernel commit 2d1c498072de.
if kernel_lt 5 8; then
check_flags MEMCG_SWAP_ENABLED
if is_set MEMCG_SWAP && ! is_set MEMCG_SWAP_ENABLED; then
Expand All @@ -265,24 +283,33 @@ echo 'Optional Features:'
fi
}

# Linux kernel commit d886f4e483ce.
if kernel_lt 4 5; then
check_flags MEMCG_KMEM
fi

if kernel_lt 3 18; then
# Linux kernel commit 5b1efc027c0b.
if kernel_lt 3 19; then
check_flags RESOURCE_COUNTERS
fi

if kernel_lt 3 13; then
# Linux kernel commit 86f8515f9721.
if kernel_lt 3 14; then
netprio=NETPRIO_CGROUP
else
netprio=CGROUP_NET_PRIO
fi

# Linux kernel commit f382fb0bcef4.
if kernel_lt 5 0; then
check_flags IOSCHED_CFQ CFQ_GROUP_IOSCHED
fi

# Linux kernel commit 7caa47151ab2.
if kernel_ge 5 4; then
check_flags BLK_CGROUP_IOCOST
fi

flags=(
BLK_CGROUP BLK_DEV_THROTTLING
CGROUP_PERF
Expand All @@ -297,5 +324,6 @@ flags=(
IP_VS_RR
SECURITY_SELINUX
SECURITY_APPARMOR
CHECKPOINT_RESTORE
)
check_flags "${flags[@]}"

0 comments on commit cbd852b

Please sign in to comment.