In the Linux kernel, the following vulnerability has been resolved:
net: drop bad gso csumstart and offset in virtionet_hdr
Tighten csumstart and csumoffset checks in virtionethdrtoskb for GSO packets.
The function already checks that a checksum requested with VIRTIONETHDRFNEEDS_CSUM is in skb linear. But for GSO packets this might not hold for segs after segmentation.
Syzkaller demonstrated to reach this warning in skbchecksumhelp
offset = skb_checksum_start_offset(skb);
ret = -EINVAL;
if (WARN_ON_ONCE(offset >= skb_headlen(skb)))
By injecting a TSO packet:
WARNING: CPU: 1 PID: 3539 at net/core/dev.c:3284 skbchecksumhelp+0x3d0/0x5b0 ipdofragment+0x209/0x1b20 net/ipv4/ipoutput.c:774 ipfinishoutputgso net/ipv4/ipoutput.c:279 [inline] _ipfinishoutput+0x2bd/0x4b0 net/ipv4/ipoutput.c:301 iptunnelxmit+0x50c/0x930 net/ipv4/iptunnelcore.c:82 iptunnelxmit+0x2296/0x2c70 net/ipv4/iptunnel.c:813 _grexmit net/ipv4/ipgre.c:469 [inline] ipgrexmit+0x759/0xa60 net/ipv4/ipgre.c:661 _netdevstartxmit include/linux/netdevice.h:4850 [inline] netdevstartxmit include/linux/netdevice.h:4864 [inline] xmitone net/core/dev.c:3595 [inline] devhardstartxmit+0x261/0x8c0 net/core/dev.c:3611 _devqueuexmit+0x1b97/0x3c90 net/core/dev.c:4261 packetsnd net/packet/afpacket.c:3073 [inline]
The geometry of the bad input packet at tcpgsosegment:
[ 52.003050][ T8403] skb len=12202 headroom=244 headlen=12093 tailroom=0 [ 52.003050][ T8403] mac=(168,24) maclen=24 net=(192,52) trans=244 [ 52.003050][ T8403] shinfo(txflags=0 nrfrags=1 gso(size=1552 type=3 segs=0)) [ 52.003050][ T8403] csum(0x60000c7 start=199 offset=1536 ipsummed=3 completesw=0 valid=0 level=0)
Mitigate with stricter input validation.
csumoffset: for GSO packets, deduce the correct value from gsotype. This is already done for USO. Extend it to TSO. Let UFO be: udp[46]ufofragment ignores these fields and always computes the checksum in software.
csumstart: finding the real offset requires parsing to the transport header. Do not add a parser, use existing segmentation parsing. Thanks to SKBGSO_DODGY, that also catches bad packets that are hw offloaded. Again test both TSO and USO. Do not test UFO for the above reason, and do not test UDP tunnel offload.
GSO packet are almost always CHECKSUMPARTIAL. USO packets may be CHECKSUMNONE since commit 10154dbded6d6 ("udp: Allow GSO transmit from devices with no checksum offload"), but then still these fields are initialized correctly in udp4hwcsum/udp6hwcsumoutgoing. So no need to test for ipsummed == CHECKSUM_PARTIAL first.
This revises an existing fix mentioned in the Fixes tag, which broke small packets with GSO offload, as detected by kselftests.
[
{
"signature_type": "Line",
"id": "CVE-2024-43897-14aad6df",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2edbb3e8838c672cd7e247e47989df9d03fc6668",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "include/linux/virtio_net.h"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"70812918560726542088953891860204208772",
"111164649538175440351284865249222764152",
"64725419576521748489928227584408430647",
"157129835058000350423317918421183504402",
"237102566478372732624228013915385071239",
"82780265376453105310266642062915179161",
"90414154951373123474520746394368255645",
"174061637421965380255133307971132723754",
"34610698959197654153943511356140951545",
"324145583049483567790066073877327621506",
"46738812929751234477908244130452206504",
"335636371072470621248660659987082587061",
"4964349048824297832952110458419730455",
"71615735223823033513100391136974024923",
"63546245115994013900455114805422925757",
"327024421432370910820058727548707666540",
"31103900063653748142583803306257800317",
"336998474136603867894500371842130979290",
"25016996816039198769394244070772999157",
"207058941928236535975224182674255889746"
]
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-2917797f",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2edbb3e8838c672cd7e247e47989df9d03fc6668",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "virtio_net_hdr_to_skb",
"file": "include/linux/virtio_net.h"
},
"digest": {
"function_hash": "17038249805253775565464839851240693238",
"length": 3151.0
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-2b981722",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@89add40066f9ed9abe5f7f886fe5789ff7e0c50e",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "virtio_net_hdr_to_skb",
"file": "include/linux/virtio_net.h"
},
"digest": {
"function_hash": "17038249805253775565464839851240693238",
"length": 3151.0
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-36000b29",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2edbb3e8838c672cd7e247e47989df9d03fc6668",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "__udp_gso_segment",
"file": "net/ipv4/udp_offload.c"
},
"digest": {
"function_hash": "259143356425641760409275119963095959043",
"length": 2078.0
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-3916c36f",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@413e785a89f8bde0d4156a54b8ac2fa003c06756",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "include/linux/virtio_net.h"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"70812918560726542088953891860204208772",
"111164649538175440351284865249222764152",
"64725419576521748489928227584408430647",
"157129835058000350423317918421183504402",
"237102566478372732624228013915385071239",
"82780265376453105310266642062915179161",
"90414154951373123474520746394368255645",
"174061637421965380255133307971132723754",
"34610698959197654153943511356140951545",
"324145583049483567790066073877327621506",
"46738812929751234477908244130452206504",
"335636371072470621248660659987082587061",
"4964349048824297832952110458419730455",
"71615735223823033513100391136974024923",
"63546245115994013900455114805422925757",
"327024421432370910820058727548707666540",
"31103900063653748142583803306257800317",
"336998474136603867894500371842130979290",
"25016996816039198769394244070772999157",
"207058941928236535975224182674255889746"
]
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-3a55dde0",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@413e785a89f8bde0d4156a54b8ac2fa003c06756",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "net/ipv4/tcp_offload.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"194768730435881294553245506105977817128",
"298270241141423805775668674848274786266",
"262182528926874075368823769450426823310"
]
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-476702b6",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@413e785a89f8bde0d4156a54b8ac2fa003c06756",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "virtio_net_hdr_to_skb",
"file": "include/linux/virtio_net.h"
},
"digest": {
"function_hash": "43380018740176441376596717315062036364",
"length": 2932.0
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-512d09f8",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@413e785a89f8bde0d4156a54b8ac2fa003c06756",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "__udp_gso_segment",
"file": "net/ipv4/udp_offload.c"
},
"digest": {
"function_hash": "259143356425641760409275119963095959043",
"length": 2078.0
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-53dc6ba5",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6772c4868a8e7ad5305957cdb834ce881793acb7",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "tcp_gso_segment",
"file": "net/ipv4/tcp_offload.c"
},
"digest": {
"function_hash": "274350295089521546981814816692363727819",
"length": 2345.0
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-56824b40",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2edbb3e8838c672cd7e247e47989df9d03fc6668",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "net/ipv4/tcp_offload.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"194768730435881294553245506105977817128",
"298270241141423805775668674848274786266",
"286395770243542441780800296868123742987"
]
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-5bc6eafa",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6772c4868a8e7ad5305957cdb834ce881793acb7",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "net/ipv4/tcp_offload.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"194768730435881294553245506105977817128",
"298270241141423805775668674848274786266",
"286395770243542441780800296868123742987"
]
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-608952e8",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@89add40066f9ed9abe5f7f886fe5789ff7e0c50e",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "net/ipv4/tcp_offload.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"194768730435881294553245506105977817128",
"298270241141423805775668674848274786266",
"286395770243542441780800296868123742987"
]
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-71ca010f",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6772c4868a8e7ad5305957cdb834ce881793acb7",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "virtio_net_hdr_to_skb",
"file": "include/linux/virtio_net.h"
},
"digest": {
"function_hash": "17038249805253775565464839851240693238",
"length": 3151.0
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-71d0b3cc",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f01c5e335fbb7fb612d40f14a3c02e2612a43d3b",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "virtio_net_hdr_to_skb",
"file": "include/linux/virtio_net.h"
},
"digest": {
"function_hash": "43380018740176441376596717315062036364",
"length": 2932.0
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-7296bf34",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6772c4868a8e7ad5305957cdb834ce881793acb7",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "include/linux/virtio_net.h"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"70812918560726542088953891860204208772",
"111164649538175440351284865249222764152",
"64725419576521748489928227584408430647",
"157129835058000350423317918421183504402",
"237102566478372732624228013915385071239",
"82780265376453105310266642062915179161",
"90414154951373123474520746394368255645",
"174061637421965380255133307971132723754",
"34610698959197654153943511356140951545",
"324145583049483567790066073877327621506",
"46738812929751234477908244130452206504",
"335636371072470621248660659987082587061",
"4964349048824297832952110458419730455",
"71615735223823033513100391136974024923",
"63546245115994013900455114805422925757",
"327024421432370910820058727548707666540",
"31103900063653748142583803306257800317",
"336998474136603867894500371842130979290",
"25016996816039198769394244070772999157",
"207058941928236535975224182674255889746"
]
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-756496b1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@413e785a89f8bde0d4156a54b8ac2fa003c06756",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "net/ipv4/udp_offload.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"323873909788141203033758358225582363473",
"303090214012705120193194039657892557318",
"207435670300698291304411937536372470240"
]
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-86740af4",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2edbb3e8838c672cd7e247e47989df9d03fc6668",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "net/ipv4/udp_offload.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"323873909788141203033758358225582363473",
"303090214012705120193194039657892557318",
"207435670300698291304411937536372470240"
]
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-9313e821",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@89add40066f9ed9abe5f7f886fe5789ff7e0c50e",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "__udp_gso_segment",
"file": "net/ipv4/udp_offload.c"
},
"digest": {
"function_hash": "130521446297084742927668795458541861018",
"length": 2165.0
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-933b51fc",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f01c5e335fbb7fb612d40f14a3c02e2612a43d3b",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "net/ipv4/udp_offload.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"323873909788141203033758358225582363473",
"303090214012705120193194039657892557318",
"207435670300698291304411937536372470240"
]
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-9c3ccb66",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f01c5e335fbb7fb612d40f14a3c02e2612a43d3b",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "include/linux/virtio_net.h"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"70812918560726542088953891860204208772",
"111164649538175440351284865249222764152",
"64725419576521748489928227584408430647",
"157129835058000350423317918421183504402",
"237102566478372732624228013915385071239",
"82780265376453105310266642062915179161",
"90414154951373123474520746394368255645",
"174061637421965380255133307971132723754",
"34610698959197654153943511356140951545",
"324145583049483567790066073877327621506",
"46738812929751234477908244130452206504",
"335636371072470621248660659987082587061",
"4964349048824297832952110458419730455",
"71615735223823033513100391136974024923",
"63546245115994013900455114805422925757",
"327024421432370910820058727548707666540",
"31103900063653748142583803306257800317",
"336998474136603867894500371842130979290",
"25016996816039198769394244070772999157",
"207058941928236535975224182674255889746"
]
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-9ed0bf61",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f01c5e335fbb7fb612d40f14a3c02e2612a43d3b",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "__udp_gso_segment",
"file": "net/ipv4/udp_offload.c"
},
"digest": {
"function_hash": "259143356425641760409275119963095959043",
"length": 2078.0
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-a034fd96",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@89add40066f9ed9abe5f7f886fe5789ff7e0c50e",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "include/linux/virtio_net.h"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"70812918560726542088953891860204208772",
"111164649538175440351284865249222764152",
"64725419576521748489928227584408430647",
"157129835058000350423317918421183504402",
"237102566478372732624228013915385071239",
"82780265376453105310266642062915179161",
"90414154951373123474520746394368255645",
"174061637421965380255133307971132723754",
"34610698959197654153943511356140951545",
"324145583049483567790066073877327621506",
"46738812929751234477908244130452206504",
"335636371072470621248660659987082587061",
"4964349048824297832952110458419730455",
"71615735223823033513100391136974024923",
"63546245115994013900455114805422925757",
"327024421432370910820058727548707666540",
"31103900063653748142583803306257800317",
"336998474136603867894500371842130979290",
"25016996816039198769394244070772999157",
"207058941928236535975224182674255889746"
]
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-a0f3bd25",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f01c5e335fbb7fb612d40f14a3c02e2612a43d3b",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "net/ipv4/tcp_offload.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"194768730435881294553245506105977817128",
"298270241141423805775668674848274786266",
"286395770243542441780800296868123742987"
]
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-b0c918b8",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6772c4868a8e7ad5305957cdb834ce881793acb7",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "__udp_gso_segment",
"file": "net/ipv4/udp_offload.c"
},
"digest": {
"function_hash": "259143356425641760409275119963095959043",
"length": 2078.0
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-b4d2d455",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@89add40066f9ed9abe5f7f886fe5789ff7e0c50e",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "tcp_gso_segment",
"file": "net/ipv4/tcp_offload.c"
},
"digest": {
"function_hash": "274350295089521546981814816692363727819",
"length": 2345.0
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-c3f349be",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@89add40066f9ed9abe5f7f886fe5789ff7e0c50e",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "net/ipv4/udp_offload.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"323873909788141203033758358225582363473",
"303090214012705120193194039657892557318",
"207435670300698291304411937536372470240"
]
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-ec1032f3",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@413e785a89f8bde0d4156a54b8ac2fa003c06756",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "tcp_gso_segment",
"file": "net/ipv4/tcp_offload.c"
},
"digest": {
"function_hash": "327266050458659747384257575575977523523",
"length": 2355.0
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-efeaf855",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f01c5e335fbb7fb612d40f14a3c02e2612a43d3b",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "tcp_gso_segment",
"file": "net/ipv4/tcp_offload.c"
},
"digest": {
"function_hash": "274350295089521546981814816692363727819",
"length": 2345.0
}
},
{
"signature_type": "Function",
"id": "CVE-2024-43897-f3bc3ee7",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2edbb3e8838c672cd7e247e47989df9d03fc6668",
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "tcp_gso_segment",
"file": "net/ipv4/tcp_offload.c"
},
"digest": {
"function_hash": "274350295089521546981814816692363727819",
"length": 2345.0
}
},
{
"signature_type": "Line",
"id": "CVE-2024-43897-fc073113",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6772c4868a8e7ad5305957cdb834ce881793acb7",
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "net/ipv4/udp_offload.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"323873909788141203033758358225582363473",
"303090214012705120193194039657892557318",
"207435670300698291304411937536372470240"
]
}
}
]