From nobody Mon Nov 07 17:23:40 2022 X-Original-To: dev-commits-src-main@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 4N5dP85ck6z4hSbk; Mon, 7 Nov 2022 17:23:40 +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 4N5dP84RPRz4LD7; Mon, 7 Nov 2022 17:23:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667841820; 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=CBXT3+dgd8JHZ6+FXY5MU+tfDAiBB/q9GsoGmgAZdac=; b=ZaNFlkQlYNZ+b47WIwe/5DYLofRpxXhISX9M7AuUorxZ3q44GWA+AYig0LskpNNn2SqwP3 G198ZhUqUhfVeWf0ftjdNgU3hRmik5esCY42V5StNJcPf6R1irAPjMUcNdDyj2hzakCoZJ AoiQqC33KrDck9uGfLHwqg9QVN45jYG+7YoWTQ13IrbXWSjY8dYbl2jP0l2tnTE60clm/7 aaAAfcEE7yvVHz+MYkEsHIqkQLqtSH93Olz55ZZixrN8MetSnoAcgcQZJdO1tIqgCAg71R oJ/B07eBu6bjztYSJDyvbj11lCw+efMvT4TpTDlwS0m8qm6OwkmDQ7PAL9FqIw== 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 4N5dP83WtTz18Jh; Mon, 7 Nov 2022 17:23:40 +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 2A7HNeat008154; Mon, 7 Nov 2022 17:23:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A7HNemK008153; Mon, 7 Nov 2022 17:23:40 GMT (envelope-from git) Date: Mon, 7 Nov 2022 17:23:40 GMT Message-Id: <202211071723.2A7HNemK008153@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: 4232f36eda60 - main - sshd: sync tracing disable with upstream List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 4232f36eda60406642fc6cfef605b6d38fc0a7c0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667841820; 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=CBXT3+dgd8JHZ6+FXY5MU+tfDAiBB/q9GsoGmgAZdac=; b=FaxaO6qJa09nSTrzZyMRuetm6rNcXoLEJCO/K3wW7XusJUhkYoGlnT3fr+T1J7XKnBdkMj gj05/cI+rcUxjIVnyoS+KRSPFEMOdCvc50BCeJDVyw48ZIbrDhEO/ZCssYdOAmpPch0siE HGlVrO+kOjYc2RhL5NORFxySa7AFNIlUfoYXbSlMoPRUzqbbYrRJkaiMBlfHGoNm0l6G1p IPbxHBTwRP4oP1MdYTgA07skke01lPaDVaBZhiU2RTKEJ1+seLcaqvXU3OSqm6Uw1zucZr 7rBxfmN1fzZuJrt5qw4Akd1IyTGQVdBH9rdZ8Ug6URYb5X9xpcUNhFzpCJw3Dg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667841820; a=rsa-sha256; cv=none; b=mUdt5wPY8huvqRBfin0q2WSTTn4uH9a+jkWngxhAS2jF/TnqNsUZGgDlhssbzFKVASfPHP Gd5sgFfXIcb2M8T9kwf8f7TKOd46VA6VZUhu9eJ0WliWGoPr/NHx4+z5LcgodLDFTRt5BL KRooJfCGsVzG75e1tnC6PsTjCCM4VArvq2s70kbe5uSlKZ6SL03QcXNb9EyRQLr+UJSdNJ VzQq3cH8lKfAFYgFL+EoSU8jEquy7OpslVQt7sKV2bUE+kUkiz0MGMQ5ndevSmGvEG3Un5 BWQqdieLW9Kz2oCeuPv2dQkLDtM3/ukWutj6jpnkeCRzjxiXDuTp6lOyanOuIA== 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=4232f36eda60406642fc6cfef605b6d38fc0a7c0 commit 4232f36eda60406642fc6cfef605b6d38fc0a7c0 Author: Ed Maste AuthorDate: 2022-11-07 17:17:15 +0000 Commit: Ed Maste CommitDate: 2022-11-07 17:23:00 +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 --- 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..80488bf70104 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" and 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