From nobody Sat Oct 9 20:07:38 2021 X-Original-To: threads@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6BC5C17E3E1F for ; Sat, 9 Oct 2021 20:07:38 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HRbhB2QWXz4Yxv for ; Sat, 9 Oct 2021 20:07:38 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 295EB20914 for ; Sat, 9 Oct 2021 20:07:38 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 199K7caL038115 for ; Sat, 9 Oct 2021 20:07:38 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 199K7csI038114 for threads@FreeBSD.org; Sat, 9 Oct 2021 20:07:38 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: threads@FreeBSD.org Subject: [Bug 254995] pthread_cond_timedwait() returns EDEADLK Date: Sat, 09 Oct 2021 20:07:38 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 12.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kib@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D254995 --- Comment #11 from Konstantin Belousov --- Better this one, handling malicious userspace commit dc64dc0a431faeded1ea294489c4584d537bb01a Author: Konstantin Belousov Date: Sat Oct 9 22:46:08 2021 +0300 umtx: Do not return spurious failures on unlock after suspend for norma= l or PI mutexes diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index ea87259161c8..b06e121e58ec 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -1486,7 +1486,7 @@ do_unlock_normal(struct thread *td, struct umutex *m, uint32_t flags, bool rb) if (error =3D=3D -1) return (EFAULT); if (error =3D=3D 1) { - error =3D thread_check_susp(td, false); + error =3D thread_check_susp(td, true); if (error !=3D 0) return (error); goto again; @@ -1523,7 +1523,7 @@ do_unlock_normal(struct thread *td, struct umutex *m, uint32_t flags, bool rb) if (error =3D=3D 1) { if (old !=3D owner) return (EINVAL); - error =3D thread_check_susp(td, false); + error =3D thread_check_susp(td, true); if (error !=3D 0) return (error); goto again; @@ -2427,8 +2427,8 @@ do_unlock_pi(struct thread *td, struct umutex *m, uint32_t flags, bool rb) new_owner |=3D UMUTEX_CONTESTED; again: error =3D casueword32(&m->m_owner, owner, &old, new_owner); - if (error =3D=3D 1) { - error =3D thread_check_susp(td, false); + if (error =3D=3D 1 && (old & ~UMUTEX_CONTESTED) =3D=3D id) { + error =3D thread_check_susp(td, true); if (error =3D=3D 0) goto again; } --=20 You are receiving this mail because: You are the assignee for the bug.=