CVE-2023-52474

Source
https://nvd.nist.gov/vuln/detail/CVE-2023-52474
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2023-52474.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2023-52474
Related
Published
2024-02-26T18:15:07Z
Modified
2024-09-11T05:02:04.486801Z
Severity
  • 7.8 (High) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
[none]
Details

In the Linux kernel, the following vulnerability has been resolved:

IB/hfi1: Fix bugs with non-PAGE_SIZE-end multi-iovec user SDMA requests

hfi1 user SDMA request processing has two bugs that can cause data corruption for user SDMA requests that have multiple payload iovecs where an iovec other than the tail iovec does not run up to the page boundary for the buffer pointed to by that iovec.a

Here are the specific bugs: 1. usersdmatxadd() does not use struct usersdmaiovec->iov.iovlen. Rather, usersdmatxadd() will add up to PAGESIZE bytes from iovec to the packet, even if some of those bytes are past iovec->iov.iovlen and are thus not intended to be in the packet. 2. usersdmatxadd() and usersdmasendpkts() fail to advance to the next iovec in usersdmarequest->iovs when the current iovec is not PAGE_SIZE and does not contain enough data to complete the packet. The transmitted packet will contain the wrong data from the iovec pages.

This has not been an issue with SDMA packets from hfi1 Verbs or PSM2 because they only produce iovecs that end short of PAGE_SIZE as the tail iovec of an SDMA request.

Fixing these bugs exposes other bugs with the SDMA pin cache (struct mmurbhandler) that get in way of supporting user SDMA requests with multiple payload iovecs whose buffers do not end at PAGE_SIZE. So this commit fixes those issues as well.

Here are the mmurbhandler bugs that non-PAGESIZE-end multi-iovec payload user SDMA requests can hit: 1. Overlapping memory ranges in mmurbhandler will result in duplicate pinnings. 2. When extending an existing mmurbhandler entry (struct mmurbnode), the mmurb code (1) removes the existing entry under a lock, (2) releases that lock, pins the new pages, (3) then reacquires the lock to insert the extended mmurbnode.

If someone else comes in and inserts an overlapping entry between (2) and (3), insert in (3) will fail.

The failure path code in this case unpins all pages in either the original mmurbnode or the new mmurbnode that was inserted between (2) and (3). 3. In hfi1mmurbremoveunlessexact(), mmurbnode->refcount is incremented outside of mmurbhandler->lock. As a result, mmurbnode could be evicted by another thread that gets mmurbhandler->lock and checks mmurbnode->refcount before mmurbnode->refcount is incremented. 4. Related to #2 above, SDMA request submission failure path does not check mmurbnode->refcount before freeing mmurb_node object.

If there are other SDMA requests in progress whose iovecs have pointers to the now-freed mmurbnode(s), those pointers to the now-freed mmu_rb nodes will be dereferenced when those SDMA requests complete.

References

Affected packages

Debian:11 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.10.191-1

Affected versions

5.*

5.10.46-4
5.10.46-5
5.10.70-1~bpo10+1
5.10.70-1
5.10.84-1
5.10.92-1~bpo10+1
5.10.92-1
5.10.92-2
5.10.103-1~bpo10+1
5.10.103-1
5.10.106-1
5.10.113-1
5.10.120-1~bpo10+1
5.10.120-1
5.10.127-1
5.10.127-2~bpo10+1
5.10.127-2
5.10.136-1
5.10.140-1
5.10.148-1
5.10.149-1
5.10.149-2
5.10.158-1
5.10.158-2
5.10.162-1
5.10.178-1
5.10.178-2
5.10.178-3
5.10.179-1
5.10.179-2
5.10.179-3
5.10.179-4
5.10.179-5

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:12 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
6.1.37-1

Affected versions

6.*

6.1.27-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:13 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
6.3.7-1

Affected versions

6.*

6.1.27-1
6.1.37-1
6.1.38-1
6.1.38-2~bpo11+1
6.1.38-2
6.1.38-3
6.1.38-4~bpo11+1
6.1.38-4
6.1.52-1
6.1.55-1~bpo11+1
6.1.55-1
6.1.64-1
6.1.66-1
6.1.67-1
6.1.69-1~bpo11+1
6.1.69-1
6.1.76-1~bpo11+1
6.1.76-1
6.1.82-1
6.1.85-1
6.1.90-1~bpo11+1
6.1.90-1
6.1.94-1~bpo11+1
6.1.94-1
6.1.98-1
6.1.99-1
6.1.106-1
6.1.106-2
6.1.106-3
6.3.1-1~exp1
6.3.2-1~exp1
6.3.4-1~exp1
6.3.5-1~exp1
6.3.7-1~bpo12+1

Ecosystem specific

{
    "urgency": "not yet assigned"
}