| From bippy-1.1.0 Mon Sep 17 00:00:00 2001 |
| From: Greg Kroah-Hartman <gregkh@kernel.org> |
| To: <linux-cve-announce@vger.kernel.org> |
| Reply-to: <cve@kernel.org>, <linux-kernel@vger.kernel.org> |
| Subject: CVE-2023-53109: net: tunnels: annotate lockless accesses to dev->needed_headroom |
| |
| Description |
| =========== |
| |
| In the Linux kernel, the following vulnerability has been resolved: |
| |
| net: tunnels: annotate lockless accesses to dev->needed_headroom |
| |
| IP tunnels can apparently update dev->needed_headroom |
| in their xmit path. |
| |
| This patch takes care of three tunnels xmit, and also the |
| core LL_RESERVED_SPACE() and LL_RESERVED_SPACE_EXTRA() |
| helpers. |
| |
| More changes might be needed for completeness. |
| |
| BUG: KCSAN: data-race in ip_tunnel_xmit / ip_tunnel_xmit |
| |
| read to 0xffff88815b9da0ec of 2 bytes by task 888 on cpu 1: |
| ip_tunnel_xmit+0x1270/0x1730 net/ipv4/ip_tunnel.c:803 |
| __gre_xmit net/ipv4/ip_gre.c:469 [inline] |
| ipgre_xmit+0x516/0x570 net/ipv4/ip_gre.c:661 |
| __netdev_start_xmit include/linux/netdevice.h:4881 [inline] |
| netdev_start_xmit include/linux/netdevice.h:4895 [inline] |
| xmit_one net/core/dev.c:3580 [inline] |
| dev_hard_start_xmit+0x127/0x400 net/core/dev.c:3596 |
| __dev_queue_xmit+0x1007/0x1eb0 net/core/dev.c:4246 |
| dev_queue_xmit include/linux/netdevice.h:3051 [inline] |
| neigh_direct_output+0x17/0x20 net/core/neighbour.c:1623 |
| neigh_output include/net/neighbour.h:546 [inline] |
| ip_finish_output2+0x740/0x840 net/ipv4/ip_output.c:228 |
| ip_finish_output+0xf4/0x240 net/ipv4/ip_output.c:316 |
| NF_HOOK_COND include/linux/netfilter.h:291 [inline] |
| ip_output+0xe5/0x1b0 net/ipv4/ip_output.c:430 |
| dst_output include/net/dst.h:444 [inline] |
| ip_local_out+0x64/0x80 net/ipv4/ip_output.c:126 |
| iptunnel_xmit+0x34a/0x4b0 net/ipv4/ip_tunnel_core.c:82 |
| ip_tunnel_xmit+0x1451/0x1730 net/ipv4/ip_tunnel.c:813 |
| __gre_xmit net/ipv4/ip_gre.c:469 [inline] |
| ipgre_xmit+0x516/0x570 net/ipv4/ip_gre.c:661 |
| __netdev_start_xmit include/linux/netdevice.h:4881 [inline] |
| netdev_start_xmit include/linux/netdevice.h:4895 [inline] |
| xmit_one net/core/dev.c:3580 [inline] |
| dev_hard_start_xmit+0x127/0x400 net/core/dev.c:3596 |
| __dev_queue_xmit+0x1007/0x1eb0 net/core/dev.c:4246 |
| dev_queue_xmit include/linux/netdevice.h:3051 [inline] |
| neigh_direct_output+0x17/0x20 net/core/neighbour.c:1623 |
| neigh_output include/net/neighbour.h:546 [inline] |
| ip_finish_output2+0x740/0x840 net/ipv4/ip_output.c:228 |
| ip_finish_output+0xf4/0x240 net/ipv4/ip_output.c:316 |
| NF_HOOK_COND include/linux/netfilter.h:291 [inline] |
| ip_output+0xe5/0x1b0 net/ipv4/ip_output.c:430 |
| dst_output include/net/dst.h:444 [inline] |
| ip_local_out+0x64/0x80 net/ipv4/ip_output.c:126 |
| iptunnel_xmit+0x34a/0x4b0 net/ipv4/ip_tunnel_core.c:82 |
| ip_tunnel_xmit+0x1451/0x1730 net/ipv4/ip_tunnel.c:813 |
| __gre_xmit net/ipv4/ip_gre.c:469 [inline] |
| ipgre_xmit+0x516/0x570 net/ipv4/ip_gre.c:661 |
| __netdev_start_xmit include/linux/netdevice.h:4881 [inline] |
| netdev_start_xmit include/linux/netdevice.h:4895 [inline] |
| xmit_one net/core/dev.c:3580 [inline] |
| dev_hard_start_xmit+0x127/0x400 net/core/dev.c:3596 |
| __dev_queue_xmit+0x1007/0x1eb0 net/core/dev.c:4246 |
| dev_queue_xmit include/linux/netdevice.h:3051 [inline] |
| neigh_direct_output+0x17/0x20 net/core/neighbour.c:1623 |
| neigh_output include/net/neighbour.h:546 [inline] |
| ip_finish_output2+0x740/0x840 net/ipv4/ip_output.c:228 |
| ip_finish_output+0xf4/0x240 net/ipv4/ip_output.c:316 |
| NF_HOOK_COND include/linux/netfilter.h:291 [inline] |
| ip_output+0xe5/0x1b0 net/ipv4/ip_output.c:430 |
| dst_output include/net/dst.h:444 [inline] |
| ip_local_out+0x64/0x80 net/ipv4/ip_output.c:126 |
| iptunnel_xmit+0x34a/0x4b0 net/ipv4/ip_tunnel_core.c:82 |
| ip_tunnel_xmit+0x1451/0x1730 net/ipv4/ip_tunnel.c:813 |
| __gre_xmit net/ipv4/ip_gre.c:469 [inline] |
| ipgre_xmit+0x516/0x570 net/ipv4/ip_gre.c:661 |
| __netdev_start_xmit include/linux/netdevice.h:4881 [inline] |
| netdev_start_xmit include/linux/netdevice.h:4895 [inline] |
| xmit_one net/core/dev.c:3580 [inline] |
| dev_hard_start_xmit+0x127/0x400 net/core/dev.c:3596 |
| __dev_queue_xmit+0x1007/0x1eb0 net/core/dev.c:4246 |
| dev_queue_xmit include/linux/netdevice.h:3051 [inline] |
| neigh_direct_output+0x17/0x20 net/core/neighbour.c:1623 |
| neigh_output include/net/neighbour.h:546 [inline] |
| ip_finish_output2+0x740/0x840 net/ipv4/ip_output.c:228 |
| ip_finish_output+0xf4/0x240 net/ipv4/ip_output.c:316 |
| NF_HOOK_COND include/linux/netfilter.h:291 [inline] |
| ip_output+0xe5/0x1b0 net/ipv4/ip_output.c:430 |
| dst_output include/net/dst.h:444 [inline] |
| ip_local_out+0x64/0x80 net/ipv4/ip_output.c:126 |
| iptunnel_xmit+0x34a/0x4b0 net/ipv4/ip_tunnel_core.c:82 |
| ip_tunnel_xmit+0x1451/0x1730 net/ipv4/ip_tunnel.c:813 |
| __gre_xmit net/ipv4/ip_gre.c:469 [inline] |
| ipgre_xmit+0x516/0x570 net/ipv4/ip_gre.c:661 |
| __netdev_start_xmit include/linux/netdevice.h:4881 [inline] |
| netdev_start_xmit include/linux/netdevice.h:4895 [inline] |
| xmit_one net/core/dev.c:3580 [inline] |
| dev_hard_start_xmit+0x127/0x400 net/core/dev.c:3596 |
| __dev_queue_xmit+0x1007/0x1eb0 net/core/dev.c:4246 |
| dev_queue_xmit include/linux/netdevice.h:3051 [inline] |
| neigh_direct_output+0x17/0x20 net/core/neighbour.c:1623 |
| neigh_output include/net/neighbour.h:546 [inline] |
| ip_finish_output2+0x740/0x840 net/ipv4/ip_output.c:228 |
| ip_finish_output+0xf4/0x240 net/ipv4/ip_output.c:316 |
| NF_HOOK_COND include/linux/netfilter.h:291 [inline] |
| ip_output+0xe5/0x1b0 net/ipv4/ip_output.c:430 |
| dst_output include/net/dst.h:444 [inline] |
| ip_local_out+0x64/0x80 net/ipv4/ip_output.c:126 |
| iptunnel_xmit+0x34a/0x4b0 net/ipv4/ip_tunnel_core.c:82 |
| ip_tunnel_xmit+0x1451/0x1730 net/ipv4/ip_tunnel.c:813 |
| __gre_xmit net/ipv4/ip_gre.c:469 [inline] |
| ipgre_xmit+0x516/0x570 net/ipv4/ip_gre.c:661 |
| __netdev_start_xmit include/linux/netdevice.h:4881 [inline] |
| netdev_start_xmit include/linux/netdevice.h:4895 [inline] |
| xmit_one net/core/dev.c:3580 [inline] |
| dev_hard_start_xmit+0x127/0x400 net/core/dev.c:3596 |
| __dev_queue_xmit+0x1007/0x1eb0 net/core/dev.c:4246 |
| dev_queue_xmit include/linux/netdevice.h:3051 [inline] |
| neigh_direct_output+0x17/0x20 net/core/neighbour.c:1623 |
| neigh_output include/net/neighbour.h:546 [inline] |
| ip_finish_output2+0x740/0x840 net/ipv4/ip_output.c:228 |
| ip_finish_output+0xf4/0x240 net/ipv4/ip_output.c:316 |
| NF_HOOK_COND include/linux/netfilter.h:291 [inline] |
| ip_output+0xe5/0x1b0 net/ipv4/ip_output.c:430 |
| dst_output include/net/dst.h:444 [inline] |
| ip_local_out+0x64/0x80 net/ipv4/ip_output.c:126 |
| iptunnel_xmit+0x34a/0x4b0 net/ipv4/ip_tunnel_core.c:82 |
| ip_tunnel_xmit+0x1451/0x1730 net/ipv4/ip_tunnel.c:813 |
| __gre_xmit net/ipv4/ip_gre.c:469 [inline] |
| ipgre_xmit+0x516/0x570 net/ipv4/ip_gre.c:661 |
| __netdev_start_xmit include/linux/netdevice.h:4881 [inline] |
| netdev_start_xmit include/linux/netdevice.h:4895 [inline] |
| xmit_one net/core/dev.c:3580 [inline] |
| dev_hard_start_xmit+0x127/0x400 net/core/dev.c:3596 |
| __dev_queue_xmit+0x1007/0x1eb0 net/core/dev.c:4246 |
| |
| write to 0xffff88815b9da0ec of 2 bytes by task 2379 on cpu 0: |
| ip_tunnel_xmit+0x1294/0x1730 net/ipv4/ip_tunnel.c:804 |
| __gre_xmit net/ipv4/ip_gre.c:469 [inline] |
| ipgre_xmit+0x516/0x570 net/ipv4/ip_gre.c:661 |
| __netdev_start_xmit include/linux/netdevice.h:4881 [inline] |
| netdev_start_xmit include/linux/netdevice.h:4895 [inline] |
| xmit_one net/core/dev.c:3580 [inline] |
| dev_hard_start_xmit+0x127/0x400 net/core/dev.c:3596 |
| __dev_queue_xmit+0x1007/0x1eb0 net/core/dev.c:4246 |
| dev_queue_xmit include/linux/netdevice.h:3051 [inline] |
| neigh_direct_output+0x17/0x20 net/core/neighbour.c:1623 |
| neigh_output include/net/neighbour.h:546 [inline] |
| ip6_finish_output2+0x9bc/0xc50 net/ipv6/ip6_output.c:134 |
| __ip6_finish_output net/ipv6/ip6_output.c:195 [inline] |
| ip6_finish_output+0x39a/0x4e0 net/ipv6/ip6_output.c:206 |
| NF_HOOK_COND include/linux/netfilter.h:291 [inline] |
| ip6_output+0xeb/0x220 net/ipv6/ip6_output.c:227 |
| dst_output include/net/dst.h:444 [inline] |
| NF_HOOK include/linux/netfilter.h:302 [inline] |
| mld_sendpack+0x438/0x6a0 net/ipv6/mcast.c:1820 |
| mld_send_cr net/ipv6/mcast.c:2121 [inline] |
| mld_ifc_work+0x519/0x7b0 net/ipv6/mcast.c:2653 |
| process_one_work+0x3e6/0x750 kernel/workqueue.c:2390 |
| worker_thread+0x5f2/0xa10 kernel/workqueue.c:2537 |
| kthread+0x1ac/0x1e0 kernel/kthread.c:376 |
| ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 |
| |
| value changed: 0x0dd4 -> 0x0e14 |
| |
| Reported by Kernel Concurrency Sanitizer on: |
| CPU: 0 PID: 2379 Comm: kworker/0:0 Not tainted 6.3.0-rc1-syzkaller-00002-g8ca09d5fa354-dirty #0 |
| Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 |
| Workqueue: mld mld_ifc_work |
| |
| The Linux kernel CVE team has assigned CVE-2023-53109 to this issue. |
| |
| |
| Affected and fixed versions |
| =========================== |
| |
| Issue introduced in 4.7 with commit 8eb30be0352d09165e94a41fef1c7b994dca0714 and fixed in 4.14.311 with commit 8e206f66d824b3b28a7f9ee1366dfc79a937bb46 |
| Issue introduced in 4.7 with commit 8eb30be0352d09165e94a41fef1c7b994dca0714 and fixed in 4.19.279 with commit 51f3bd3765bc5ca4583af07a00833da00d2ace1d |
| Issue introduced in 4.7 with commit 8eb30be0352d09165e94a41fef1c7b994dca0714 and fixed in 5.4.238 with commit 5aaab217c8f5387b9c5fff9e940d80f135e04366 |
| Issue introduced in 4.7 with commit 8eb30be0352d09165e94a41fef1c7b994dca0714 and fixed in 5.10.176 with commit be59b87ee4aed81db7c10e44f603866a0ac3ca5d |
| Issue introduced in 4.7 with commit 8eb30be0352d09165e94a41fef1c7b994dca0714 and fixed in 5.15.104 with commit e0a557fc1daf5c1086e47150a4571aebadbb62be |
| Issue introduced in 4.7 with commit 8eb30be0352d09165e94a41fef1c7b994dca0714 and fixed in 6.1.21 with commit a69b72b57b7d269e833e520ba7500d556e8189b6 |
| Issue introduced in 4.7 with commit 8eb30be0352d09165e94a41fef1c7b994dca0714 and fixed in 6.2.8 with commit 9b86a8702b042ee4e15d2d46375be873a6a8834f |
| Issue introduced in 4.7 with commit 8eb30be0352d09165e94a41fef1c7b994dca0714 and fixed in 6.3 with commit 4b397c06cb987935b1b097336532aa6b4210e091 |
| |
| Please see https://www.kernel.org for a full list of currently supported |
| kernel versions by the kernel community. |
| |
| Unaffected versions might change over time as fixes are backported to |
| older supported kernel versions. The official CVE entry at |
| https://cve.org/CVERecord/?id=CVE-2023-53109 |
| will be updated if fixes are backported, please check that for the most |
| up to date information about this issue. |
| |
| |
| Affected files |
| ============== |
| |
| The file(s) affected by this issue are: |
| include/linux/netdevice.h |
| net/ipv4/ip_tunnel.c |
| net/ipv6/ip6_tunnel.c |
| |
| |
| Mitigation |
| ========== |
| |
| The Linux kernel CVE team recommends that you update to the latest |
| stable kernel version for this, and many other bugfixes. Individual |
| changes are never tested alone, but rather are part of a larger kernel |
| release. Cherry-picking individual commits is not recommended or |
| supported by the Linux kernel community at all. If however, updating to |
| the latest release is impossible, the individual changes to resolve this |
| issue can be found at these commits: |
| https://git.kernel.org/stable/c/8e206f66d824b3b28a7f9ee1366dfc79a937bb46 |
| https://git.kernel.org/stable/c/51f3bd3765bc5ca4583af07a00833da00d2ace1d |
| https://git.kernel.org/stable/c/5aaab217c8f5387b9c5fff9e940d80f135e04366 |
| https://git.kernel.org/stable/c/be59b87ee4aed81db7c10e44f603866a0ac3ca5d |
| https://git.kernel.org/stable/c/e0a557fc1daf5c1086e47150a4571aebadbb62be |
| https://git.kernel.org/stable/c/a69b72b57b7d269e833e520ba7500d556e8189b6 |
| https://git.kernel.org/stable/c/9b86a8702b042ee4e15d2d46375be873a6a8834f |
| https://git.kernel.org/stable/c/4b397c06cb987935b1b097336532aa6b4210e091 |