g/J0bh7FX1 mYUFoT6uU8IAI6Gs9R/uq3ipk/Smpe1vyFu4jxec2pKnxGN1Ls4aVHhl6DbMnUh5gsi3ye eUR5upeTBAxqVPt1ByPZTSMeb56fsD9MahWi6N8Ro00SwvCq0Bmr/N2yZbRsqsPeP66YRr TWGhHL+PLy5YansR9WUCr0Nn2FLB5flQo9djNv1pORqSHYuq/qY0zBg9/B0Ya/EOrYRIim ab9Tj3PO6srGq3c+nKlYeYd4aRCySCGMtdU/o0hn+3g2VQjqs6k9vT1kiZ4gZw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gZZqV6BmtzkJK for ; Tue, 09 Jun 2026 16:58:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27c92 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 09 Jun 2026 16:58:30 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 6952ad819d6a - stable/15 - get/setpriority: Add capability mode checks List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 6952ad819d6a7c259ae1f0bd2646a35e4263f0d9 Auto-Submitted: auto-generated Date: Tue, 09 Jun 2026 16:58:30 +0000 Message-Id: <6a284636.27c92.a23e87e@gitrepo.freebsd.org> The branch stable/15 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=6952ad819d6a7c259ae1f0bd2646a35e4263f0d9 commit 6952ad819d6a7c259ae1f0bd2646a35e4263f0d9 Author: Ed Maste AuthorDate: 2026-05-29 20:48:34 +0000 Commit: Ed Maste CommitDate: 2026-06-09 16:57:58 +0000 get/setpriority: Add capability mode checks Reviewed by: oshogbo Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57345 (cherry picked from commit 72e34b3e3907d5fd63abf7b2246cae80641769b3) --- sys/kern/kern_resource.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index dcd38c6e6fbe..5850d2708a11 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -99,6 +100,13 @@ kern_getpriority(struct thread *td, int which, int who) struct pgrp *pg; int error, low; + if (IN_CAPABILITY_MODE(td)) { + if (which != PRIO_PROCESS) + return (ECAPMODE); + if (who != 0 && who != td->td_proc->p_pid) + return (ECAPMODE); + } + error = 0; low = PRIO_MAX + 1; switch (which) { @@ -189,6 +197,14 @@ kern_setpriority(struct thread *td, int which, int who, int prio) int found = 0, error = 0; curp = td->td_proc; + + if (IN_CAPABILITY_MODE(td)) { + if (which != PRIO_PROCESS) + return (ECAPMODE); + if (who != 0 && who != curp->p_pid) + return (ECAPMODE); + } + switch (which) { case PRIO_PROCESS: if (who == 0) {