From nobody Fri Oct 30 14:08:11 2026 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 4jGNGz54dyz6wwPZ for ; Fri, 30 Oct 2026 14:08:11 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jGNGz0wsdz4qby for ; Fri, 30 Oct 2026 14:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793369291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1ansQ8TenFq+EWPLaqo2WTsiEsJs6F/NuKuiJNLyHp4=; b=OuEiTU32JawGC+dEawf7hz0asJh9ldNylQeSVDuW79GiKWJCGQHZmkY8ijbjXXRAxLUUYF kAHCiHc8VgkYxdNjvg/0YcquxabVZNZjdGS8ZmE5rKukeSFNRiASqQXhI4RqJ/u0WVAayJ ig83yTPKKajNAy9ioncz2CvVwnKgSprW6HIWZ+wommG4EZuNChMOYO9MYbuFyO+5XW5rPs EGcpPnZCQ5dPzbMkh9vTj7F4uTyoS2Vsv8j8ITzLyiuxmsUD/Pd7l3uVYSz5T7mw32OfSp A4pyzBpl6Br/I5kx3spj4WgJtCBcfHz79R3zKx8doKqcyCzkbOVZfbUCmPgwGg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793369291; b=kwb05FBB9ZKKT/WwBqMBh5T/jX0g+iOu2Qbz99UcImhKgmcCKMgGsfSRJWsQVKNoc0xEGQ oBeLSN2YB6X09BjWG0LO1Bj7wSm9ToNqRZBZYFHlQRC2mXL8QwHfmAwpDSDIaxBGR/zrA2 4hAj9YgmqgcnHQK2o5GTrzFjhCaWSFkG87MkqMgjRLvb1MVkt3q8bjqrN90HulZ0C7ZjSh chPIfM0ObSfLGnfq3mMN4SYWjbRIMAeBrAU+gPMeqe17/fl0r531VgEj517BfDX+cLbAR8 2/G93FFaHGG1tlOJUaCFimoT7Gx1hAhd7j+bLbgcVuBHRye4uiOG64waflMexA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793369291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1ansQ8TenFq+EWPLaqo2WTsiEsJs6F/NuKuiJNLyHp4=; b=HWkl8M++0m6AsD6XbP0uvlg7nbf8W0ITmSIvf3GvvrQph7ODEHMrQFabGLlpOENjDayb5l EugPhU9/BOnWYvq/ykA539Uy6VRNyF+v31gKls2f+wgn/yORxFuO573FLDpIkUW8VE7hx+ /n7AadedloBX0oAZ/xlDWa0aBPES6ICFlpX1apgm/Ejk+ckzk4woPAKY/r2kCzFfYS0RcO Xtlw3OLCE2QqFkrmK2OmT2zM1d4XcfUJUjMTzscqLWMQrJuVXelhI4y5aYV45B3LAjGy6d ovDMZwOJcrXm6Fj9t1OEdA8XENw8eHhOEuYWv+CFqrKVwZ70I9GG85htfjP0QQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jGNGz0K57zV4t for ; Fri, 30 Oct 2026 14:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2240c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 30 Oct 2026 14:08:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Avinash Duduskar From: Kristof Provost Subject: git: 3d5bd2cf202c - main - authpf: deny tracing of the pfctl child List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d5bd2cf202cce4c98e227d8eacc4bb6f937477a Auto-Submitted: auto-generated Date: Fri, 30 Oct 2026 14:08:11 +0000 Message-Id: <6ae4a4cb.2240c.22b32528@gitrepo.freebsd.org> The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3d5bd2cf202cce4c98e227d8eacc4bb6f937477a commit 3d5bd2cf202cce4c98e227d8eacc4bb6f937477a Author: Avinash Duduskar AuthorDate: 2026-10-28 10:22:17 +0000 Commit: Kristof Provost CommitDate: 2026-10-30 14:07:19 +0000 authpf: deny tracing of the pfctl child The child runs pfctl as the user with authpf's root-opened /dev/pf and Netlink descriptors. Its real and effective ids match at the exec, so the kernel clears P_SUGID and any other process of the user could attach to it and take both descriptors. Deny tracing across the exec; root can still attach, and core dumps are not affected. PR: 291981 Signed-off-by: Avinash Duduskar Reviewed by: kp Pull Request: https://github.com/freebsd/freebsd-src/pull/2508 --- contrib/pf/authpf/authpf.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/contrib/pf/authpf/authpf.c b/contrib/pf/authpf/authpf.c index 35e3a865bd51..0a76128969e2 100644 --- a/contrib/pf/authpf/authpf.c +++ b/contrib/pf/authpf/authpf.c @@ -19,6 +19,9 @@ #include #include #include +#ifdef __FreeBSD__ +#include +#endif #include #include #include @@ -752,6 +755,9 @@ change_filter(int add, const char *l_user, const char *ip_src) pid_t pid; gid_t gid; int s; +#ifdef __FreeBSD__ + int tc = PROC_TRACE_CTL_DISABLE_EXEC; +#endif if (add) { struct stat sb; @@ -815,6 +821,14 @@ change_filter(int add, const char *l_user, const char *ip_src) fcntl(pfctl_nl_fd(pfh), F_SETFD, 0) == -1) { err(1, "fcntl"); } +#ifdef __FreeBSD__ + /* + * The exec clears P_SUGID, so the user could attach to + * pfctl and take the root-opened descriptors. + */ + if (procctl(P_PID, getpid(), PROC_TRACE_CTL, &tc) == -1) + err(1, "procctl"); +#endif execvp(PATH_PFCTL, pargv); warn("exec of %s failed", PATH_PFCTL); _exit(1);