From nobody Thu May 09 13:30:18 2024 X-Original-To: dev-commits-src-all@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 4VZtDW1RSHz5JgqZ; Thu, 09 May 2024 13:30:19 +0000 (UTC) (envelope-from git@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 4VZtDV3zfxz3xyJ; Thu, 9 May 2024 13:30:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715261418; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Q7XA620N6YS+hc27enlZXk1LeBqgA3hiMPqeBuzoW1o=; b=GvO1F9tBq7Nu/hwZh7FXWAulr449LodDZB4ontNs5Ed687Kj1mlmxiirW9PEfp1CuWZBak tbBg6W9bbTMuRzbF1UgQ6irtdj5V/wO+34+Wvhg9hukIL69fKZGum9toO3595uAGWXzw5I GpRyzRJj8NLGW+ougg4RqFXNpN52Xt4FrU54n2cLR5luHA20FpiiaDB4aEE7/1JcncEP2r pZfW5KK3CC5IxwsA25JcYnc3K0G/tawrg3QGf1YxyVk6Og/4/CgyRbmYIOvferyN9qiNsi wKI6J9ydp/JT/CmHcf9wyJaWRZyyew1yt3UjPUN+y9boFydrU9GMer0d51rzuw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715261418; a=rsa-sha256; cv=none; b=bTbjthr87FFCja+pyd1XYu1ocwXBC4XR029LJl3QKz9q29IpUlk5+VULFf4khL9CXadCp2 fOrAIoh48pqUeXuCey5ItrD3gIPDrMGIHyyNIpmZlbvP5PFnUySIrLizm7kxGJZtYP9YTH AAlbQn8TP6bihQifRpb7Wf2/hgsatUT8k6NZ4dGkgCvVpFhab818S1lxg0qtHLneAvYwwM ix+M5Nz0eicPYc4HRRcZSl8HR3kN1ZENtcAxWjBX1Rr2om4XuR7WlTpTCnfIrpcMlg+U8J h4481VLRSfjgSAhZiMQAbFiATd3xsNH1mDVaSkrTFi418pAu1gS+36XY4iiQxA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715261418; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Q7XA620N6YS+hc27enlZXk1LeBqgA3hiMPqeBuzoW1o=; b=NFa2pRLU5l9pq0K6DzYsLfXIWYnKjEZurnBIQwXkxh5bbkxc24GFk4nDqJach7753+nDa0 R72I8EfR7YrgF6CNcCNmwDnOUtdG+BInhPNBwxjA6hiRw0ss1zIkNksjbFuxnfXABeNA4b UwVt6KNDjLu7Br3I3WZD/n7inoCzGPMSGXac448CtVR6pSZSOaAaLBG0n+CotOeCDGya2s xdWZ4elZ50cYr5aH4dDtV11PLr8owREhqGP8ORNohRohw7cyh67vUzizA8w7u6I2o4to6Y T4IIVZQHApJFnMCWoOJ6zA0kTPmTDXS2bloId7xOqFHX0z/uSDGC5HYjNT/7sg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4VZtDV3TfWz19NN; Thu, 9 May 2024 13:30:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 449DUIW0058837; Thu, 9 May 2024 13:30:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 449DUINd058834; Thu, 9 May 2024 13:30:18 GMT (envelope-from git) Date: Thu, 9 May 2024 13:30:18 GMT Message-Id: <202405091330.449DUINd058834@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: b94acafdbcc7 - stable/13 - PP mutexes: unlock: Reset inherited prio regardless of privileges List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b94acafdbcc7b34a57671b76910ec6e397a4e7db Auto-Submitted: auto-generated The branch stable/13 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=b94acafdbcc7b34a57671b76910ec6e397a4e7db commit b94acafdbcc7b34a57671b76910ec6e397a4e7db Author: Olivier Certner AuthorDate: 2024-02-20 13:52:40 +0000 Commit: Olivier Certner CommitDate: 2024-05-09 13:29:11 +0000 PP mutexes: unlock: Reset inherited prio regardless of privileges 'uq_inherited_pri' contains the current priority inherited from Priority Protection mutexes. If -1 is passed through 'm_ceilings[1]', meaning that there are no such mutexes held anymore, this must be reflected into it by setting it to PRI_MAX, regardless of whether the thread has privilege to set realtime priorities (PRI_MAX is also obviously not a realtime priority level). By contrast, it shall not be updated and the computed 'new_inherited_pri' shall stay unused if the thread doesn't have the ability to set a realtime priority, possibly keeping an older such priority acquired previously. Reviewed by: kib Approved by: emaste (mentor) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D43984 (cherry picked from commit 1df8700aa6cff7c759e90f7e507de4b8714435a4) Approved by: emaste (mentor) --- sys/kern/kern_umtx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index 94050beee7dd..5767a137b536 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -2685,7 +2685,8 @@ do_unlock_pp(struct thread *td, struct umutex *m, uint32_t flags, bool rb) struct umtx_q *uq, *uq2; struct umtx_pi *pi; uint32_t id, owner, rceiling; - int error, pri, new_inherited_pri, su; + int error, pri, new_inherited_pri; + bool su; id = td->td_tid; uq = td->td_umtxq; @@ -2740,7 +2741,7 @@ do_unlock_pp(struct thread *td, struct umutex *m, uint32_t flags, bool rb) error = EFAULT; else { mtx_lock(&umtx_lock); - if (su != 0) + if (su || new_inherited_pri == PRI_MAX) uq->uq_inherited_pri = new_inherited_pri; pri = PRI_MAX; TAILQ_FOREACH(pi, &uq->uq_pi_contested, pi_link) {