Commit 8a1fc8d
rtmutex: Use waiter::task instead of current in remove_waiter()
commit 3bfdc63 upstream.
remove_waiter() is used by the slowlock paths, but it is also used for
proxy-lock rollback in rt_mutex_start_proxy_lock() when invoked from
futex_requeue().
In the latter case waiter::task is not current, but remove_waiter()
operates on current for the dequeue operation. That results in several
problems:
1) the rbtree dequeue happens without waiter::task::pi_lock being held
2) the waiter task's pi_blocked_on state is not cleared, which leaves a
dangling pointer primed for UAF around.
3) rt_mutex_adjust_prio_chain() operates on the wrong top priority waiter
task
Use waiter::task instead of current in all related operations in
remove_waiter() to cure those problems.
[ tglx: Fixup rt_mutex_adjust_prio_chain(), add a comment and amend the
changelog ]
Fixes: 8161239 ("rtmutex: Simplify PI algorithm and make highest prio task get lock")
Reported-by: Yuan Tan <yuantan098@gmail.com>
Reported-by: Yifan Wu <yifanwucs@gmail.com>
Reported-by: Juefei Pu <tomapufckgml@gmail.com>
Reported-by: Xin Liu <bird@lzu.edu.cn>
Signed-off-by: Keenan Dong <keenanat2000@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent a954061 commit 8a1fc8d
1 file changed
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1511 | 1511 | | |
1512 | 1512 | | |
1513 | 1513 | | |
| 1514 | + | |
| 1515 | + | |
1514 | 1516 | | |
1515 | 1517 | | |
1516 | 1518 | | |
1517 | 1519 | | |
1518 | 1520 | | |
1519 | 1521 | | |
| 1522 | + | |
1520 | 1523 | | |
1521 | 1524 | | |
1522 | 1525 | | |
1523 | 1526 | | |
1524 | | - | |
1525 | | - | |
1526 | | - | |
1527 | | - | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
1528 | 1531 | | |
1529 | 1532 | | |
1530 | 1533 | | |
| |||
1560 | 1563 | | |
1561 | 1564 | | |
1562 | 1565 | | |
1563 | | - | |
| 1566 | + | |
1564 | 1567 | | |
1565 | 1568 | | |
1566 | 1569 | | |
| |||
0 commit comments