Skip to content

Commit cbd852b

Browse files
committed
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
2 parents c255024 + 5a4f521 commit cbd852b

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

script/check-config.sh

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
22
set -e -u
33

4+
[ -t 1 ] || NO_COLOR=1
5+
46
# bits of this were adapted from check_config.sh in docker
57
# see also https://github.com/docker/docker/blob/master/contrib/check-config.sh
68

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

32+
# Usage: to check if kernel version is < 4.8, use
33+
# kernel_lt 4 8
34+
# (here "lt" stands for "less than").
3035
kernel_lt() {
3136
[ "$kernelMajor" -lt "$1" ] && return
32-
[ "$kernelMajor" -eq "$1" ] && [ "$kernelMinor" -le "$2" ]
37+
[ "$kernelMajor" -eq "$1" ] && [ "$kernelMinor" -lt "$2" ]
38+
}
39+
40+
# Usage: to check if kernel version is >= 6.1, use
41+
# kernel_ge 6 1
42+
# (here "ge" stands for "greater or equal").
43+
kernel_ge() {
44+
! kernel_lt "$1" "$2"
3345
}
3446

3547
is_set() {
@@ -43,6 +55,8 @@ is_set_as_module() {
4355
}
4456

4557
color() {
58+
[ -n "${NO_COLOR:-}" ] && return
59+
4660
local codes=()
4761
if [ "$1" = 'bold' ]; then
4862
codes=("${codes[@]-}" '1')
@@ -230,16 +244,17 @@ flags=(
230244
)
231245
check_flags "${flags[@]}"
232246

233-
if ! kernel_lt 4 14; then
234-
if [ $cgroup = "v2" ]; then
235-
check_flags CGROUP_BPF
236-
fi
247+
# Linux kernel commit 3007098494be.
248+
if kernel_ge 4 10 && [ $cgroup = "v2" ]; then
249+
check_flags CGROUP_BPF
237250
fi
238251

252+
# Linux kernel commit 3bf195ae6037.
239253
if kernel_lt 5 1; then
240254
check_flags NF_NAT_IPV4
241255
fi
242256

257+
# Linux kernel commit 4806e975729f99c7.
243258
if kernel_lt 5 2; then
244259
check_flags NF_NAT_NEEDED
245260
fi
@@ -255,8 +270,11 @@ echo 'Optional Features:'
255270
check_flags SECCOMP_FILTER
256271
check_flags CGROUP_PIDS
257272

258-
check_flags MEMCG_SWAP
259-
273+
# Linux kernel commit e55b9f96860f.
274+
if kernel_lt 6 1; then
275+
check_flags MEMCG_SWAP
276+
fi
277+
# Linux kernel commit 2d1c498072de.
260278
if kernel_lt 5 8; then
261279
check_flags MEMCG_SWAP_ENABLED
262280
if is_set MEMCG_SWAP && ! is_set MEMCG_SWAP_ENABLED; then
@@ -265,24 +283,33 @@ echo 'Optional Features:'
265283
fi
266284
}
267285

286+
# Linux kernel commit d886f4e483ce.
268287
if kernel_lt 4 5; then
269288
check_flags MEMCG_KMEM
270289
fi
271290

272-
if kernel_lt 3 18; then
291+
# Linux kernel commit 5b1efc027c0b.
292+
if kernel_lt 3 19; then
273293
check_flags RESOURCE_COUNTERS
274294
fi
275295

276-
if kernel_lt 3 13; then
296+
# Linux kernel commit 86f8515f9721.
297+
if kernel_lt 3 14; then
277298
netprio=NETPRIO_CGROUP
278299
else
279300
netprio=CGROUP_NET_PRIO
280301
fi
281302

303+
# Linux kernel commit f382fb0bcef4.
282304
if kernel_lt 5 0; then
283305
check_flags IOSCHED_CFQ CFQ_GROUP_IOSCHED
284306
fi
285307

308+
# Linux kernel commit 7caa47151ab2.
309+
if kernel_ge 5 4; then
310+
check_flags BLK_CGROUP_IOCOST
311+
fi
312+
286313
flags=(
287314
BLK_CGROUP BLK_DEV_THROTTLING
288315
CGROUP_PERF
@@ -297,5 +324,6 @@ flags=(
297324
IP_VS_RR
298325
SECURITY_SELINUX
299326
SECURITY_APPARMOR
327+
CHECKPOINT_RESTORE
300328
)
301329
check_flags "${flags[@]}"

0 commit comments

Comments
 (0)