[LTS 9.4] smb: client: fix OOBs when building SMB2_IOCTL request #433
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.4]
CVE-2024-50151
VULN-8637
Problem
https://access.redhat.com/security/cve/CVE-2024-50151
Background
See "Background" section in #431.
Applicability: yes
(Situation differs slightly from #431 - the CIFS module files are already moved to
fs/smb/client/
dir inciqlts9_4
)The original mainline fix is contained in 1ab6032. The affected file is
fs/smb/client/smb2pdu.c
. It's compiled into the kernel with theCONFIG_CIFS
option:kernel-src-tree/fs/smb/client/Makefile
Lines 6 to 15 in 28a0306
The option is enabled in
ciqlts9_4
:The e77fe73 commit identified in 1ab6032 as introducing the bug is present in
ciqlts9_4
's history of the module (specifically the filesfs/cifs/{smb2inode.c,smb2ops.c,smb2proto.h}
). The fixing 1ab6032 commit was not backported tociqlts9_4
.Solution
Mainline fix 1ab6032 was cherry-picked without any modifications.
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 selftests instability issue.
Coverage
Additinal tests
bpf:test_maps
anddrivers/net/bonding:bond_macvlan.sh
where omitted (compared to the usual scope) as it turned out they mismanage memory and destabilize kernel, often causing the selftests routine to crash at random places with NULL ptr dereference or similar memory-related errors.bpf
(excepttest_kmod.sh
,get_cgroup_id_user
,test_xdp_redirect_multi.sh
,test_xdp_features.sh
,test_xdp_vlan_mode_native.sh
,test_progs
,test_xdp_veth.sh
,test_xdp_meta.sh
,test_maps
,test_bpftool_metadata.sh
,test_bpftool_build.sh
,test_lwt_ip_encap.sh
,test_lirc_mode2.sh
,test_xdp_redirect.sh
,test_tunnel.sh
,test_xsk.sh
,test_lwt_seg6local.sh
,test_xdp_vlan_mode_generic.sh
,test_skb_cgroup_id.sh
,test_xdping.sh
,test_bpftool.sh
,test_tc_tunnel.sh
,test_offload.py
,test_dev_cgroup
,test_flow_dissector.sh
,test_progs-no_alu32
,test_tcp_check_syncookie.sh
,test_sock_addr.sh
,test_progs-cpuv4
,test_tc_edt.sh
,test_sockmap
,test_doc_build.sh
),breakpoints
(exceptstep_after_suspend_test
),capabilities
,clone3
,cpu-hotplug
,cpufreq
,drivers/dma-buf
,drivers/net/bonding
(exceptbond_macvlan.sh
),drivers/net/team
,exec
,filesystems/binderfs
,filesystems/epoll
,firmware
,fpu
,ftrace
,futex
,gpio
,intel_pstate
,iommu
,ipc
,ir
,kcmp
,kexec
,kvm
,landlock
,lib
,livepatch
,membarrier
,memfd
,memory-hotplug
,mincore
,mount
,mqueue
,nci
,net/forwarding
(excepttc_police.sh
,router_bridge_1d_lag.sh
,sch_ets.sh
,sch_tbf_prio.sh
,router_bridge_lag.sh
,sch_red.sh
,sch_tbf_root.sh
,q_in_vni.sh
,dual_vxlan_bridge.sh
,vxlan_bridge_1d_ipv6.sh
,sch_tbf_ets.sh
,mirror_gre_vlan_bridge_1q.sh
,tc_actions.sh
,ip6gre_inner_v6_multipath.sh
,gre_inner_v6_multipath.sh
,ipip_hier_gre_keys.sh
,mirror_gre_bridge_1d_vlan.sh
),net/hsr
,net/mptcp
(exceptsimult_flows.sh
,userspace_pm.sh
,mptcp_join.sh
),net
(exceptudpgro_fwd.sh
,xfrm_policy.sh
,srv6_end_dt4_l3vpn_test.sh
,fib_nexthops.sh
,reuseaddr_conflict
,reuseport_addr_any.sh
,srv6_end_dt6_l3vpn_test.sh
,srv6_end_flavors_test.sh
,srv6_end_dt46_l3vpn_test.sh
,txtimestamp.sh
,gro.sh
,ip_defrag.sh
,udpgso_bench.sh
),netfilter
(exceptnft_trans_stress.sh
),nsfs
,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
,tmpfs
,tpm2
,tty
,vDSO
,x86
,zram
Reference
kselftests–ciqlts9_4–run1.log
Patch
kselftests–ciqlts9_4-CVE-2024-50151–run1.log
Comparison
The reference and patch results are the same.
Specific tests: passed
(The LTS 9.4 direct CIFS testing follows the same pattern as LTS 9.2 described in #431)
The 1ab6032 commit mentions a way to replicate the bug
An attempt was made to replicate the bug on
ciqlts9_4
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