[LTS 9.2] smb: client: fix OOBs when building SMB2_IOCTL request #431
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 9.2]
CVE-2024-50151
VULN-8636
Problem
https://access.redhat.com/security/cve/CVE-2024-50151
Background
CIFS (Common Internet File System) is basically a different name for Microsoft's SMB (Server Message Block) protocol, allowing for sharing files and printers on the network. Functionality-wise CIFS is the same as more Linux-native NFS system. From the practical perspective, using the CIFS module boils down to mounting appropriately addressed remote "share" at a local directory (hence the "'seal' mount option" mentioned in the CVE description).
Applicability: yes
The original mainline fix is contained in 1ab6032. The affected file is
fs/smb/client/smb2pdu.c
. For the LTS 9.2 version this corresponds to thefs/cifs/smb2pdu.c
file, which was moved tofs/smb/client/
in 38c8a9a. The file is compiled into the kernel with theCONFIG_CIFS
option:kernel-src-tree/fs/cifs/Makefile
Lines 6 to 14 in e656ea9
The option is enabled in
ciqlts9_2
:The e77fe73 commit identified in 1ab6032 as introducing the bug is present in
ciqlts9_2
's history of the module (specifically the filesfs/cifs/{smb2inode.c,smb2ops.c,smb2proto.h}
). The fixing 1ab6032 commit was not backported tociqlts9_2
.Solution
An official stable release backport e07d05b to 5.15 was used to cherry-pick onto
ciqlts9_2
. It applies cleanly, unlike the mainline fix, as 5.15 uses the same CIFS module's files layout asciqlts9_2
.kABI check: passed
Boot test: passed
See Specific tests for the implied boot test passing.
Kselftests: passed relative
No selftests were found for the CIFS module. The general selftsts were run nevertheless, mainly as part of the effort to debug the kernels 9.2 and 9.4 instability issue.
Coverage
bpf
(excepttest_kmod.sh
,test_xsk.sh
,test_progs
,test_progs-no_alu32
,test_sockmap
),breakpoints
(exceptstep_after_suspend_test
),capabilities
,cgroup
(excepttest_freezer
,test_memcontrol
),clone3
,core
,cpu-hotplug
,cpufreq
,drivers/dma-buf
,drivers/net/bonding
,drivers/net/team
,filesystems/binderfs
,firmware
,fpu
,ftrace
,futex
,gpio
,intel_pstate
,ipc
,ir
,kcmp
,kexec
,kvm
,landlock
,lib
,livepatch
,membarrier
,memfd
,memory-hotplug
,mincore
,mount
,mqueue
,nci
,net/forwarding
(exceptsch_tbf_prio.sh
,mirror_gre_vlan_bridge_1q.sh
,dual_vxlan_bridge.sh
,ipip_hier_gre_keys.sh
,vxlan_bridge_1d_ipv6.sh
,sch_tbf_root.sh
,sch_tbf_ets.sh
,sch_red.sh
,tc_actions.sh
,mirror_gre_bridge_1d_vlan.sh
,tc_police.sh
,q_in_vni.sh
,sch_ets.sh
,gre_inner_v6_multipath.sh
),net/mptcp
(exceptmptcp_join.sh
,simult_flows.sh
,userspace_pm.sh
),net
(exceptxfrm_policy.sh
,reuseport_addr_any.sh
,udpgro_fwd.sh
,gro.sh
,txtimestamp.sh
,fib_nexthops.sh
,ip_defrag.sh
,udpgso_bench.sh
),netfilter
(exceptnft_trans_stress.sh
),nsfs
,openat2
,pid_namespace
,pidfd
,proc
(exceptproc-pid-vm
,proc-uptime-001
),pstore
,ptrace
,rlimits
,rseq
,seccomp
,sgx
,sigaltstack
,size
,splice
,static_keys
,syscall_user_dispatch
,tc-testing
,tdx
,timens
,timers
(exceptraw_skew
),tmpfs
,tpm2
,vDSO
,vm
,x86
,zram
Reference
kselftests–ciqlts9_2–run1.log
Patch
kselftests–ciqlts9_2-CVE-2024-50151–run2.log
kselftests–ciqlts9_2-CVE-2024-50151–run1.log
Comparison
The reference and patch results are the same.
Specific tests: passed
The 1ab6032 commit mentions a way to replicate the bug
An attempt was made to replicate the bug on
ciqlts9_2
with KASAN enabled, but it failed - no KASAN errors were obtained and the symlink creation worked fine. Perhaps it had to do with the SMB share being hosted on the very same machine where it was mounted, but setting up a "proper" samba share were dropped after a couple of unsuccesfull attempts at getting rid ofNT_STATUS_CONNECTION_REFUSED
error. The same test was repeated on the patched kernel with the same result. At the very least it shows that the CIFS module remains functional.The steps setting up encrypted samba share were as follows:
reference-replication.log
patch-replication.log