From nobody Tue Feb 27 09:00:16 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 4TkWf83VLQz5Cmkv; Tue, 27 Feb 2024 09:00:16 +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 4TkWf82mDqz4h6n; Tue, 27 Feb 2024 09:00:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709024416; 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=2iTtPBNbJ9q8BSLFGWz22GvlwuHt86rS+0b6ukH5ET0=; b=Zwq3LjOxfoGZfdLqN52BhKHzwVM2z7A07QJnPLk/AgL0Wvf8ED9geCQMQv75r+qYD70BH0 0MKWeUB8Dnuv+tr2maaOVCstZxzesuFWKU+D/8Rxbj6GvyBXrr0lUGCZb+lEvXNFA3Ncr8 sd5sU6I855KfY6xGYuhsqAQm7BGwx0CawoJyfFHl0uNEoZURy1EuWqArVwgBmiYy2e+JBJ aBTHybSEnCeB3+uy4dMMtEdebyXL2SgWQS653DHDudKv4cTqzQVKWffUBDl7035KsG4uaY Fn7o2gmCARXZX+gK39O1HlvP0CyHV098KZR8mKKXXrmGCwGX6i2rmqcJSOwMog== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709024416; a=rsa-sha256; cv=none; b=HiJEdPvk+Z9qwPtxU0kyZeDpiGC7OLrEwButY5gn2/Bz8emlnPdzousbaGACMlsX1Mc4yM hQvhbSpDpYwT73wlYmzqrbpsJvvMYnqwe26u1RKovWf/t2tloTlIaD0hPkKqFnuzzmkmEq LMHwJL/rd2hruv0v33ZcuPPUwCeAC0U2gnozVm6UnE5e02bV0JsdcDlWZK9mdvMH8PH9B7 1VJ06noGI6rJLKO/hr8FTWh9d1EPDFwzaIFRO+2Hpo9eL1UXDiamzUPPSFRh+b2Gxx1sbV zckhETX6tnr9izZNftlyZWY0NOladIvRnJsq7iFg62Lf83QbqrJb2MELQtqMXg== 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=1709024416; 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=2iTtPBNbJ9q8BSLFGWz22GvlwuHt86rS+0b6ukH5ET0=; b=JwUHvbskCDl1r+HDIGik0Hnh6MHTV9g5MmymnpzGKcPZJU0GkZpq2A4niM8qG0iba/paKo xvriYmR4H7KMfMCwa1tU10SP8luRmy5k/RBd7PO9v5uhH/n8M/MMjwD2DYt/tQyFEE7CFj KAQaOpcQQGdDMrSxDgK6OAR72mCUbW/eDtlFcZyQfi35Oumovnbzd0e0lKPfFiFQa9Jdbh +l+howgMrh1Tsp4FP+BBHW2rXOrLvNLAG5PVavb/i5T6SJPMdooGF7c+ESdjicb0g3aP4j 2A6RBpVO52XUt7x5jw7E6oQ77F9XBZ6D7kZu7XIW50lJrCAIlgk1hM1YRAmAOw== 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 4TkWf81rW7z15D4; Tue, 27 Feb 2024 09:00:16 +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 41R90GVh003365; Tue, 27 Feb 2024 09:00:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41R90GNe003356; Tue, 27 Feb 2024 09:00:16 GMT (envelope-from git) Date: Tue, 27 Feb 2024 09:00:16 GMT Message-Id: <202402270900.41R90GNe003356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 1df8700aa6cf - main - 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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/main X-Git-Reftype: branch X-Git-Commit: 1df8700aa6cff7c759e90f7e507de4b8714435a4 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=1df8700aa6cff7c759e90f7e507de4b8714435a4 commit 1df8700aa6cff7c759e90f7e507de4b8714435a4 Author: Olivier Certner AuthorDate: 2024-02-20 13:52:40 +0000 Commit: Olivier Certner CommitDate: 2024-02-27 08:59:20 +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 --- 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) {