From nobody Thu May 09 13:26:57 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 4VZt8d4FQcz5Jgpy; Thu, 09 May 2024 13:26:57 +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 4VZt8d3cZsz3wqN; Thu, 9 May 2024 13:26:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715261217; 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=eCCSMI9nqtPVnhsNG4e4gZwYIIQDdp7QlMWCfAB1iOE=; b=Drx4lbRwlOWiekZpL/+8G8E1dHyqibYpAcNV3kPlzi+wf/Q2MhVYQ8ZEkTRB76pz8Mi2Nb GoMm3xatFUWuJWldgIC6AB7FGjGcvniQvr11aqqe3i7scJD+koMv8XwhJqr+a7CKqqO09N dO9UowHRfqpxyxBgrTRuGhtj8vx3qm9MTRp62RodoX12BWIiMnHVZZeCtHZVvKVfXm+/ZA tZQ25nd0kt5YnxqnajlKtQ2aMNp83U+FWIR9QpR4JrgTZeCNQbJlqtVavE6B6k9WGHnCix Hr75AuEt5zr4aF8VWyvzCy+ZibliAoCN0mObknzrquNqd7QOelKW0JVCe8rkKQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715261217; a=rsa-sha256; cv=none; b=CTGrCwgApJNb+cUBfVqrOZVn7DQ17CCitdT/pVcMBXS+hQzCsiu3If+QsOdT3O3PG8XT3N kB2oEK2S5qZ8hGdZUiERrrWg6wWUPI3tnKxcnpmXkcocBlLX2oTztglj8IRkvZJje6H77J QZqDGQ4d5BbK9UTCmTijctJl0Lc3b7QnxGTJaAuPFMa+3mwnxkRnx6Isqq3497Fmz8LL9n k5O3djQtnLlYS0421E0HBsxJdgnK/XPoOHtkisUSsnWicHCnb2R9yi04h0pGswTUyBR7E2 9wqLoGnwAKowKSqsOo8vIJLg2ByKiX/ggJv2ZuKVSbestDjIZErddDEP0bUm3A== 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=1715261217; 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=eCCSMI9nqtPVnhsNG4e4gZwYIIQDdp7QlMWCfAB1iOE=; b=OWfyBfDXT4mXaellMN9lywxGPHVIdUZ86MbAAxNELPbYAo9gGI5S+GFvWWo6E7aVgZ5zvE gZvHqyVt3uhoSXyUR1PLH6qdVSr/kscXZ+Rj4b4ryzmkDcJ396wwHTORV48Q6WbgzDcat+ 7npQ73kecS47taHF1/UOrwLyI3+qqhrG+T3uFa+UCpcISbgbrKa5qqaOzlC/fH3WZEruqb vmRM2MhPRuPUeeQK1kOerj56PFugzOAOyR9T0Lb7m8URt6DlHCWvv1xWpkd2UrT4H5URIz HbSfwUBPn4u5Q3g/kfLXIzIh9TdGPxX2RSBYEQkelo/XU+UgGLBoT9SWP2wqCQ== 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 4VZt8d30NFz19Xc; Thu, 9 May 2024 13:26:57 +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 449DQvEu049539; Thu, 9 May 2024 13:26:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 449DQvF0049536; Thu, 9 May 2024 13:26:57 GMT (envelope-from git) Date: Thu, 9 May 2024 13:26:57 GMT Message-Id: <202405091326.449DQvF0049536@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: eded8fea5c3a - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: eded8fea5c3a7ef7aafb5755c523a40dd7fce20e Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=eded8fea5c3a7ef7aafb5755c523a40dd7fce20e commit eded8fea5c3a7ef7aafb5755c523a40dd7fce20e Author: Olivier Certner AuthorDate: 2024-02-20 13:52:40 +0000 Commit: Olivier Certner CommitDate: 2024-05-09 13:26:16 +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 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) {