diff mbox series

[42/66] bsd-user: Fix freebsd_lock_umutex to re-read m_owner not m_count

Message ID 20260515-misc-2026q2-v1-42-5438ca41b27a@bsdimp.com
State New
Headers show
Series bsd-user: Upstream most of the remaining system calls | expand

Commit Message

Warner Losh May 15, 2026, 9:19 p.m. UTC
When tcmpset_32 fails to set the contested bit on m_owner, the retry
loop re-read the value from m_count instead of m_owner, causing the
loop to operate on the wrong field.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 bsd-user/freebsd/os-thread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/bsd-user/freebsd/os-thread.c b/bsd-user/freebsd/os-thread.c
index 9e6055a040..b91e0d32b0 100644
--- a/bsd-user/freebsd/os-thread.c
+++ b/bsd-user/freebsd/os-thread.c
@@ -978,7 +978,7 @@  abi_long freebsd_lock_umutex(abi_ulong target_addr, uint32_t id,
 
                 break;
             } else {
-                __get_user(owner, &target_umutex->m_count);
+                __get_user(owner, &target_umutex->m_owner);
             }
         }