Date: Thu, 29 Jul 2021 09:58:45 GMT From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 4f34dc64536f - main - linux(4): Replace casuword32 by casueword32. Message-ID: <202107290958.16T9wjo9070337@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=4f34dc64536f7de8324ca1a494aee88e64c7de70 commit 4f34dc64536f7de8324ca1a494aee88e64c7de70 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2021-07-29 09:50:11 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2021-07-29 09:50:11 +0000 linux(4): Replace casuword32 by casueword32. Follow the r349951 (30b3018d), add check to react to stops and requests to terminate between retries. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31254 MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 441a26d4d317..82a1eb55d618 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -107,8 +107,8 @@ LIN_SDT_PROBE_DEFINE1(futex, release_futexes, copyin_error, "int"); #define GET_SHARED(a) (a->flags & FUTEX_SHARED) ? AUTO_SHARE : THREAD_SHARE static int futex_atomic_op(struct thread *, int, uint32_t *); -static int handle_futex_death(struct linux_emuldata *, uint32_t *, - unsigned int); +static int handle_futex_death(struct thread *td, struct linux_emuldata *, + uint32_t *, unsigned int); static int fetch_robust_entry(struct linux_robust_list **, struct linux_robust_list **, unsigned int *); @@ -982,7 +982,7 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args } static int -handle_futex_death(struct linux_emuldata *em, uint32_t *uaddr, +handle_futex_death(struct thread *td, struct linux_emuldata *em, uint32_t *uaddr, unsigned int pi) { uint32_t uval, nval, mval; @@ -994,20 +994,22 @@ retry: return (EFAULT); if ((uval & FUTEX_TID_MASK) == em->em_tid) { mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED; - nval = casuword32(uaddr, uval, mval); - - if (nval == -1) + error = casueword32(uaddr, uval, &nval, mval); + if (error == -1) return (EFAULT); - - if (nval != uval) + if (error == 1) { + error = thread_check_susp(td, false); + if (error != 0) + return (error); goto retry; + } if (!pi && (uval & FUTEX_WAITERS)) { - error = futex_wake(curthread, uaddr, 1, true); + error = futex_wake(td, uaddr, 1, true); if (error != 0) return (error); } else if (pi && (uval & FUTEX_WAITERS)) { - error = futex_wake_pi(curthread, uaddr, true); + error = futex_wake_pi(td, uaddr, true); if (error != 0) return (error); } @@ -1067,7 +1069,7 @@ release_futexes(struct thread *td, struct linux_emuldata *em) rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi); if (entry != pending) - if (handle_futex_death(em, + if (handle_futex_death(td, em, (uint32_t *)((caddr_t)entry + futex_offset), pi)) { return; } @@ -1084,5 +1086,6 @@ release_futexes(struct thread *td, struct linux_emuldata *em) } if (pending) - handle_futex_death(em, (uint32_t *)((caddr_t)pending + futex_offset), pip); + handle_futex_death(td, em, + (uint32_t *)((caddr_t)pending + futex_offset), pip); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107290958.16T9wjo9070337>