Skip to content

[LTS 8.6] CVE-2024-26585, CVE-2024-26923, CVE-2022-50410#928

Open
pvts-mat wants to merge 6 commits intoctrliq:ciqlts8_6from
pvts-mat:ciqlts8_6-CVE-batch-23
Open

[LTS 8.6] CVE-2024-26585, CVE-2024-26923, CVE-2022-50410#928
pvts-mat wants to merge 6 commits intoctrliq:ciqlts8_6from
pvts-mat:ciqlts8_6-CVE-batch-23

Conversation

@pvts-mat
Copy link
Contributor

[LTS 8.6]

CVE-2024-26585 VULN-8185
CVE-2024-26923 VULN-8199
CVE-2022-50410 VULN-155649

Commits

CVE-2024-26585

tls: fix race between tx work scheduling and socket close

jira VULN-8185
cve CVE-2024-26585
commit-author Jakub Kicinski <kuba@kernel.org>
commit e01e3934a1b2d122919f73bc6ddbe1cdafc4bbdb
upstream-diff Resolved context conflicts, no actual diffs from the
  upstream

CVE-2024-26923

af_unix: fix lockdep positive in sk_diag_dump_icons()

jira VULN-8199
cve-pre CVE-2024-26923
commit-author Eric Dumazet <edumazet@google.com>
commit 4d322dce82a1d44f8c83f0f54f95dd1b8dcf46c9
af_unix: Fix garbage collector racing against connect()

jira VULN-8199
cve CVE-2024-26923
commit-author Michal Luczaj <mhal@rbox.co>
commit 47d8ac011fe1c9251070e1bd64cb10b48193ec51
upstream-diff Used ciqlts9_2 backport
  d5e52c38fb10be56b470e99cea62314c827c8164 for the clean cherry pick
af_unix: Suppress false-positive lockdep splat for spin_lock() in __unix_gc().

jira VULN-8199
cve-bf CVE-2024-26923
commit-author Kuniyuki Iwashima <kuniyu@amazon.com>
commit 1971d13ffa84a551d29a81fdf5b5ec5be166ac83

This CVE was solved before, for LTS 9.2, in a similar manner - see #704. In particular this comment also applies here:

The 4d322dc commit is not so much a prerequisite for the cve fix as it is for its bugfix 1971d13.

CVE-2022-50410

NFSD: Protect against send buffer overflow in NFSv2 READ

jira VULN-155649
cve CVE-2022-50410
commit-author Chuck Lever <chuck.lever@oracle.com>
commit 401bc1f90874280a80b93f23be33a0e7e2d1f912
upstream-diff The conditional before the `svc_reserve_auth()' call is
  the equivalent of `argp->count = min_t(u32, argp->count,
  NFSSVC_MAXBLKSIZE_V2);' in the mainline right after which the line in
  this commit was added
NFSD: Protect against send buffer overflow in NFSv3 READ

jira VULN-155649
cve CVE-2022-50410
commit-author Chuck Lever <chuck.lever@oracle.com>
commit fa6be9cc6e80ec79892ddf08a8c10cabab9baf38
upstream-diff LTS 8.6 version of the function `nfsd3_proc_read()'
  misses changes from 0cb4d23ae08c48f6bf3c29a8e5c4a74b8388b960,
  cc9bcdad7773c295375e66c892c7ac00524706f2 and
  be63bd2ac6bbf8c065a0ef6dfbea76934326c352. Preserved the logic of what
  is assigned to `resp->count' despite the missing changes.

Bug applicability issue

Formally none of the commits have any Fixes: tag, so it's not immediately clear whether LTS 8.6 is affected by CVE-2022-50410 or not. However, the bug is about the NFS client being able to cause the NFS server to erroneously calculate the size of the send buffer, due to the technique of preserving the amount of pages shared by both receive and send buffers, used by the server since "before the git era":

fa6be9c:

Since before the git era, NFSD has conserved the number of pages
held by each nfsd thread by combining the RPC receive and send
buffers into a single array of pages. This works because there are
no cases where an operation needs a large RPC Call message and a
large RPC Reply at the same time.

Once an RPC Call has been received, svc_process() updates
svc_rqst::rq_res to describe the part of rq_pages that can be
used for constructing the Reply. This means that the send buffer
(rq_res) shrinks when the received RPC record containing the RPC
Call is large.

The svc_process() function is basically the same in both ciqlts8_6 and kernel-mainline, in particular the construction of svc_rqst::rq_res is the same in both versions, including svc_rqst::rq_res.buflen used in the calculation of minimum.

ciqlts8_6:

rqstp->rq_res.pages = rqstp->rq_respages + 1;
rqstp->rq_res.len = 0;
rqstp->rq_res.page_base = 0;
rqstp->rq_res.page_len = 0;
rqstp->rq_res.buflen = PAGE_SIZE;
rqstp->rq_res.tail[0].iov_base = NULL;
rqstp->rq_res.tail[0].iov_len = 0;

kernel-mainline:

rqstp->rq_res.pages = rqstp->rq_respages + 1;
rqstp->rq_res.len = 0;
rqstp->rq_res.page_base = 0;
rqstp->rq_res.page_len = 0;
rqstp->rq_res.buflen = PAGE_SIZE;
rqstp->rq_res.tail[0].iov_base = NULL;
rqstp->rq_res.tail[0].iov_len = 0;

It's therefore reasonable to assume that LTS 8.6 is affected by this bug.

Untracked fix issue

These two commits address two different versions of NFS - NFSv2 and NFSv3. Note that only NFSv2 fix is officially associated with CVE-2022-50410 (see kernel lore announcement, and consequently NIST, CVE.org, kernel dance), even though the NFSv3 is no less affected. The NFSv3 fix also doesn't have any separate CVE associated. It was included in the PR nonetheless, as it's enabled in LTS 8.6 configuration

$ grep 'CONFIG_NFSD_V3\b' configs/*.config

configs/kernel-aarch64-debug.config:CONFIG_NFSD_V3=y
configs/kernel-aarch64.config:CONFIG_NFSD_V3=y
configs/kernel-ppc64le-debug.config:CONFIG_NFSD_V3=y
configs/kernel-ppc64le.config:CONFIG_NFSD_V3=y
configs/kernel-s390x-debug.config:CONFIG_NFSD_V3=y
configs/kernel-s390x-zfcpdump.config:CONFIG_NFSD_V3=y
configs/kernel-s390x.config:CONFIG_NFSD_V3=y
configs/kernel-x86_64-debug.config:CONFIG_NFSD_V3=y
configs/kernel-x86_64.config:CONFIG_NFSD_V3=y

and is probably much more often used in practice, since NFSv2 is old and even disabled on LTS 8.6 clients (note: CONFIG_NFS_* - NFS client, CONFIG_NFSD_* - NFS server; the bug applies to the server):

$ grep 'CONFIG_NFS_V2\b' configs/*.config
configs/kernel-aarch64-debug.config:# CONFIG_NFS_V2 is not set
configs/kernel-aarch64.config:# CONFIG_NFS_V2 is not set
configs/kernel-ppc64le-debug.config:# CONFIG_NFS_V2 is not set
configs/kernel-ppc64le.config:# CONFIG_NFS_V2 is not set
configs/kernel-s390x-debug.config:# CONFIG_NFS_V2 is not set
configs/kernel-s390x-zfcpdump.config:# CONFIG_NFS_V2 is not set
configs/kernel-s390x.config:# CONFIG_NFS_V2 is not set
configs/kernel-x86_64-debug.config:# CONFIG_NFS_V2 is not set
configs/kernel-x86_64.config:# CONFIG_NFS_V2 is not set
$ grep 'CONFIG_NFS_V3\b' configs/*.config
configs/kernel-aarch64-debug.config:CONFIG_NFS_V3=m
configs/kernel-aarch64.config:CONFIG_NFS_V3=m
configs/kernel-ppc64le-debug.config:CONFIG_NFS_V3=m
configs/kernel-ppc64le.config:CONFIG_NFS_V3=m
configs/kernel-s390x-debug.config:CONFIG_NFS_V3=m
configs/kernel-s390x-zfcpdump.config:CONFIG_NFS_V3=m
configs/kernel-s390x.config:CONFIG_NFS_V3=m
configs/kernel-x86_64-debug.config:CONFIG_NFS_V3=m
configs/kernel-x86_64.config:CONFIG_NFS_V3=m

Backporting adaptation

The affected functions nfsd_proc_read() (NFSv2) and nfsd3_proc_read() (NFSv3) in LTS 8.6 differ considerably from the upstream version, so there were no clean cherry picks and also the conflicts resolution was not merely contextual.

  1. NFSv2

    Notice that - as far as the value of argp->count is concerned - the end result of executing this branch in ciqlts8_6

    if (NFSSVC_MAXBLKSIZE_V2 < argp->count) {
    char buf[RPC_MAX_ADDRBUFLEN];
    printk(KERN_NOTICE
    "oversized read request from %s (%d bytes)\n",
    svc_print_addr(rqstp, buf, sizeof(buf)),
    argp->count);
    argp->count = NFSSVC_MAXBLKSIZE_V2;
    }

    is equivalent to taking the minimum of argp->count and NFSSVC_MAXBLKSIZE_V2 and assigning it to argp->count, just as it was done in the upstream

    argp->count = min_t(u32, argp->count, NFSSVC_MAXBLKSIZE_V2);

    Right after this branch is therefore a proper place to put the trimming of argp->count with rqstp->rq_res.buflen, before any other use of this field.

  2. NFSv3

    Most of the changes in the upstream fix fa6be9c are functionally neutral, simply inlining the value of max_blocksize variable. The only relevant change is the addition of this line:

    argp->count = min_t(u32, argp->count, rqstp->rq_res.buflen);
    

    The inlining of max_blocksize was omitted in the LTS 8.6 backport to reduce unnecessary manual interference with the codebase. The trimming with rqstp->rq_res.buflen value was done with

    cnt = min(cnt, (unsigned long)rqstp->rq_res.buflen);
    
    1. Unlike in the upstream, the LTS 8.6 version of nfsd_proc_read3() doesn't ever modify the argp->count field, setting the proper value of resp->count with the use of additional variable cnt:
      resp->count = cnt;
    2. Macro min was used instead of min_t to align with the use of min in this function..
    3. The cast to unsigned long of rqstp->rq_res.buflen was used to unify the types of min operands (the code doesn't compile otherwise) and to align the type of right handsight of the assign operator with the left handsight. The type of rqstp->rq_res.buflen is unsigned int so no information is lost in casting - see
      unsigned int buflen, /* Total length of storage buffer */

kABI check: passed

[0/1] kabi_check_kernel	Check ABI of kernel [ciqlts8_6-CVE-batch-23]	_kabi_check_kernel__x86_64--test--ciqlts8_6-CVE-batch-23
++ uname -m
+ python3 /data/src/ctrliq-github-haskell/kernel-dist-git-el-8.6/SOURCES/check-kabi -k /data/src/ctrliq-github-haskell/kernel-dist-git-el-8.6/SOURCES/Module.kabi_x86_64 -s vms/x86_64--build--ciqlts8_6/build_files/kernel-src-tree-ciqlts8_6-CVE-batch-23/Module.symvers
kABI check passed
+ touch state/kernels/ciqlts8_6-CVE-batch-23/x86_64/kabi_checked

Boot test: passed

boot-test.log

Kselftests: passed relative

Reference

kselftests–ciqlts8_6–run1.log
kselftests–ciqlts8_6–run2.log

Patch

kselftests–ciqlts8_6-CVE-batch-23–run1.log
kselftests–ciqlts8_6-CVE-batch-23–run2.log

Comparison

The tests results for the reference and the patch are the same.

$ ktests.xsh diff  kselftests*.log

Column    File
--------  --------------------------------------------
Status0   kselftests--ciqlts8_6--run1.log
Status1   kselftests--ciqlts8_6--run2.log
Status2   kselftests--ciqlts8_6-CVE-batch-23--run1.log
Status3   kselftests--ciqlts8_6-CVE-batch-23--run2.log

TestCase                                     Status0  Status1  Status2  Status3  Summary
android:run.sh                               skip     skip     skip     skip     same
bpf:get_cgroup_id_user                       pass     pass     pass     pass     same
bpf:test_bpftool.sh                          pass     pass     pass     pass     same
bpf:test_bpftool_build.sh                    pass     pass     pass     pass     same
bpf:test_bpftool_metadata.sh                 pass     pass     pass     pass     same
bpf:test_cgroup_storage                      pass     pass     pass     pass     same
bpf:test_dev_cgroup                          pass     pass     pass     pass     same
bpf:test_doc_build.sh                        pass     pass     pass     pass     same
bpf:test_flow_dissector.sh                   pass     pass     pass     pass     same
bpf:test_lirc_mode2.sh                       pass     pass     pass     pass     same
bpf:test_lpm_map                             pass     pass     pass     pass     same
bpf:test_lru_map                             pass     pass     pass     pass     same
bpf:test_lwt_ip_encap.sh                     pass     pass     pass     pass     same
bpf:test_lwt_seg6local.sh                    pass     pass     pass     pass     same
bpf:test_netcnt                              pass     pass     pass     pass     same
bpf:test_offload.py                          fail     fail     fail     fail     same
bpf:test_skb_cgroup_id.sh                    pass     pass     pass     pass     same
bpf:test_sock                                pass     pass     pass     pass     same
bpf:test_sock_addr.sh                        pass     pass     pass     pass     same
bpf:test_sysctl                              pass     pass     pass     pass     same
bpf:test_tag                                 pass     pass     pass     pass     same
bpf:test_tc_edt.sh                           pass     pass     pass     pass     same
bpf:test_tc_tunnel.sh                        pass     pass     pass     pass     same
bpf:test_tcp_check_syncookie.sh              pass     pass     pass     pass     same
bpf:test_tcpnotify_user                      pass     pass     pass     pass     same
bpf:test_tunnel.sh                           pass     pass     pass     pass     same
bpf:test_verifier                            pass     pass     pass     pass     same
bpf:test_verifier_log                        pass     pass     pass     pass     same
bpf:test_xdp_meta.sh                         pass     pass     pass     pass     same
bpf:test_xdp_redirect.sh                     pass     pass     pass     pass     same
bpf:test_xdp_veth.sh                         pass     pass     pass     pass     same
bpf:test_xdp_vlan_mode_generic.sh            pass     pass     pass     pass     same
bpf:test_xdp_vlan_mode_native.sh             pass     pass     pass     pass     same
bpf:test_xdping.sh                           pass     pass     pass     pass     same
bpf:urandom_read                             pass     pass     pass     pass     same
breakpoints:breakpoint_test                  pass     pass     pass     pass     same
capabilities:test_execve                     pass     pass     pass     pass     same
core:close_range_test                        pass     pass     pass     pass     same
cpu-hotplug:cpu-on-off-test.sh               pass     pass     pass     pass     same
cpufreq:main.sh                              fail     fail     fail     fail     same
exec:execveat                                pass     pass     pass     pass     same
firmware:fw_run_tests.sh                     skip     skip     skip     skip     same
fpu:run_test_fpu.sh                          skip     skip     skip     skip     same
fpu:test_fpu                                 pass     pass     pass     pass     same
ftrace:ftracetest                            fail     fail     fail     fail     same
futex:run.sh                                 pass     pass     pass     pass     same
gpio:gpio-mockup.sh                          fail     fail     fail     fail     same
intel_pstate:run.sh                          pass     pass     pass     pass     same
ipc:msgque                                   pass     pass     pass     pass     same
kcmp:kcmp_test                               pass     pass     pass     pass     same
kexec:test_kexec_file_load.sh                skip     skip     skip     skip     same
kexec:test_kexec_load.sh                     skip     skip     skip     skip     same
kvm:access_tracking_perf_test                fail     fail     fail     fail     same
kvm:amx_test                                 fail     fail     fail     fail     same
kvm:cr4_cpuid_sync_test                      fail     fail     fail     fail     same
kvm:debug_regs                               fail     fail     fail     fail     same
kvm:demand_paging_test                       pass     pass     pass     pass     same
kvm:dirty_log_perf_test                      pass     pass     pass     pass     same
kvm:dirty_log_test                           fail     fail     fail     fail     same
kvm:emulator_error_test                      fail     fail     fail     fail     same
kvm:evmcs_test                               fail     fail     fail     fail     same
kvm:get_cpuid_test                           fail     fail     fail     fail     same
kvm:get_msr_index_features                   fail     fail     fail     fail     same
kvm:hardware_disable_test                    pass     pass     pass     pass     same
kvm:hyperv_clock                             fail     fail     fail     fail     same
kvm:hyperv_cpuid                             fail     fail     fail     fail     same
kvm:hyperv_features                          fail     fail     fail     fail     same
kvm:kvm_binary_stats_test                    pass     pass     pass     pass     same
kvm:kvm_create_max_vcpus                     skip     skip     skip     skip     same
kvm:kvm_page_table_test                      pass     pass     pass     pass     same
kvm:kvm_pv_test                              fail     fail     fail     fail     same
kvm:memslot_modification_stress_test         pass     pass     pass     pass     same
kvm:memslot_perf_test                        fail     fail     fail     fail     same
kvm:mmio_warning_test                        fail     fail     fail     fail     same
kvm:mmu_role_test                            fail     fail     fail     fail     same
kvm:platform_info_test                       fail     fail     fail     fail     same
kvm:rseq_test                                fail     fail     fail     fail     same
kvm:set_boot_cpu_id                          fail     fail     fail     fail     same
kvm:set_memory_region_test                   pass     pass     pass     pass     same
kvm:set_sregs_test                           fail     fail     fail     fail     same
kvm:smm_test                                 fail     fail     fail     fail     same
kvm:state_test                               fail     fail     fail     fail     same
kvm:steal_time                               pass     pass     pass     pass     same
kvm:svm_int_ctl_test                         fail     fail     fail     fail     same
kvm:svm_vmcall_test                          fail     fail     fail     fail     same
kvm:sync_regs_test                           fail     fail     fail     fail     same
kvm:tsc_msrs_test                            fail     fail     fail     fail     same
kvm:userspace_msr_exit_test                  fail     fail     fail     fail     same
kvm:vmx_apic_access_test                     fail     fail     fail     fail     same
kvm:vmx_close_while_nested_test              fail     fail     fail     fail     same
kvm:vmx_dirty_log_test                       fail     fail     fail     fail     same
kvm:vmx_nested_tsc_scaling_test              fail     fail     fail     fail     same
kvm:vmx_pmu_msrs_test                        fail     fail     fail     fail     same
kvm:vmx_preemption_timer_test                fail     fail     fail     fail     same
kvm:vmx_set_nested_state_test                fail     fail     fail     fail     same
kvm:vmx_tsc_adjust_test                      fail     fail     fail     fail     same
kvm:xapic_ipi_test                           fail     fail     fail     fail     same
kvm:xen_shinfo_test                          fail     fail     fail     fail     same
kvm:xen_vmcall_test                          fail     fail     fail     fail     same
kvm:xss_msr_test                             fail     fail     fail     fail     same
lib:bitmap.sh                                skip     skip     skip     skip     same
lib:prime_numbers.sh                         skip     skip     skip     skip     same
lib:printf.sh                                skip     skip     skip     skip     same
lib:scanf.sh                                 fail     fail     fail     fail     same
livepatch:test-callbacks.sh                  pass     pass     pass     pass     same
livepatch:test-ftrace.sh                     pass     pass     pass     pass     same
livepatch:test-livepatch.sh                  pass     pass     pass     pass     same
livepatch:test-shadow-vars.sh                pass     pass     pass     pass     same
livepatch:test-state.sh                      pass     pass     pass     pass     same
membarrier:membarrier_test_multi_thread      pass     pass     pass     pass     same
membarrier:membarrier_test_single_thread     pass     pass     pass     pass     same
memfd:memfd_test                             pass     pass     pass     pass     same
memfd:run_fuse_test.sh                       fail     fail     fail     fail     same
memfd:run_hugetlbfs_test.sh                  pass     pass     pass     pass     same
memory-hotplug:mem-on-off-test.sh            pass     pass     pass     pass     same
mount:run_tests.sh                           pass     pass     pass     pass     same
net/forwarding:bridge_port_isolation.sh      pass     pass     pass     pass     same
net/forwarding:bridge_sticky_fdb.sh          pass     pass     pass     pass     same
net/forwarding:bridge_vlan_aware.sh          fail     fail     fail     fail     same
net/forwarding:bridge_vlan_unaware.sh        pass     pass     pass     pass     same
net/forwarding:ethtool.sh                    fail     fail     fail     fail     same
net/forwarding:gre_multipath.sh              fail     fail     fail     fail     same
net/forwarding:ip6_forward_instats_vrf.sh    fail     fail     fail     fail     same
net/forwarding:ipip_flat_gre.sh              pass     pass     pass     pass     same
net/forwarding:ipip_flat_gre_key.sh          pass     pass     pass     pass     same
net/forwarding:ipip_flat_gre_keys.sh         pass     pass     pass     pass     same
net/forwarding:ipip_hier_gre.sh              pass     pass     pass     pass     same
net/forwarding:ipip_hier_gre_key.sh          pass     pass     pass     pass     same
net/forwarding:loopback.sh                   skip     skip     skip     skip     same
net/forwarding:mirror_gre.sh                 fail     fail     fail     fail     same
net/forwarding:mirror_gre_bound.sh           pass     pass     pass     pass     same
net/forwarding:mirror_gre_bridge_1d.sh       pass     pass     pass     pass     same
net/forwarding:mirror_gre_bridge_1q.sh       pass     pass     pass     pass     same
net/forwarding:mirror_gre_bridge_1q_lag.sh   pass     pass     pass     pass     same
net/forwarding:mirror_gre_changes.sh         fail     fail     fail     fail     same
net/forwarding:mirror_gre_flower.sh          fail     fail     fail     fail     same
net/forwarding:mirror_gre_lag_lacp.sh        pass     pass     pass     pass     same
net/forwarding:mirror_gre_neigh.sh           pass     pass     pass     pass     same
net/forwarding:mirror_gre_nh.sh              pass     pass     pass     pass     same
net/forwarding:mirror_gre_vlan.sh            pass     pass     pass     pass     same
net/forwarding:mirror_vlan.sh                pass     pass     pass     pass     same
net/forwarding:router.sh                     fail     fail     fail     fail     same
net/forwarding:router_bridge.sh              pass     pass     pass     pass     same
net/forwarding:router_bridge_vlan.sh         pass     pass     pass     pass     same
net/forwarding:router_broadcast.sh           fail     fail     fail     fail     same
net/forwarding:router_multicast.sh           fail     fail     fail     fail     same
net/forwarding:router_multipath.sh           fail     fail     fail     fail     same
net/forwarding:router_vid_1.sh               pass     pass     pass     pass     same
net/forwarding:tc_chains.sh                  pass     pass     pass     pass     same
net/forwarding:tc_flower.sh                  pass     pass     pass     pass     same
net/forwarding:tc_flower_router.sh           pass     pass     pass     pass     same
net/forwarding:tc_mpls_l2vpn.sh              pass     pass     pass     pass     same
net/forwarding:tc_shblocks.sh                pass     pass     pass     pass     same
net/forwarding:tc_vlan_modify.sh             pass     pass     pass     pass     same
net/forwarding:vxlan_asymmetric.sh           pass     pass     pass     pass     same
net/forwarding:vxlan_bridge_1d.sh            fail     fail     fail     fail     same
net/forwarding:vxlan_bridge_1d_port_8472.sh  pass     pass     pass     pass     same
net/forwarding:vxlan_bridge_1q.sh            fail     fail     fail     fail     same
net/forwarding:vxlan_bridge_1q_port_8472.sh  pass     pass     pass     pass     same
net/forwarding:vxlan_symmetric.sh            pass     pass     pass     pass     same
net/mptcp:diag.sh                            pass     pass     pass     pass     same
net/mptcp:mptcp_connect.sh                   pass     pass     pass     pass     same
net/mptcp:mptcp_sockopt.sh                   pass     pass     pass     pass     same
net/mptcp:pm_netlink.sh                      pass     pass     pass     pass     same
net:bareudp.sh                               pass     pass     pass     pass     same
net:devlink_port_split.py                    pass     pass     pass     pass     same
net:drop_monitor_tests.sh                    skip     skip     skip     skip     same
net:fcnal-test.sh                            pass     pass     pass     pass     same
net:fib-onlink-tests.sh                      pass     pass     pass     pass     same
net:fib_rule_tests.sh                        fail     fail     fail     fail     same
net:fib_tests.sh                             pass     pass     pass     pass     same
net:gre_gso.sh                               pass     pass     pass     pass     same
net:icmp_redirect.sh                         pass     pass     pass     pass     same
net:ip6_gre_headroom.sh                      pass     pass     pass     pass     same
net:ipv6_flowlabel.sh                        pass     pass     pass     pass     same
net:l2tp.sh                                  pass     pass     pass     pass     same
net:msg_zerocopy.sh                          fail     fail     fail     fail     same
net:netdevice.sh                             pass     pass     pass     pass     same
net:pmtu.sh                                  pass     pass     pass     pass     same
net:psock_snd.sh                             fail     fail     fail     fail     same
net:reuseaddr_conflict                       pass     pass     pass     pass     same
net:reuseport_bpf                            pass     pass     pass     pass     same
net:reuseport_bpf_cpu                        pass     pass     pass     pass     same
net:reuseport_bpf_numa                       pass     pass     pass     pass     same
net:reuseport_dualstack                      pass     pass     pass     pass     same
net:rtnetlink.sh                             skip     skip     skip     skip     same
net:run_afpackettests                        pass     pass     pass     pass     same
net:run_netsocktests                         pass     pass     pass     pass     same
net:rxtimestamp.sh                           pass     pass     pass     pass     same
net:so_txtime.sh                             fail     fail     fail     fail     same
net:test_bpf.sh                              pass     pass     pass     pass     same
net:test_vxlan_fdb_changelink.sh             pass     pass     pass     pass     same
net:tls                                      pass     pass     pass     pass     same
net:traceroute.sh                            pass     pass     pass     pass     same
net:udpgro.sh                                fail     fail     fail     fail     same
net:udpgro_bench.sh                          fail     fail     fail     fail     same
net:udpgso.sh                                pass     pass     pass     pass     same
net:veth.sh                                  fail     fail     fail     fail     same
net:vrf-xfrm-tests.sh                        pass     pass     pass     pass     same
netfilter:conntrack_icmp_related.sh          fail     fail     fail     fail     same
netfilter:conntrack_tcp_unreplied.sh         fail     fail     fail     fail     same
netfilter:ipvs.sh                            skip     skip     skip     skip     same
netfilter:nft_flowtable.sh                   fail     fail     fail     fail     same
netfilter:nft_meta.sh                        pass     pass     pass     pass     same
netfilter:nft_nat.sh                         skip     skip     skip     skip     same
netfilter:nft_queue.sh                       skip     skip     skip     skip     same
nsfs:owner                                   pass     pass     pass     pass     same
nsfs:pidns                                   pass     pass     pass     pass     same
proc:fd-001-lookup                           pass     pass     pass     pass     same
proc:fd-002-posix-eq                         pass     pass     pass     pass     same
proc:fd-003-kthread                          pass     pass     pass     pass     same
proc:proc-loadavg-001                        pass     pass     pass     pass     same
proc:proc-self-map-files-001                 pass     pass     pass     pass     same
proc:proc-self-map-files-002                 fail     fail     fail     fail     same
proc:proc-self-syscall                       pass     pass     pass     pass     same
proc:proc-self-wchan                         pass     pass     pass     pass     same
proc:proc-uptime-001                         pass     pass     pass     pass     same
proc:proc-uptime-002                         pass     pass     pass     pass     same
proc:read                                    pass     pass     pass     pass     same
proc:setns-dcache                            fail     fail     fail     fail     same
pstore:pstore_post_reboot_tests              skip     skip     skip     skip     same
pstore:pstore_tests                          fail     fail     fail     fail     same
ptrace:peeksiginfo                           pass     pass     pass     pass     same
ptrace:vmaccess                              fail     fail     fail     fail     same
rseq:basic_percpu_ops_test                   pass     pass     pass     pass     same
rseq:basic_test                              pass     pass     pass     pass     same
rseq:param_test                              pass     pass     pass     pass     same
rseq:param_test_benchmark                    pass     pass     pass     pass     same
rseq:param_test_compare_twice                pass     pass     pass     pass     same
rseq:run_param_test.sh                       fail     fail     fail     fail     same
sgx:test_sgx                                 fail     fail     fail     fail     same
sigaltstack:sas                              pass     pass     pass     pass     same
size:get_size                                pass     pass     pass     pass     same
splice:default_file_splice_read.sh           pass     pass     pass     pass     same
static_keys:test_static_keys.sh              skip     skip     skip     skip     same
tc-testing:tdc.sh                            pass     pass     pass     pass     same
timens:clock_nanosleep                       pass     pass     pass     pass     same
timens:exec                                  pass     pass     pass     pass     same
timens:procfs                                pass     pass     pass     pass     same
timens:timens                                pass     pass     pass     pass     same
timens:timer                                 pass     pass     pass     pass     same
timens:timerfd                               pass     pass     pass     pass     same
timers:inconsistency-check                   fail     fail     fail     fail     same
timers:mqueue-lat                            pass     pass     pass     pass     same
timers:nanosleep                             pass     pass     pass     pass     same
timers:nsleep-lat                            fail     fail     fail     fail     same
timers:posix_timers                          pass     pass     pass     pass     same
timers:rtcpie                                pass     pass     pass     pass     same
timers:set-timer-lat                         fail     fail     fail     fail     same
timers:threadtest                            pass     pass     pass     pass     same
tpm2:test_smoke.sh                           fail     fail     fail     fail     same
tpm2:test_space.sh                           fail     fail     fail     fail     same
vm:run_vmtests                               fail     fail     fail     fail     same
x86:amx_64                                   fail     fail     fail     fail     same
x86:check_initial_reg_state_64               pass     pass     pass     pass     same
x86:corrupt_xstate_header_64                 pass     pass     pass     pass     same
x86:fsgsbase_64                              pass     pass     pass     pass     same
x86:fsgsbase_restore_64                      pass     pass     pass     pass     same
x86:ioperm_64                                pass     pass     pass     pass     same
x86:iopl_64                                  pass     pass     pass     pass     same
x86:mov_ss_trap_64                           pass     pass     pass     pass     same
x86:mpx-mini-test_64                         fail     fail     fail     fail     same
x86:protection_keys_64                       pass     pass     pass     pass     same
x86:sigaltstack_64                           pass     pass     pass     pass     same
x86:sigreturn_64                             pass     pass     pass     pass     same
x86:single_step_syscall_64                   pass     pass     pass     pass     same
x86:syscall_nt_64                            pass     pass     pass     pass     same
x86:sysret_rip_64                            pass     pass     pass     pass     same
x86:sysret_ss_attrs_64                       pass     pass     pass     pass     same
x86:test_mremap_vdso_64                      pass     pass     pass     pass     same
x86:test_vdso_64                             pass     pass     pass     pass     same
x86:test_vsyscall_64                         pass     pass     pass     pass     same
zram:zram.sh                                 pass     pass     pass     pass     same

jira VULN-8185
cve CVE-2024-26585
commit-author Jakub Kicinski <kuba@kernel.org>
commit e01e393
upstream-diff Resolved context conflicts, no actual diffs from the
  upstream

Similarly to previous commit, the submitting thread (recvmsg/sendmsg)
may exit as soon as the async crypto handler calls complete().
Reorder scheduling the work before calling complete().
This seems more logical in the first place, as it's
the inverse order of what the submitting thread will do.

	Reported-by: valis <sec@valis.email>
Fixes: a42055e ("net/tls: Add support for async encryption of records for performance")
	Signed-off-by: Jakub Kicinski <kuba@kernel.org>
	Reviewed-by: Simon Horman <horms@kernel.org>
	Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
	Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e01e393)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
jira VULN-8199
cve-pre CVE-2024-26923
commit-author Eric Dumazet <edumazet@google.com>
commit 4d322dc

syzbot reported a lockdep splat [1].

Blamed commit hinted about the possible lockdep
violation, and code used unix_state_lock_nested()
in an attempt to silence lockdep.

It is not sufficient, because unix_state_lock_nested()
is already used from unix_state_double_lock().

We need to use a separate subclass.

This patch adds a distinct enumeration to make things
more explicit.

Also use swap() in unix_state_double_lock() as a clean up.

v2: add a missing inline keyword to unix_state_lock_nested()

[1]
WARNING: possible circular locking dependency detected
6.8.0-rc1-syzkaller-00356-g8a696a29c690 #0 Not tainted

syz-executor.1/2542 is trying to acquire lock:
 ffff88808b5df9e8 (rlock-AF_UNIX){+.+.}-{2:2}, at: skb_queue_tail+0x36/0x120 net/core/skbuff.c:3863

but task is already holding lock:
 ffff88808b5dfe70 (&u->lock/1){+.+.}-{2:2}, at: unix_dgram_sendmsg+0xfc7/0x2200 net/unix/af_unix.c:2089

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> ctrliq#1 (&u->lock/1){+.+.}-{2:2}:
        lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
        _raw_spin_lock_nested+0x31/0x40 kernel/locking/spinlock.c:378
        sk_diag_dump_icons net/unix/diag.c:87 [inline]
        sk_diag_fill+0x6ea/0xfe0 net/unix/diag.c:157
        sk_diag_dump net/unix/diag.c:196 [inline]
        unix_diag_dump+0x3e9/0x630 net/unix/diag.c:220
        netlink_dump+0x5c1/0xcd0 net/netlink/af_netlink.c:2264
        __netlink_dump_start+0x5d7/0x780 net/netlink/af_netlink.c:2370
        netlink_dump_start include/linux/netlink.h:338 [inline]
        unix_diag_handler_dump+0x1c3/0x8f0 net/unix/diag.c:319
       sock_diag_rcv_msg+0xe3/0x400
        netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2543
        sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:280
        netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
        netlink_unicast+0x7e6/0x980 net/netlink/af_netlink.c:1367
        netlink_sendmsg+0xa37/0xd70 net/netlink/af_netlink.c:1908
        sock_sendmsg_nosec net/socket.c:730 [inline]
        __sock_sendmsg net/socket.c:745 [inline]
        sock_write_iter+0x39a/0x520 net/socket.c:1160
        call_write_iter include/linux/fs.h:2085 [inline]
        new_sync_write fs/read_write.c:497 [inline]
        vfs_write+0xa74/0xca0 fs/read_write.c:590
        ksys_write+0x1a0/0x2c0 fs/read_write.c:643
        do_syscall_x64 arch/x86/entry/common.c:52 [inline]
        do_syscall_64+0xf5/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b

-> #0 (rlock-AF_UNIX){+.+.}-{2:2}:
        check_prev_add kernel/locking/lockdep.c:3134 [inline]
        check_prevs_add kernel/locking/lockdep.c:3253 [inline]
        validate_chain+0x1909/0x5ab0 kernel/locking/lockdep.c:3869
        __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137
        lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
        __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
        _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
        skb_queue_tail+0x36/0x120 net/core/skbuff.c:3863
        unix_dgram_sendmsg+0x15d9/0x2200 net/unix/af_unix.c:2112
        sock_sendmsg_nosec net/socket.c:730 [inline]
        __sock_sendmsg net/socket.c:745 [inline]
        ____sys_sendmsg+0x592/0x890 net/socket.c:2584
        ___sys_sendmsg net/socket.c:2638 [inline]
        __sys_sendmmsg+0x3b2/0x730 net/socket.c:2724
        __do_sys_sendmmsg net/socket.c:2753 [inline]
        __se_sys_sendmmsg net/socket.c:2750 [inline]
        __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2750
        do_syscall_x64 arch/x86/entry/common.c:52 [inline]
        do_syscall_64+0xf5/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&u->lock/1);
                               lock(rlock-AF_UNIX);
                               lock(&u->lock/1);
  lock(rlock-AF_UNIX);

 *** DEADLOCK ***

1 lock held by syz-executor.1/2542:
  #0: ffff88808b5dfe70 (&u->lock/1){+.+.}-{2:2}, at: unix_dgram_sendmsg+0xfc7/0x2200 net/unix/af_unix.c:2089

stack backtrace:
CPU: 1 PID: 2542 Comm: syz-executor.1 Not tainted 6.8.0-rc1-syzkaller-00356-g8a696a29c690 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
 <TASK>
  __dump_stack lib/dump_stack.c:88 [inline]
  dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
  check_noncircular+0x366/0x490 kernel/locking/lockdep.c:2187
  check_prev_add kernel/locking/lockdep.c:3134 [inline]
  check_prevs_add kernel/locking/lockdep.c:3253 [inline]
  validate_chain+0x1909/0x5ab0 kernel/locking/lockdep.c:3869
  __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137
  lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
  __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
  _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
  skb_queue_tail+0x36/0x120 net/core/skbuff.c:3863
  unix_dgram_sendmsg+0x15d9/0x2200 net/unix/af_unix.c:2112
  sock_sendmsg_nosec net/socket.c:730 [inline]
  __sock_sendmsg net/socket.c:745 [inline]
  ____sys_sendmsg+0x592/0x890 net/socket.c:2584
  ___sys_sendmsg net/socket.c:2638 [inline]
  __sys_sendmmsg+0x3b2/0x730 net/socket.c:2724
  __do_sys_sendmmsg net/socket.c:2753 [inline]
  __se_sys_sendmmsg net/socket.c:2750 [inline]
  __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2750
  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
  do_syscall_64+0xf5/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f26d887cda9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f26d95a60c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007f26d89abf80 RCX: 00007f26d887cda9
RDX: 000000000000003e RSI: 00000000200bd000 RDI: 0000000000000004
RBP: 00007f26d88c947a R08: 0000000000000000 R09: 0000000000000000
R10: 00000000000008c0 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f26d89abf80 R15: 00007ffcfe081a68

Fixes: 2aac7a2 ("unix_diag: Pending connections IDs NLA")
	Reported-by: syzbot <syzkaller@googlegroups.com>
	Signed-off-by: Eric Dumazet <edumazet@google.com>
	Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20240130184235.1620738-1-edumazet@google.com
	Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 4d322dc)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
jira VULN-8199
cve CVE-2024-26923
commit-author Michal Luczaj <mhal@rbox.co>
commit 47d8ac0
upstream-diff Used ciqlts9_2 backport
  d5e52c3 for the clean cherry pick

Garbage collector does not take into account the risk of embryo getting
enqueued during the garbage collection. If such embryo has a peer that
carries SCM_RIGHTS, two consecutive passes of scan_children() may see a
different set of children. Leading to an incorrectly elevated inflight
count, and then a dangling pointer within the gc_inflight_list.

sockets are AF_UNIX/SOCK_STREAM
S is an unconnected socket
L is a listening in-flight socket bound to addr, not in fdtable
V's fd will be passed via sendmsg(), gets inflight count bumped

connect(S, addr)	sendmsg(S, [V]); close(V)	__unix_gc()
----------------	-------------------------	-----------

NS = unix_create1()
skb1 = sock_wmalloc(NS)
L = unix_find_other(addr)
unix_state_lock(L)
unix_peer(S) = NS
			// V count=1 inflight=0

 			NS = unix_peer(S)
 			skb2 = sock_alloc()
			skb_queue_tail(NS, skb2[V])

			// V became in-flight
			// V count=2 inflight=1

			close(V)

			// V count=1 inflight=1
			// GC candidate condition met

						for u in gc_inflight_list:
						  if (total_refs == inflight_refs)
						    add u to gc_candidates

						// gc_candidates={L, V}

						for u in gc_candidates:
						  scan_children(u, dec_inflight)

						// embryo (skb1) was not
						// reachable from L yet, so V's
						// inflight remains unchanged
__skb_queue_tail(L, skb1)
unix_state_unlock(L)
						for u in gc_candidates:
						  if (u.inflight)
						    scan_children(u, inc_inflight_move_tail)

						// V count=1 inflight=2 (!)

If there is a GC-candidate listening socket, lock/unlock its state. This
makes GC wait until the end of any ongoing connect() to that socket. After
flipping the lock, a possibly SCM-laden embryo is already enqueued. And if
there is another embryo coming, it can not possibly carry SCM_RIGHTS. At
this point, unix_inflight() can not happen because unix_gc_lock is already
taken. Inflight graph remains unaffected.

Fixes: 1fd05ba ("[AF_UNIX]: Rewrite garbage collector, fixes race.")
	Signed-off-by: Michal Luczaj <mhal@rbox.co>
	Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20240409201047.1032217-1-mhal@rbox.co
	Signed-off-by: Paolo Abeni <pabeni@redhat.com>
(cherry picked from commit d5e52c3)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
…nix_gc().

jira VULN-8199
cve-bf CVE-2024-26923
commit-author Kuniyuki Iwashima <kuniyu@amazon.com>
commit 1971d13

syzbot reported a lockdep splat regarding unix_gc_lock and
unix_state_lock().

One is called from recvmsg() for a connected socket, and another
is called from GC for TCP_LISTEN socket.

So, the splat is false-positive.

Let's add a dedicated lock class for the latter to suppress the splat.

Note that this change is not necessary for net-next.git as the issue
is only applied to the old GC impl.

[0]:
WARNING: possible circular locking dependency detected
6.9.0-rc5-syzkaller-00007-g4d2008430ce8 #0 Not tainted
 -----------------------------------------------------
kworker/u8:1/11 is trying to acquire lock:
ffff88807cea4e70 (&u->lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffff88807cea4e70 (&u->lock){+.+.}-{2:2}, at: __unix_gc+0x40e/0xf70 net/unix/garbage.c:302

but task is already holding lock:
ffffffff8f6ab638 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffffffff8f6ab638 (unix_gc_lock){+.+.}-{2:2}, at: __unix_gc+0x117/0xf70 net/unix/garbage.c:261

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

 -> ctrliq#1 (unix_gc_lock){+.+.}-{2:2}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
       _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
       spin_lock include/linux/spinlock.h:351 [inline]
       unix_notinflight+0x13d/0x390 net/unix/garbage.c:140
       unix_detach_fds net/unix/af_unix.c:1819 [inline]
       unix_destruct_scm+0x221/0x350 net/unix/af_unix.c:1876
       skb_release_head_state+0x100/0x250 net/core/skbuff.c:1188
       skb_release_all net/core/skbuff.c:1200 [inline]
       __kfree_skb net/core/skbuff.c:1216 [inline]
       kfree_skb_reason+0x16d/0x3b0 net/core/skbuff.c:1252
       kfree_skb include/linux/skbuff.h:1262 [inline]
       manage_oob net/unix/af_unix.c:2672 [inline]
       unix_stream_read_generic+0x1125/0x2700 net/unix/af_unix.c:2749
       unix_stream_splice_read+0x239/0x320 net/unix/af_unix.c:2981
       do_splice_read fs/splice.c:985 [inline]
       splice_file_to_pipe+0x299/0x500 fs/splice.c:1295
       do_splice+0xf2d/0x1880 fs/splice.c:1379
       __do_splice fs/splice.c:1436 [inline]
       __do_sys_splice fs/splice.c:1652 [inline]
       __se_sys_splice+0x331/0x4a0 fs/splice.c:1634
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

 -> #0 (&u->lock){+.+.}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
       __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
       _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
       spin_lock include/linux/spinlock.h:351 [inline]
       __unix_gc+0x40e/0xf70 net/unix/garbage.c:302
       process_one_work kernel/workqueue.c:3254 [inline]
       process_scheduled_works+0xa10/0x17c0 kernel/workqueue.c:3335
       worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
       kthread+0x2f0/0x390 kernel/kthread.c:388
       ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(unix_gc_lock);
                               lock(&u->lock);
                               lock(unix_gc_lock);
  lock(&u->lock);

 *** DEADLOCK ***

3 locks held by kworker/u8:1/11:
 #0: ffff888015089148 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3229 [inline]
 #0: ffff888015089148 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_scheduled_works+0x8e0/0x17c0 kernel/workqueue.c:3335
 ctrliq#1: ffffc90000107d00 (unix_gc_work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3230 [inline]
 ctrliq#1: ffffc90000107d00 (unix_gc_work){+.+.}-{0:0}, at: process_scheduled_works+0x91b/0x17c0 kernel/workqueue.c:3335
 ctrliq#2: ffffffff8f6ab638 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
 ctrliq#2: ffffffff8f6ab638 (unix_gc_lock){+.+.}-{2:2}, at: __unix_gc+0x117/0xf70 net/unix/garbage.c:261

stack backtrace:
CPU: 0 PID: 11 Comm: kworker/u8:1 Not tainted 6.9.0-rc5-syzkaller-00007-g4d2008430ce8 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: events_unbound __unix_gc
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2187
 check_prev_add kernel/locking/lockdep.c:3134 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
 _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
 spin_lock include/linux/spinlock.h:351 [inline]
 __unix_gc+0x40e/0xf70 net/unix/garbage.c:302
 process_one_work kernel/workqueue.c:3254 [inline]
 process_scheduled_works+0xa10/0x17c0 kernel/workqueue.c:3335
 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
 kthread+0x2f0/0x390 kernel/kthread.c:388
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

Fixes: 47d8ac0 ("af_unix: Fix garbage collector racing against connect()")
Reported-and-tested-by: syzbot+fa379358c28cc87cc307@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=fa379358c28cc87cc307
	Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20240424170443.9832-1-kuniyu@amazon.com
	Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 1971d13)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
jira VULN-155649
cve CVE-2022-50410
commit-author Chuck Lever <chuck.lever@oracle.com>
commit 401bc1f
upstream-diff The conditional before the `svc_reserve_auth()' call is
  the equivalent of `argp->count = min_t(u32, argp->count,
  NFSSVC_MAXBLKSIZE_V2);' in the mainline right after which the line in
  this commit was added

Since before the git era, NFSD has conserved the number of pages
held by each nfsd thread by combining the RPC receive and send
buffers into a single array of pages. This works because there are
no cases where an operation needs a large RPC Call message and a
large RPC Reply at the same time.

Once an RPC Call has been received, svc_process() updates
svc_rqst::rq_res to describe the part of rq_pages that can be
used for constructing the Reply. This means that the send buffer
(rq_res) shrinks when the received RPC record containing the RPC
Call is large.

A client can force this shrinkage on TCP by sending a correctly-
formed RPC Call header contained in an RPC record that is
excessively large. The full maximum payload size cannot be
constructed in that case.

	Cc: <stable@vger.kernel.org>
	Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
	Reviewed-by: Jeff Layton <jlayton@kernel.org>
	Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
(cherry picked from commit 401bc1f)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
jira VULN-155649
cve CVE-2022-50410
commit-author Chuck Lever <chuck.lever@oracle.com>
commit fa6be9c
upstream-diff LTS 8.6 version of the function `nfsd3_proc_read()'
  misses changes from 0cb4d23,
  cc9bcda and
  be63bd2. Preserved the logic of what
  is assigned to `resp->count' despite the missing changes.

Since before the git era, NFSD has conserved the number of pages
held by each nfsd thread by combining the RPC receive and send
buffers into a single array of pages. This works because there are
no cases where an operation needs a large RPC Call message and a
large RPC Reply at the same time.

Once an RPC Call has been received, svc_process() updates
svc_rqst::rq_res to describe the part of rq_pages that can be
used for constructing the Reply. This means that the send buffer
(rq_res) shrinks when the received RPC record containing the RPC
Call is large.

A client can force this shrinkage on TCP by sending a correctly-
formed RPC Call header contained in an RPC record that is
excessively large. The full maximum payload size cannot be
constructed in that case.

	Cc: <stable@vger.kernel.org>
	Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
	Reviewed-by: Jeff Layton <jlayton@kernel.org>
	Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
(cherry picked from commit fa6be9c)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant