Skip to content
Heist/ feed
High

bpf, sockmap: Fix skb refcnt race after locking changes

Type: advisorySource: Official CVE List1 source record

In the Linux kernel, the following vulnerability has been resolved: bpf, sockmap: Fix skb refcnt race after locking changes There is a race where skb's from the sk_psock_backlog can be referenced after userspace side has already skb_consumed() the sk_buff and its refcnt dropped to zer0 causing use after free. The flow is the following: while ((skb = skb_peek(&psock->ingress_skb)) sk_psock_handle_Skb(psock, skb, ..., ingress) if (!ingress) ... sk_psock_skb_ingress sk_psock_skb_ingress_enqueue(skb) msg->skb = skb sk_psock_queue_msg(psock, msg) skb_dequeue(&psock->ingress_skb) The sk_psock_queue_msg() puts the msg on the ingress_msg queue. This is what the application reads when recvmsg() is called. An application can read this anytime after the msg is placed on the queue. The recvmsg hook will also read msg->skb and then after user space reads the msg will call consume_skb(skb) on it effectively free'ing it. But, the race is in above where backlog queue still has a reference to the skb and calls skb_dequeue(). If the skb_dequeue happens after the user reads and free's the skb we have a use after free. The !ingress case does not suffer from this problem because it uses sendmsg_*(sk, msg) which does not pass the sk_buff further down the stack. The following splat was observed with 'test_progs -t sockmap_listen': [ 1022.710250][ T2556] general protection fault, ... [...] [ 1022.712830][ T2556] Workqueue: events sk_psock_backlog [ 1022.713262][ T2556] RIP: 0010:skb_dequeue+0x4c/0x8

Announced Source revision 1
Original source ↗

CVE-2023-53836

Primary source · Revision 1

Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.

Security context

Source reference: cve:CVE-2023-53836

Linux

Source reference: /containers/cna/affected/0/product

Affected versions
Not stated in this record
Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

Linux

Source reference: /containers/cna/affected/1/product

Affected versions
Not stated in this record
Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

Structured affected-version data

Original package identities and version rules from this source.

[
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "799aa7f98d53e0f541fa6b4dc9aa47b4ff2178e3",
        "lessThan": "65ad600b9bde68d2d28709943ab00b51ca8f0a1d",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "799aa7f98d53e0f541fa6b4dc9aa47b4ff2178e3",
        "lessThan": "923877254f002ae87d441382bb1096d9e773d56d",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "799aa7f98d53e0f541fa6b4dc9aa47b4ff2178e3",
        "lessThan": "e6b5e47adb9166e732cdf7e6e034946e3f89f36d",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "799aa7f98d53e0f541fa6b4dc9aa47b4ff2178e3",
        "lessThan": "a454d84ee20baf7bd7be90721b9821f73c7d23d9",
        "versionType": "git"
      }
    ],
    "programFiles": [
      "net/core/skmsg.c"
    ],
    "defaultStatus": "unaffected"
  },
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "5.13"
      },
      {
        "status": "unaffected",
        "version": "0",
        "lessThan": "5.13",
        "versionType": "semver"
      },
      {
        "status": "unaffected",
        "version": "5.15.189",
        "versionType": "semver",
        "lessThanOrEqual": "5.15.*"
      },
      {
        "status": "unaffected",
        "version": "6.1.54",
        "versionType": "semver",
        "lessThanOrEqual": "6.1.*"
      },
      {
        "status": "unaffected",
        "version": "6.5.4",
        "versionType": "semver",
        "lessThanOrEqual": "6.5.*"
      },
      {
        "status": "unaffected",
        "version": "6.6",
        "versionType": "original_commit_for_fix",
        "lessThanOrEqual": "*"
      }
    ],
    "programFiles": [
      "net/core/skmsg.c"
    ],
    "defaultStatus": "affected"
  }
]
Related CVEs
CVE-2023-53836

Source reference: /cveMetadata/cveId

Publisher severity

high

Source reference: /containers/cna/metrics

Event
#30329 · Revision 1
Added to Heist Feed
Publisher date
Read the original announcement