Repository navigation
Commit 8fde12c
committed
mm: prevent get_user_pages() from overflowing page refcount
If the page refcount wraps around past zero, it will be freed while
there are still four billion references to it. One of the possible
avenues for an attacker to try to make this happen is by doing direct IO
on a page multiple times. This patch makes get_user_pages() refuse to
take a new page reference if there are already more than two billion
references to the page.
Reported-by: Jann Horn <jannh@google.com>
Acked-by: Matthew Wilcox <willy@infradead.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>1 parent 88b1a17 commit 8fde12c
2 files changed
Lines changed: 49 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
161 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
162 | 166 | | |
163 | 167 | | |
164 | 168 | | |
| |||
295 | 299 | | |
296 | 300 | | |
297 | 301 | | |
298 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
299 | 306 | | |
300 | 307 | | |
301 | 308 | | |
| |||
497 | 504 | | |
498 | 505 | | |
499 | 506 | | |
500 | | - | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
501 | 511 | | |
502 | 512 | | |
503 | 513 | | |
| |||
1393 | 1403 | | |
1394 | 1404 | | |
1395 | 1405 | | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
1396 | 1420 | | |
1397 | 1421 | | |
1398 | 1422 | | |
| |||
1427 | 1451 | | |
1428 | 1452 | | |
1429 | 1453 | | |
1430 | | - | |
1431 | 1454 | | |
1432 | | - | |
| 1455 | + | |
| 1456 | + | |
1433 | 1457 | | |
1434 | 1458 | | |
1435 | 1459 | | |
| |||
1568 | 1592 | | |
1569 | 1593 | | |
1570 | 1594 | | |
1571 | | - | |
1572 | | - | |
| 1595 | + | |
| 1596 | + | |
1573 | 1597 | | |
1574 | 1598 | | |
1575 | 1599 | | |
| |||
1606 | 1630 | | |
1607 | 1631 | | |
1608 | 1632 | | |
1609 | | - | |
1610 | | - | |
| 1633 | + | |
| 1634 | + | |
1611 | 1635 | | |
1612 | 1636 | | |
1613 | 1637 | | |
| |||
1643 | 1667 | | |
1644 | 1668 | | |
1645 | 1669 | | |
1646 | | - | |
1647 | | - | |
| 1670 | + | |
| 1671 | + | |
1648 | 1672 | | |
1649 | 1673 | | |
1650 | 1674 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4298 | 4298 | | |
4299 | 4299 | | |
4300 | 4300 | | |
| 4301 | + | |
| 4302 | + | |
| 4303 | + | |
| 4304 | + | |
| 4305 | + | |
| 4306 | + | |
| 4307 | + | |
| 4308 | + | |
| 4309 | + | |
| 4310 | + | |
| 4311 | + | |
| 4312 | + | |
| 4313 | + | |
4301 | 4314 | | |
4302 | 4315 | | |
4303 | 4316 | | |
| |||
0 commit comments