Vulnerability · Published May 30, 2024 · Assigned by Linux
CVE-2024-36938bpf, skmsg: Fix NULL pointer dereference in sk_psock_skb_ingress_enqueue
Medium 5.5
In plain English
A medium-severity security flaw in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.2% (higher than 16% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
In the Linux kernel, the following vulnerability has been resolved: bpf, skmsg: Fix NULL pointer dereference in sk_psock_skb_ingress_enqueue Fix NULL pointer data-races in sk_psock_skb_ingress_enqueue() which syzbot reported [1]. [1] BUG: KCSAN: data-race in sk_psock_drop / sk_psock_skb_ingress_enqueue write to 0xffff88814b3278b8 of 8 bytes by task 10724 on cpu 1: sk_psock_stop_verdict net/core/skmsg.c:1257 [inline] sk_psock_drop+0x13e/0x1f0 net/core/skmsg.c:843 sk_psock_put include/linux/skmsg.h:459 [inline] sock_map_close+0x1a7/0x260 net/core/sock_map.c:1648 unix_release+0x4b/0x80 net/unix/af_unix.c:1048 __sock_release net/socket.c:659 [inline] sock_close+0x68/0x150 net/socket.c:1421 __fput+0x2c1/0x660 fs/file_table.c:422 __fput_sync+0x44/0x60 fs/file_table.c:507 __do_sys_close fs/open.c:1556 [inline] __se_sys_close+0x101/0x1b0 fs/open.c:1541 __x64_sys_close+0x1f/0x30 fs/open.c:1541 do_syscall_64+0xd3/0x1d0 entry_SYSCALL_64_after_hwframe+0x6d/0x75 read to 0xffff88814b3278b8 of 8 bytes by task 10713 on cpu 0: sk_psock_data_ready include/linux/skmsg.h:464 [inline] sk_psock_skb_ingress_enqueue+0x32d/0x390 net/core/skmsg.c:555 sk_psock_skb_ingress_self+0x185/0x1e0 net/core/skmsg.c:606 sk_psock_verdict_apply net/core/skmsg.c:1008 [inline] sk_psock_verdict_recv+0x3e4/0x4a0 net/core/skmsg.c:1202 unix_read_skb net/unix/af_unix.c:2546 [inline] unix_stream_read_skb+0x9e/0xf0 net/unix/af_unix.c:2682 sk_psock_verdict_data_ready+0x77/0x220 net/core/skmsg.c:1223 unix_stream_sendmsg+0x527/0x860 net/unix/af_unix.c:2339 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x140/0x180 net/socket.c:745 ____sys_sendmsg+0x312/0x410 net/socket.c:2584 ___sys_sendmsg net/socket.c:2638 [inline] __sys_sendmsg+0x1e9/0x280 net/socket.c:2667 __do_sys_sendmsg net/socket.c:2676 [inline] __se_sys_sendmsg net/socket.c:2674 [inline] __x64_sys_sendmsg+0x46/0x50 net/socket.c:2674 do_syscall_64+0xd3/0x1d0 entry_SYSCALL_64_after_hwframe+0x6d/0x75 value changed: 0xffffffff83d7feb0 -> 0x0000000000000000 Reported by Kernel Concurrency Sanitizer on: CPU: 0 PID: 10713 Comm: syz-executor.4 Tainted: G W 6.8.0-syzkaller-08951-gfe46a7dd189e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024 Prior to this, commit 4cd12c6065df ("bpf, sockmap: Fix NULL pointer dereference in sk_psock_verdict_data_ready()") fixed one NULL pointer similarly due to no protection of saved_data_ready. Here is another different caller causing the same issue because of the same reason. So we should protect it with sk_callback_lock read lock because the writer side in the sk_psock_drop() uses "write_lock_bh(&sk->sk_callback_lock);". To avoid errors that could happen in future, I move those two pairs of lock into the sk_psock_data_ready(), which is suggested by John Fastabend.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | linux | 6.1.94-1 | DEBIAN-CVE-2024-36938 |
| Debian:13 | linux | 6.8.11-1 | DEBIAN-CVE-2024-36938 |
| Debian:14 | linux | 6.8.11-1 | DEBIAN-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux | 5.15.0-118.128 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux | 5.15.0-118.128 | USN-6950-1 |
| Ubuntu:24.04:LTS | linux | 6.8.0-40.40 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-allwinner-5.19 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-aws | 5.15.0-1067.73 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-aws | 5.15.0-1067.73 | USN-6950-1 |
| Ubuntu:24.04:LTS | linux-aws | 6.8.0-1013.14 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-aws-5.19 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-aws-6.2 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-aws-6.5 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-aws-6.8 | 6.8.0-1013.14~22.04.1 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-azure | 5.15.0-1070.79 | USN-6956-1 |
| Ubuntu:22.04:LTS | linux-azure | 5.15.0-1070.79 | UBUNTU-CVE-2024-36938 |
| Ubuntu:24.04:LTS | linux-azure | 6.8.0-1012.14 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-azure-5.19 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-azure-6.2 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-azure-6.5 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-azure-6.8 | 6.8.0-1012.14~22.04.1 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-azure-fde | 5.15.0-1070.79.1 | USN-6956-1 |
| Ubuntu:22.04:LTS | linux-azure-fde | 5.15.0-1070.79.1 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-azure-fde-5.19 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-azure-fde-6.2 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-gcp | 5.15.0-1066.74 | USN-6950-1 |
| Ubuntu:22.04:LTS | linux-gcp | 5.15.0-1066.74 | UBUNTU-CVE-2024-36938 |
| Ubuntu:24.04:LTS | linux-gcp | 6.8.0-1012.13 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-gcp-5.19 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-gcp-6.2 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-gcp-6.5 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-gcp-6.8 | 6.8.0-1012.13~22.04.1 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-gke | 5.15.0-1064.70 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-gke | 5.15.0-1064.70 | USN-6950-1 |
| Ubuntu:24.04:LTS | linux-gke | 6.8.0-1008.11 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-gkeop | 5.15.0-1050.57 | USN-6950-1 |
| Ubuntu:22.04:LTS | linux-gkeop | 5.15.0-1050.57 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-hwe-5.19 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-hwe-6.2 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-hwe-6.5 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-hwe-6.8 | 6.8.0-40.40~22.04.3 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-ibm | 5.15.0-1060.63 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-ibm | 5.15.0-1060.63 | USN-6950-2 |
| Ubuntu:24.04:LTS | linux-ibm | 6.8.0-1010.10 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-ibm-6.8 | 6.8.0-1010.10~22.04.1 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-intel-iotg | 5.15.0-1062.68 | USN-6950-1 |
| Ubuntu:22.04:LTS | linux-intel-iotg | 5.15.0-1062.68 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-kvm | 5.15.0-1064.69 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-kvm | 5.15.0-1064.69 | USN-6950-1 |
| Ubuntu:22.04:LTS | linux-lowlatency | 5.15.0-118.128 | USN-6950-1 |
| Ubuntu:22.04:LTS | linux-lowlatency | 5.15.0-118.128 | UBUNTU-CVE-2024-36938 |
| Ubuntu:24.04:LTS | linux-lowlatency | 6.8.0-40.40.1 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-5.19 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.2 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.5 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.8 | 6.8.0-40.40.1~22.04.1 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-nvidia | 5.15.0-1062.63 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-nvidia | 5.15.0-1062.63 | USN-6950-1 |
| Ubuntu:24.04:LTS | linux-nvidia | 6.8.0-1011.11 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-nvidia-6.2 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-nvidia-6.5 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-nvidia-6.8 | 6.8.0-1011.11~22.04.1 | UBUNTU-CVE-2024-36938 |
| Ubuntu:24.04:LTS | linux-nvidia-lowlatency | 6.8.0-1011.11.1 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-nvidia-tegra | 5.15.0-1027.27 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-nvidia-tegra-igx | 5.15.0-1015.15 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-oem-5.17 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-oem-6.0 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-oem-6.1 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-oem-6.5 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:24.04:LTS | linux-oem-6.8 | 6.8.0-1010.10 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-oracle | 5.15.0-1065.71 | USN-6950-3 |
| Ubuntu:22.04:LTS | linux-oracle | 5.15.0-1065.71 | UBUNTU-CVE-2024-36938 |
| Ubuntu:24.04:LTS | linux-oracle | 6.8.0-1010.10 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-oracle-6.5 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-oracle-6.8 | 6.8.0-1010.10~22.04.1 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-raspi | 5.15.0-1060.63 | USN-6950-2 |
| Ubuntu:22.04:LTS | linux-raspi | 5.15.0-1060.63 | UBUNTU-CVE-2024-36938 |
| Ubuntu:24.04:LTS | linux-raspi | 6.8.0-1009.10 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-realtime | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-riscv | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:24.04:LTS | linux-riscv | 6.8.0-40.40.1 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-riscv-5.19 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-riscv-6.5 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-riscv-6.8 | 6.8.0-40.40.1~22.04.1 | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-starfive-5.19 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-starfive-6.2 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-starfive-6.5 | no fix listed | UBUNTU-CVE-2024-36938 |
| Ubuntu:22.04:LTS | linux-xilinx-zynqmp | 5.15.0-1035.39 | UBUNTU-CVE-2024-36938 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | 604326b41a6fb9b4a78b6179335decee0365cd8c – before c0809c128dad4c3413818384eb06a341633db973604326b41a6fb9b4a78b6179335decee0365cd8c – before 5965bc7535fb87510b724e5465ccc1a1cf00916d604326b41a6fb9b4a78b6179335decee0365cd8c – before 39dc9e1442385d6e9be0b6491ee488dddd55ae27604326b41a6fb9b4a78b6179335decee0365cd8c – before b397a0ab8582c533ec0c6b732392f141fc364f87604326b41a6fb9b4a78b6179335decee0365cd8c – before 772d5729b5ff0df0d37b32db600ce635b2172f80604326b41a6fb9b4a78b6179335decee0365cd8c – before 6648e613226e18897231ab5e42ffc29e63fa3365 |
| Linux | Linux | 4.20 |
References
- https://git.kernel.org/stable/c/c0809c128dad4c3413818384eb06a341633db973
- https://git.kernel.org/stable/c/5965bc7535fb87510b724e5465ccc1a1cf00916d
- https://git.kernel.org/stable/c/39dc9e1442385d6e9be0b6491ee488dddd55ae27
- https://git.kernel.org/stable/c/b397a0ab8582c533ec0c6b732392f141fc364f87
- https://git.kernel.org/stable/c/772d5729b5ff0df0d37b32db600ce635b2172f80
- https://git.kernel.org/stable/c/6648e613226e18897231ab5e42ffc29e63fa3365