From nobody Sat Nov 19 19:11:39 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 4NF3DC45scz4hgk0; Sat, 19 Nov 2022 19:11:39 +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 4NF3DC3Htgz4HHD; Sat, 19 Nov 2022 19:11:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668885099; 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=xkopAbBTnHhVvHrMJ1w6GJDkSGG2EkJMbKLAE4vRnCI=; b=DJBvIiURP/MLtvsrSXAWWHSKnzkG+Suqp2X3ZUWYCSzaSA6N7Xh6YcM/93t5VwSCQw1Ekd b1CSDUG2rV7J2+ubZFtmqIBnvN5iXWYLwFHkniTIK1Pd7iwo5WiRqUIwE07XCFKShy4Sr9 qTy19IdecLAvXBeEobYeLUjcQ12odNxNhM52f3S1PzP/J8dJhprPvvL3F0c136WuspdDF4 FFyvsh7E5EBvtj0AkVa7xJ1pBlSx3FwWyZoj4xauFox5d1ALa6BgLmJdVeJvYuIO5HF3IU Wpgf8bNXx+HiXnw8IMDYiAvkLdoHZNMzUyj4jpPxaMuXUsEANK6hinkEHPisaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668885099; 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=xkopAbBTnHhVvHrMJ1w6GJDkSGG2EkJMbKLAE4vRnCI=; b=WtEIVR9oxQyBcGNNuES/30xrHYxesmHxF3KPkt5sfhhywY71Lw3TXpAI7aHpp+3rB+YCrW jR/XbdeCSHdgLREJiatlVJcL5O73sBfT7IkcIo8QzGUkDzE8xaO9fupu2fa4v2SE4RtOSN YA88YTTcwtLlCsrd+T4eNmoSueqmkKFYvJ+TapotGeMchdBcIVPt3KAu0S2TTUOVCS4Ytz HE1MB9sg65uvlwehFgXRTYe4ge/j6wXnSG2D7qIm7tn9JNUfJKiHCdyoE8o/TlUUgfacAf wCDH9S/BZOsf7CMLikfoaNJuMhVv+uPJIKm+Vytn7zeYpP3TWIOcAugMeJEQJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668885099; a=rsa-sha256; cv=none; b=pp21ClcL9pS4R8Ip4SyZMI2/P+0D6gw/VX1cHdxJ4ppGo3Pv3SZlpZq3IDrqkhVaMP9x/w 7CJalKAzQh0VlY+cGvxKDD6j0DU+IfpaQL3vlfGePlI7LssEMumpyH8wQiU3dtUNygQ20J kuotGl4C4CLtIYt7CUPsYwrg0qed3ZHRePnipRg1du7XhSQQoPHhwhqlKwWU7ifsPtZYEU XK0WGO4ezcJtOhSyGkgM3WygKPDiLb25PjarybEczmPekINsO5nD7wU0Bs8tS+VTf4AEv1 5kWDuD6YIQ/KdpJ8pkNd8Gp8NadXJyOGMdVhm4yWWxSLtvA2qO1A2AJI/3bqYA== 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 4NF3DC2P7Gzwjb; Sat, 19 Nov 2022 19:11:39 +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 2AJJBdCZ052757; Sat, 19 Nov 2022 19:11:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AJJBdJt052756; Sat, 19 Nov 2022 19:11:39 GMT (envelope-from git) Date: Sat, 19 Nov 2022 19:11:39 GMT Message-Id: <202211191911.2AJJBdJt052756@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: b53f847c9ed2 - stable/13 - sshd: sync tracing disable with upstream 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b53f847c9ed25c8101a18a5a1b1f4f6a75df1a31 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b53f847c9ed25c8101a18a5a1b1f4f6a75df1a31 commit b53f847c9ed25c8101a18a5a1b1f4f6a75df1a31 Author: Ed Maste AuthorDate: 2022-11-07 17:17:15 +0000 Commit: Ed Maste CommitDate: 2022-11-19 19:10:48 +0000 sshd: sync tracing disable with upstream Old versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. Although this is not required in current FreeBSD branches I am merging it to reduce differences with upstream. Obtained from: OpenSSH commit 0f7e1eba5525 (cherry picked from commit 4232f36eda60406642fc6cfef605b6d38fc0a7c0) (cherry picked from commit 733bf3b108f8b69295778bab5f7d680b9a8e6dba) --- crypto/openssh/platform-tracing.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crypto/openssh/platform-tracing.c b/crypto/openssh/platform-tracing.c index c2810f2d0b36..650c7e59fa50 100644 --- a/crypto/openssh/platform-tracing.c +++ b/crypto/openssh/platform-tracing.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "log.h" @@ -42,7 +43,16 @@ platform_disable_tracing(int strict) /* On FreeBSD, we should make this process untraceable */ int disable_trace = PROC_TRACE_CTL_DISABLE; - if (procctl(P_PID, 0, PROC_TRACE_CTL, &disable_trace) && strict) + /* + * On FreeBSD, we should make this process untraceable. + * pid=0 means "this process" but some older kernels do not + * understand that so retry with our own pid before failing. + */ + if (procctl(P_PID, 0, PROC_TRACE_CTL, &disable_trace) == 0) + return; + if (procctl(P_PID, getpid(), PROC_TRACE_CTL, &disable_trace) == 0) + return; + if (strict) fatal("unable to make the process untraceable: %s", strerror(errno)); #endif