The branch main has been updated by dchagin:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2cd662064a0cd8d179cbb5a06378fce0ec458747

commit 2cd662064a0cd8d179cbb5a06378fce0ec458747
Author:     Dmitry Chagin <dcha...@freebsd.org>
AuthorDate: 2022-05-19 16:52:18 +0000
Commit:     Dmitry Chagin <dcha...@freebsd.org>
CommitDate: 2022-05-19 16:52:18 +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
---
 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.

Reply via email to