aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssh
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2022-01-20 18:41:39 +0000
committerEd Maste <emaste@FreeBSD.org>2022-01-21 00:54:49 +0000
commit0746301c4995d9e4a82b0e5034b62e310694d1ef (patch)
treee23e7e3b6bfa584e150edc1b89fdce2caa9aebb1 /crypto/openssh
parent19eaa01beaba68ed4c70c44127955f5c9b331cb9 (diff)
downloadsrc-0746301c4995d9e4a82b0e5034b62e310694d1ef.tar.gz
src-0746301c4995d9e4a82b0e5034b62e310694d1ef.zip
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
Diffstat (limited to 'crypto/openssh')
-rw-r--r--crypto/openssh/platform-tracing.c2
1 files changed, 1 insertions, 1 deletions
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)