Date: Sat, 19 Nov 2022 19:11:39 GMT From: Ed Maste <emaste@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: b53f847c9ed2 - stable/13 - sshd: sync tracing disable with upstream Message-ID: <202211191911.2AJJBdJt052756@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b53f847c9ed25c8101a18a5a1b1f4f6a75df1a31 commit b53f847c9ed25c8101a18a5a1b1f4f6a75df1a31 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2022-11-07 17:17:15 +0000 Commit: Ed Maste <emaste@FreeBSD.org> 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 <stdarg.h> #include <stdio.h> #include <string.h> +#include <unistd.h> #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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202211191911.2AJJBdJt052756>