merge #4152 into opencontainers/runc:main

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
This commit is contained in:
Aleksa Sarai
2024-01-08 09:50:14 +11:00
+37 -9
View File
@@ -1,6 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e -u set -e -u
[ -t 1 ] || NO_COLOR=1
# bits of this were adapted from check_config.sh in docker # bits of this were adapted from check_config.sh in docker
# see also https://github.com/docker/docker/blob/master/contrib/check-config.sh # see also https://github.com/docker/docker/blob/master/contrib/check-config.sh
@@ -27,9 +29,19 @@ kernelMajor="${kernelVersion%%.*}"
kernelMinor="${kernelVersion#"$kernelMajor".}" kernelMinor="${kernelVersion#"$kernelMajor".}"
kernelMinor="${kernelMinor%%.*}" kernelMinor="${kernelMinor%%.*}"
# Usage: to check if kernel version is < 4.8, use
# kernel_lt 4 8
# (here "lt" stands for "less than").
kernel_lt() { kernel_lt() {
[ "$kernelMajor" -lt "$1" ] && return [ "$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() { is_set() {
@@ -43,6 +55,8 @@ is_set_as_module() {
} }
color() { color() {
[ -n "${NO_COLOR:-}" ] && return
local codes=() local codes=()
if [ "$1" = 'bold' ]; then if [ "$1" = 'bold' ]; then
codes=("${codes[@]-}" '1') codes=("${codes[@]-}" '1')
@@ -230,16 +244,17 @@ flags=(
) )
check_flags "${flags[@]}" check_flags "${flags[@]}"
if ! kernel_lt 4 14; then # Linux kernel commit 3007098494be.
if [ $cgroup = "v2" ]; then if kernel_ge 4 10 && [ $cgroup = "v2" ]; then
check_flags CGROUP_BPF check_flags CGROUP_BPF
fi
fi fi
# Linux kernel commit 3bf195ae6037.
if kernel_lt 5 1; then if kernel_lt 5 1; then
check_flags NF_NAT_IPV4 check_flags NF_NAT_IPV4
fi fi
# Linux kernel commit 4806e975729f99c7.
if kernel_lt 5 2; then if kernel_lt 5 2; then
check_flags NF_NAT_NEEDED check_flags NF_NAT_NEEDED
fi fi
@@ -255,8 +270,11 @@ echo 'Optional Features:'
check_flags SECCOMP_FILTER check_flags SECCOMP_FILTER
check_flags CGROUP_PIDS 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 if kernel_lt 5 8; then
check_flags MEMCG_SWAP_ENABLED check_flags MEMCG_SWAP_ENABLED
if is_set MEMCG_SWAP && ! is_set MEMCG_SWAP_ENABLED; then if is_set MEMCG_SWAP && ! is_set MEMCG_SWAP_ENABLED; then
@@ -265,24 +283,33 @@ echo 'Optional Features:'
fi fi
} }
# Linux kernel commit d886f4e483ce.
if kernel_lt 4 5; then if kernel_lt 4 5; then
check_flags MEMCG_KMEM check_flags MEMCG_KMEM
fi fi
if kernel_lt 3 18; then # Linux kernel commit 5b1efc027c0b.
if kernel_lt 3 19; then
check_flags RESOURCE_COUNTERS check_flags RESOURCE_COUNTERS
fi fi
if kernel_lt 3 13; then # Linux kernel commit 86f8515f9721.
if kernel_lt 3 14; then
netprio=NETPRIO_CGROUP netprio=NETPRIO_CGROUP
else else
netprio=CGROUP_NET_PRIO netprio=CGROUP_NET_PRIO
fi fi
# Linux kernel commit f382fb0bcef4.
if kernel_lt 5 0; then if kernel_lt 5 0; then
check_flags IOSCHED_CFQ CFQ_GROUP_IOSCHED check_flags IOSCHED_CFQ CFQ_GROUP_IOSCHED
fi fi
# Linux kernel commit 7caa47151ab2.
if kernel_ge 5 4; then
check_flags BLK_CGROUP_IOCOST
fi
flags=( flags=(
BLK_CGROUP BLK_DEV_THROTTLING BLK_CGROUP BLK_DEV_THROTTLING
CGROUP_PERF CGROUP_PERF
@@ -297,5 +324,6 @@ flags=(
IP_VS_RR IP_VS_RR
SECURITY_SELINUX SECURITY_SELINUX
SECURITY_APPARMOR SECURITY_APPARMOR
CHECKPOINT_RESTORE
) )
check_flags "${flags[@]}" check_flags "${flags[@]}"