From nobody Tue Jun 09 16:58:30 2026 X-Original-To: dev-commits-src-branches@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 4gZZqW0GP3z6gGsr for ; Tue, 09 Jun 2026 16:58:31 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gZZqV6rhWz4L3w for ; Tue, 09 Jun 2026 16:58:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781024311; 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=mTwaRB4CnkNrRsU6djxBBZ4NxhNkK+UaZTb3MkT878s=; b=bi/lLyD1nbbDdlYMNy4bFqmRz4f/P+fxlwsI0mOq3neEhxDPpmnyMlUF+KDCXPJkiKsbwZ FgVe3VCkWKd/epdcyhNh1UEMDIrfGgE+S9GFZHiY83JKtLp3YNPYFnVKcP4ExbpPa64an1 TdoN5fBcHsVRlXYkObgNgxKfheOQxWVKPHItXX41JS2tgT/m3V2AtyNZHEVINQkofA0pV2 pqkwX3r6UIncDGXhoQfD+kV1krjMd4mKBCvodMqVJZYtxOT4B3SvVbgnI78wCRuoDYB9VQ vrpW8Sces7r/wsZYEow3Gan4twi77QaSYA0MFUWu87W654ezmXlPseYYL3gvEw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781024311; a=rsa-sha256; cv=none; b=pR//MV6H8nCOENqwNF7LKqJJegfOzJyRJ1ndil4HKvisa2RLjFPUQV91TFJPJS7J+dy+xA 75+dnJQmBs+n7RcYIFtSYplZw5rlIBesJXJJJuiQNGJ6mH8Dnp37A+D3qkrcUhMDXAJyO8 yIjtyM7Kp8dAW4nB9U7V6ySteviZo8pTS7Txvu+rBM6eBhFWL/pTj7dDsw+muEucxmhwJQ L3zMuAAzaTMPvPNWXEYIYltnv0hfTbGJ6hFV5+H/DBfPFXwplAMiM+Dxra9Q1iv+cFU12u DxQi7OOZhjPQkMrEiMOy85/KNper8fsUnhgoPPqfysx9kyb/2gg4jPQaE7/pEQ== 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=1781024311; 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=mTwaRB4CnkNrRsU6djxBBZ4NxhNkK+UaZTb3MkT878s=; b=iRchC7m2yttbHUsrw/0A6XZ5ZCMzrx5qYKI1+DOf1Y31FK5ks7ycv7kpH5iFg/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) {