Commit 791f346
io_uring: fix UAF due to missing POLLFREE handling
Fixes a problem described in 50252e4
("aio: fix use-after-free due to missing POLLFREE handling")
and copies the approach used there.
In short, we have to forcibly eject a poll entry when we meet POLLFREE.
We can't rely on io_poll_get_ownership() as can't wait for potentially
running tw handlers, so we use the fact that wqs are RCU freed. See
Eric's patch and comments for more details.
Reported-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20211209010455.42744-6-ebiggers@kernel.org
Reported-and-tested-by: syzbot+5426c7ed6868c705ca14@syzkaller.appspotmail.com
Fixes: 221c5eb ("io_uring: add support for IORING_OP_POLL")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/4ed56b6f548f7ea337603a82315750449412748a.1642161259.git.asml.silence@gmail.com
[axboe: drop non-functional change from patch]
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent c84b8a3 commit 791f346
1 file changed
Lines changed: 50 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5462 | 5462 | | |
5463 | 5463 | | |
5464 | 5464 | | |
5465 | | - | |
| 5465 | + | |
5466 | 5466 | | |
5467 | | - | |
5468 | | - | |
5469 | | - | |
5470 | | - | |
| 5467 | + | |
| 5468 | + | |
| 5469 | + | |
| 5470 | + | |
| 5471 | + | |
| 5472 | + | |
5471 | 5473 | | |
5472 | 5474 | | |
5473 | 5475 | | |
5474 | 5476 | | |
5475 | 5477 | | |
5476 | 5478 | | |
5477 | 5479 | | |
5478 | | - | |
5479 | | - | |
5480 | | - | |
| 5480 | + | |
| 5481 | + | |
| 5482 | + | |
| 5483 | + | |
| 5484 | + | |
| 5485 | + | |
| 5486 | + | |
| 5487 | + | |
| 5488 | + | |
| 5489 | + | |
| 5490 | + | |
| 5491 | + | |
| 5492 | + | |
| 5493 | + | |
| 5494 | + | |
| 5495 | + | |
| 5496 | + | |
| 5497 | + | |
5481 | 5498 | | |
| 5499 | + | |
5482 | 5500 | | |
5483 | 5501 | | |
5484 | 5502 | | |
| |||
5618 | 5636 | | |
5619 | 5637 | | |
5620 | 5638 | | |
| 5639 | + | |
| 5640 | + | |
| 5641 | + | |
| 5642 | + | |
| 5643 | + | |
| 5644 | + | |
| 5645 | + | |
| 5646 | + | |
| 5647 | + | |
| 5648 | + | |
| 5649 | + | |
| 5650 | + | |
| 5651 | + | |
| 5652 | + | |
| 5653 | + | |
| 5654 | + | |
| 5655 | + | |
| 5656 | + | |
| 5657 | + | |
| 5658 | + | |
| 5659 | + | |
| 5660 | + | |
| 5661 | + | |
| 5662 | + | |
5621 | 5663 | | |
5622 | 5664 | | |
5623 | 5665 | | |
| |||
0 commit comments