From nobody Tue May 14 13:39:23 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 4VdyBg5m75z5K7BD; Tue, 14 May 2024 13:39:23 +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 4VdyBg593tz4PGl; Tue, 14 May 2024 13:39:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715693963; 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=gavHeeCl9lR1Fgn5S6CHp1biaAdm1ZhuYfI5HogsSIE=; b=SIDbzCjTbq70xemDYEsi2RnsOGAQSrBzNkGfcwbFhONpUpL5truE7+bm697aoKl1vLO0eE cywuj8zVv8MM1kxHxaU099h1qHlT8Ium+ZsEhIZND9pig8ACssmyx0sTtLqhdeu65NRCMw yCQufZBu89vwgkLjSWV94EVAEmOJW5pSDab+0+FfImhE1QvmOzoaXeTr2p8RymGceuSL+I p7/5B9MJX0nFFcQ9kFF3lmPHYOjndk5xtpPRacmBzlnFNOGRA6wjO58smAWCpC/4QVZuoZ 9ahsaqopEcvdsai0QphiA33kwu/XSUcdlrbIy4D+GXom6Sn0NPkuwb2y05TwBQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715693963; a=rsa-sha256; cv=none; b=JOYmbkHEmOEfiFgUA56nq7RrePu/v4sHCot0XtIsETDy8qBWKpBSN0mpwBtxQa0MBmLH1E pzoOqujkGfzswyeRLWJ9vxiID0M1xrXen7jzXof4MqH35uSGCb1hm3D3m1JJoLHGogCPTv hBHBkaQs3Ihq5lMAuWiUWBCmfVd66PbLIBDGmXafUY7VraZBTGbwPKdg08DjxTkBh/R0MX Gz0yOBd1W4E4m1xEZSr8EDWwt/4RLwNolcYI6o2ErL/pfeTBS8CQuY3Q8I6Mhx0/haumjo ud5S09Y33pb2KQ8GSt5kY17ikhy9pzvmRefruPeQZgtGihIeOI5qdB0NPEAUjw== 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=1715693963; 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=gavHeeCl9lR1Fgn5S6CHp1biaAdm1ZhuYfI5HogsSIE=; b=F6y9EOEibbnz3R8UyLcAXC9vCutkIeGxh5+JmlY57xkha0RJvT+nOumOpOhjYvdn8KJm5q kMdgx56geXke5aVsJGPLSisC1hOkDcKkbCQbUvVaeOA+QWUttEVLHNz84VRoSRVEWgbc6/ olh9TV/cETk5VVyPrUk0W4kQev3rznhjCrw+FoOYx9K/q2hkFHeVMFnyvkBwHiwmIOfV8h 4rej3lwSU/esUHdBPyxM9YfYOIsI91LOiqgd3acExPFNVIhZYs+//N9WZwHk7CYS0ASnJn l8RLHunkOj3B7dqyq19ksRVdj5k/A/kpVz901tyYWZa+dEbIc5K5U5BUpLcOCQ== 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 4VdyBg4jYyzZ99; Tue, 14 May 2024 13:39:23 +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 44EDdN3P080386; Tue, 14 May 2024 13:39:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44EDdN9P080383; Tue, 14 May 2024 13:39:23 GMT (envelope-from git) Date: Tue, 14 May 2024 13:39:23 GMT Message-Id: <202405141339.44EDdN9P080383@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: 21284ecd1e65 - releng/14.1 - 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/releng/14.1 X-Git-Reftype: branch X-Git-Commit: 21284ecd1e65fcc6c2e418b45d68f2e23e1e67f5 Auto-Submitted: auto-generated The branch releng/14.1 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=21284ecd1e65fcc6c2e418b45d68f2e23e1e67f5 commit 21284ecd1e65fcc6c2e418b45d68f2e23e1e67f5 Author: Olivier Certner AuthorDate: 2024-02-20 13:52:40 +0000 Commit: Olivier Certner CommitDate: 2024-05-14 13:36:38 +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) (cherry picked from commit eded8fea5c3a7ef7aafb5755c523a40dd7fce20e) Approved by: emaste (mentor) Approved by: re (cperciva) --- 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 57ff74f5421e..9c7225863bb1 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -2684,7 +2684,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; @@ -2739,7 +2740,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) {