[LTS 8.6] net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve #142
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[LTS 8.6]
CVE-2023-4623
VULN-4106
Problem
https://www.cve.org/CVERecord?id=CVE-2023-4623
Analysis and solution
A single commit was identified as a fix for this issue: b3d26c5702c7d6c45456326e56d2ccf3f103e60f net/sched: sch_hfsc: Ensure inner classes have fsc curve.
The solution consisted of rejecting the addition of a class with a link-sharing curve to the class without it (see Specific tests for details):
The fix introduced a problem with existing network setup scripts for some users https://lore.kernel.org/all/297D84E3-736E-4AB4-B825-264279E2043C@flyingcircus.io/:
It was decided to fix the problem without breaking backwards compatibility https://lore.kernel.org/all/20231013151057.2611860-1-pctammela@mojatatu.com/:
The solution was to change the erroneous qdisc hierarchy to a correct one when the possible UAF condition was detected https://lore.kernel.org/all/20231013151057.2611860-1-pctammela@mojatatu.com/:
The fix of the fix is given in the commit a13b67c9a015c4e21601ef9aa4ec9c5d972df1b4
Of these two commits the first one is already backported in
1b3b94f375c5a1161a0d8669ba27243173ae8b6f
The other one, however, is misisng. Therefore the solution for CVE-2023-4623 on
ciqlts8_6
seems to be a backport of a single commita13b67c9a015c4e21601ef9aa4ec9c5d972df1b4
net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve.The same solution was used already in other "version 8" branches
centos8
,fips-8-complaint/4.18.0-553.16.1
,fips-8/4.18.0-553.16.1
,rocky8_10
,sig-cloud-8/4.18.0-553.22.1.el8_10
,sig-cloud-8/4.18.0-553.33.1.el8_10
,sig-cloud-8/4.18.0-553.36.1.el8_10
:as well as in
ciqcbr7.9
:kABI check: passed
Boot test: passed
Refer to Specific tests for implicit boot test passing.
Kselftests: passed relative
Methodology
A mix of
kernel-selftests-internal
and source-compiled tests were used:kernel-selftests-internal
:bpf
tests, except:bpf:test_kmod.sh
: takes very long time to finish and always fails anyway,bpf:test_progs
: unstable, can crash the machine,bpf:test_progs-no_alu32
: unstable, can crash the machine.Coverage (including tests skipped during execution)
android
,bpf
,breakpoints
,capabilities
,core
,cpu-hotplug
,cpufreq
,efivarfs
,exec
,filesystems
,firmware
,fpu
,ftrace
,futex
,gpio
,intel_pstate
,ipc
,kcmp
,kvm
,lib
,livepatch
,membarrier
,memfd
,memory-hotplug
,mount
,net
,net/forwarding
,net/mptcp
,netfilter
,nsfs
,proc
,pstore
,ptrace
,rseq
,rtc
,sgx
,sigaltstack
,size
,splice
,static_keys
,sync
,sysctl
,tc-testing
,timens
,timers
,tpm2
,user
,vm
,x86
,zram
Reference
ciqlts8_6
(9db5d0cdfcfd06162ee479ad4f0864ac849a646c
)Three test runs were conducted on the reference kernel.
kselftests–mixed–ciqlts8_6–run1.log
kselftests–mixed–ciqlts8_6–run2.log
kselftests–mixed–ciqlts8_6–run3.log
Patch
ciqlts8_6-CVE-2023-4623
(e8b218a20ff923b2b7eede2ea83c69d38b658f61
)Two test runs were conducted on the patched kernel.
kselftests–mixed–ciqlts8_6-CVE-2023-4623–run1.log
kselftests–mixed–ciqlts8_6-CVE-2023-4623–run2.log
Comparison
All of the tests with different results in the tested patch showed inconsistent behavior in the reference tests set itself.
The tests
bpf:test_xdp_veth.sh
,net:gro.sh
,net:ip_defrag.sh
,net:xfrm_policy.sh
were known to display inconsistent behavior before. Thenet:reuseport_addr_any.sh
test showed inconsistency before although only on theciqlts8_6-rt
platform. Added to the list of flappy tests forciqlts8_6
as well. Failure: exceeding 300 seconds timeoutSpecific tests: passed
The potential UAF condition was found to be reproducible with the following
tc
commands sequence:The "100kbps", "50kbps" parts are arbitrary. What's important is the use of
rt
for the inner class andls
for the leaf class. While the exact UAF was not obtained the commands helped confirm the efficacy of the patch.Reference
The incorrect qdisc hierarchy cannot be created - the
tc
command ends with an error and the leaf class is not added.Full logs:
fix-replicate–ciqlts8_6.log
Patch
Creating the incorrect qdisc hierarchy raises a warning, but succeeds - the leaf class is added. Notice the type of inner class being
sc
instead ofrt
as shown bytc -g class show dev lo
command.Full logs:
fix-replicate–ciqlts8_6-CVE-2023-4623.log