From nobody Fri Jan 21 00:56:00 2022 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 0D02E196AD1C; Fri, 21 Jan 2022 00:56:01 +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 4Jg1CN534nz3k2Q; Fri, 21 Jan 2022 00:56:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642726561; 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=5Qu/DHeNpAXyHs51SQHG2KaETGKfgedU1MiQ6TpVDaE=; b=iWNNBwCY5HdUwYBf4LE0i7cCU2ASdIyIJaVxpDDVZrgEoVoR69ZaGwvYHxXrt8sxzuQR7L DBg+GE16SmdXMtVVZ6rc8960rMidCJVLNWBn1sRDMYD3VmZGFyOHmkBVTdIbIUjb7CKt4V 74fpyXx0aljFunbbawt5mmqMscS9yrBySl/11fKlme+qaCsu73AdH/28X6be5jvFZC7R0u rEGgjp9NsqDevM1850/j+ewR/PSqpG8kT/Q6IpAgk/E9ycHgFtdyu93O04YoO25wQSf25p hHLJj42PqBB7aItsCpeafzvbTxnuuEsiTQAlpSNdjSm+xrNuD1hGaA5YpAkVpA== 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 7B69D12A92; Fri, 21 Jan 2022 00:56:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20L0u0Rq080623; Fri, 21 Jan 2022 00:56:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20L0u0bZ080622; Fri, 21 Jan 2022 00:56:00 GMT (envelope-from git) Date: Fri, 21 Jan 2022 00:56:00 GMT Message-Id: <202201210056.20L0u0bZ080622@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 0746301c4995 - main - ssh: pass 0 to procctl(2) to operate on self 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0746301c4995d9e4a82b0e5034b62e310694d1ef Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642726560; 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=5Qu/DHeNpAXyHs51SQHG2KaETGKfgedU1MiQ6TpVDaE=; b=hOhhD8kWz7bR4LQJEnn+xUmm7ZENAP8SD+PRdc3qi1EsgVpft8T5IJ3PgBhOdpVSFUv7EW FTyN7Dzpz9/57qgZnbaPb34RZRqOxFH/Twj2wZPAHyNXqHDymw/fOQrunkao9azA2BoQBi deJrN+maSvr3o3HHHTnKoGlvQmCtjozH/ft7jeguSGtFm3B1Xqe6I+rOzJh27vHdpZA2RQ 2bcoAGwZayiD3i10+KjaQ8ypdIITcbXdvtMVQzf/tfZcVs0I6Ezjbxb+XzwIjTV1ita9Oh F1t8vaqZPa2kkFCOgb9+NrkGRXvbsUf6U/tkDmFhfbk05EiPzVWmyJ/vBODhbw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642726560; a=rsa-sha256; cv=none; b=T/YhyLIwGHDhCs/P/Ptbi/v9i3uS8tUksw3TR8U0y9pyI/G+mIso9a2wiLC1EJaZ1LwzKI PhWHU+ZCoj+nFdo1Tfl02h2WcGY2DDJqDXBJvdlOBYBmnVX998+sly01QIXzSMSeanYCyx oWYZseTufhqBrmG8Cw5gJA/S4EsTkVOa5XQly9Hh4UX3cjJ389xuXxhWkGMa2JOJmDkrXi JXZPNcJmAvDRQje2XcZqTELe5ZeQNOh+ft5BSzRpUaIHoSeUpWdJrgbE5HsmHA9YtUVxU2 gSNdq+65NawPgi68GWNXWXX2G2WGKJee5N0RSP9i2t8BvcXVuvAPPc6B0PRLCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=0746301c4995d9e4a82b0e5034b62e310694d1ef commit 0746301c4995d9e4a82b0e5034b62e310694d1ef Author: Ed Maste AuthorDate: 2022-01-20 18:41:39 +0000 Commit: Ed Maste CommitDate: 2022-01-21 00:54:49 +0000 ssh: pass 0 to procctl(2) to operate on self As of f833ab9dd187 procctl(2) allows idtype P_PID with id = 0 as a shortcut for the calling process ID. The shortcut also bypasses the p_cansee / p_candebug test (since the process is able to act on itself.) At present if the security.bsd.unprivileged_proc_debug sysctl is 0 then procctl(P_PID, getpid(), ... for a process to act on itself will fail, but procctl(P_PID, 0, ... will succeed. This should likely be addressed with a kernel change. In any case the id = 0 shortcut is a tiny optimization for a process to act on itself and allows the self-procctl to succeed, so use it in ssh. Reported by: Shawn Webb Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33970 --- crypto/openssh/platform-tracing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/openssh/platform-tracing.c b/crypto/openssh/platform-tracing.c index 740a266b9432..e00f015fb01e 100644 --- a/crypto/openssh/platform-tracing.c +++ b/crypto/openssh/platform-tracing.c @@ -41,7 +41,7 @@ platform_disable_tracing(int strict) /* On FreeBSD, we should make this process untraceable */ int disable_trace = PROC_TRACE_CTL_DISABLE; - if (procctl(P_PID, getpid(), PROC_TRACE_CTL, &disable_trace) && strict) + if (procctl(P_PID, 0, PROC_TRACE_CTL, &disable_trace) && strict) fatal("unable to make the process untraceable"); #endif #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)