REDHAT-BUG-2577656: High severity Linux Linux kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved:
mm/gup: check for overflow when converting nrpages to bytes in GUP-fast
The overflow check in gupfastfallback() only covers the addition to start. The preceding nrpages << PAGESHIFT can already have truncated the length on 32bit.
Users such as RapidIO's riodmatransfer() can derive such page counts from a 64-bit userspace length.
Let's just checkshloverflow() to reject any such overflow with -EOVERFLOW early.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In GUP-fast, use check_shl_overflow() to detect overflow when converting nr_pages to bytes and reject it early with -EOVERFLOW.
Event History
Frequently Asked Questions
Which systems are realistically exposed to this issue?
The described truncation occurs on 32-bit systems when a page count is converted to bytes. The example affected user is RapidIO's rio_dma_transfer(), where the page count can originate from a 64-bit userspace length.
What does an attacker need to trigger the vulnerable path?
They need a path that passes a sufficiently large userspace length into code that derives nr_pages and uses GUP-fast, such as the cited RapidIO DMA transfer path. The length must cause nr_pages << PAGE_SHIFT to overflow on a 32-bit system.
How does the fix change behavior for oversized requests?
The fix checks the left shift for overflow before the conversion can truncate. Requests that would overflow are rejected early with -EOVERFLOW.