git: ba77290cceac - stable/13 - linux(4): Handle cas failure on ll/sc operations
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Jun 2022 19:40:47 UTC
The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=ba77290cceac3391aa4a3469725e093fb1366fe1 commit ba77290cceac3391aa4a3469725e093fb1366fe1 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-05-19 16:52:18 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-06-17 19:35:25 +0000 linux(4): Handle cas failure on ll/sc operations Follow the 11a6ecd4. Check and handle the case when the ll/sc casu fails even when the compare succeeds. For more details PR/263825, https://reviews.freebsd.org/D35150. Obtained from: Andrew@ MFC after: 2 weeks (cherry picked from commit 2cd662064a0cd8d179cbb5a06378fce0ec458747) --- sys/compat/linux/linux_futex.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 6825d13e1aab..8bcdc378cf70 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -410,6 +410,17 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) break; } + /* + * Nobody owns it, but the acquire failed. This can happen + * with ll/sc atomic. + */ + if (owner == 0) { + error = thread_check_susp(td, true); + if (error != 0) + break; + continue; + } + /* * Avoid overwriting a possible error from sleep due * to the pending signal with suspension check result.