Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Jun 2024 07:29:16 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 279566] procctl not working as expected.
Message-ID:  <bug-279566-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D279566

            Bug ID: 279566
           Summary: procctl not working as expected.
           Product: Base System
           Version: 13.2-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: wzis@hotmail.com

the procctl for PROC_TRACE_CTL is not working on my FreeBSD 13.1.
[root@bsd123 ~]# uname -a
FreeBSD bsd123 13.1-RELEASE-p9 FreeBSD 13.1-RELEASE-p9 GENERIC amd64
[root@bsd123 ~]# cat dt.c
#include <stdlib.h>
#include <sys/types.h>
#include <sys/procctl.h>
#include <unistd.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
    int trace_flag =3D PROC_TRACE_CTL_DISABLE;
    pid_t pid;

    if (argc !=3D 2) {
        printf("Usage: %s <pid>\n", argv[0]);
        return 1;
    }

    pid =3D atoi(argv[1]);

    if (procctl(P_PID, pid, PROC_TRACE_CTL, &trace_flag) =3D=3D -1) {
        perror("procctl");
        return 1;
    }

    printf("Tracing disabled for process %d\n", pid);

    return 0;
}
[root@bsd123 ~]# cc -o dt dt.c
[root@bsd123 ~]# ./dt 868
Tracing disabled for process 868
[root@bsd123 ~]# truss -p 868

As above showing, though the procctl didn't error out, but after "disable" =
the
tracing, the "truss -p PID" still can attach to the process.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-279566-227>