Disable tracing on FreeBSD using procctl. (OpenSSH Portable 8.8)
Ed Maste
emaste at freebsd.org
Sun Nov 6 05:31:10 AEDT 2022
On Tue, 19 Oct 2021 at 13:40, Ed Maste <emaste at freebsd.org> wrote:
>
> On Fri, 15 Oct 2021 at 13:07, Bryan Drewery <bdrewery at freebsd.org> wrote:
> >
> > I think the tests may need to be improved as pid==0 represents a pseudo
> > kernel process.
>
> This is being fixed, but for compatibility with existing versions
> getpid() should indeed be used.
This fix is still outstanding:
Fix tracing disable on FreeBSD
Some versions of FreeBSD do not support using id 0 to refer to the
current pid for procctl, so pass getpid() explicitly.
--- a/platform-tracing.c
+++ b/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,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, 0, PROC_TRACE_CTL, &disable_trace) && strict)
+ if (procctl(P_PID, getpid(), PROC_TRACE_CTL, &disable_trace) && strict)
fatal("unable to make the process untraceable: %s",
strerror(errno));
#endif
More information about the openssh-unix-dev
mailing list