sufficiently and at least one horrific security hole was the result.
ok deraadt@ beck@
-# $OpenBSD: Makefile.inc,v 1.152 2017/08/13 19:34:12 tedu Exp $
+# $OpenBSD: Makefile.inc,v 1.153 2017/11/28 06:03:41 guenther Exp $
# $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $
# @(#)Makefile.inc 8.1 (Berkeley) 6/17/93
dup.o dup2.o dup3.o \
execve.o \
faccessat.o fchdir.o fchflags.o fchmod.o fchmodat.o fchown.o \
- fchownat.o fhopen.o fhstat.o fhstatfs.o fktrace.o \
+ fchownat.o fhopen.o fhstat.o fhstatfs.o \
flock.o fpathconf.o fstat.o fstatat.o fstatfs.o \
futimens.o futimes.o \
getentropy.o getdents.o getfh.o getfsstat.o \
-.\" $OpenBSD: ktrace.2,v 1.34 2017/10/08 19:21:10 guenther Exp $
+.\" $OpenBSD: ktrace.2,v 1.35 2017/11/28 06:03:41 guenther Exp $
.\" $NetBSD: ktrace.2,v 1.2 1995/02/27 12:33:58 cgd Exp $
.\"
.\" Copyright (c) 1993
.\"
.\" @(#)ktrace.2 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: October 8 2017 $
+.Dd $Mdocdate: November 28 2017 $
.Dt KTRACE 2
.Os
.Sh NAME
-.Nm ktrace ,
-.Nm fktrace
+.Nm ktrace
.Nd process tracing
.Sh SYNOPSIS
.In sys/types.h
.In sys/ktrace.h
.Ft int
.Fn ktrace "const char *tracefile" "int ops" "int trpoints" "pid_t pid"
-.Ft int
-.Fn fktrace "int tracefd" "int ops" "int trpoints" "pid_t pid"
.Sh DESCRIPTION
The
.Fn ktrace
-and
-.Fn fktrace
-functions enable or disable tracing of one or more processes.
+function enables or disables tracing of one or more processes.
Users may only trace their own processes.
Only the superuser can trace setuid or setgid programs.
-These functions are only available on kernels compiled with the
+This function is only available on kernels compiled with the
.Cm KTRACE
option.
.Pp
-For
-.Fn ktrace ,
.Fa tracefile
gives the pathname of the file to be used for tracing.
The file must exist, be writable by the calling process, and
not be a symbolic link.
-For
-.Fn fktrace ,
-an existing file descriptor
-.Fa tracefd
-gives the open file descriptor to which the trace records are written.
If tracing points are being disabled (see
.Dv KTROP_CLEAR
below),
.Rv -std
.Sh ERRORS
.Fn ktrace
-and
-.Fn fktrace
will fail if:
.Bl -tag -width EINVALAA
.It Bq Er EINVAL
.Fa tracefile
points outside the process's allocated address space.
.El
-.Pp
-.Fn fktrace
-will fail if:
-.Bl -tag -width EINVALAA
-.It Bq Er EBADF
-.Fa tracefd
-does not refer to a valid descriptor open for writing.
-.It Bq Er EINVAL
-.Fa tracefd
-refers to a socket, pipe, or kqueue, not a file.
-.El
.Sh SEE ALSO
.Xr kdump 1 ,
.Xr ktrace 1 ,
.Fn ktrace
function call first appeared in
.Bx 4.4 .
-The
-.Fn fktrace
-function first appeared in
-.Nx 1.4 .
-It was added to
-.Ox
-in
-.Ox 6.2 .
-/* $OpenBSD: kern_ktrace.c,v 1.92 2017/08/12 00:03:10 tedu Exp $ */
+/* $OpenBSD: kern_ktrace.c,v 1.93 2017/11/28 06:03:41 guenther Exp $ */
/* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */
/*
return error;
}
-int
-sys_fktrace(struct proc *p, void *v, register_t *retval)
-{
- struct sys_fktrace_args /* {
- syscallarg(int) fd;
- syscallarg(int) ops;
- syscallarg(int) facs;
- syscallarg(pid_t) pid;
- } */ *uap = v;
- struct vnode *vp = NULL;
- int fd = SCARG(uap, fd);
- struct file *fp;
- int error;
-
- if (fd != -1) {
- if ((error = getvnode(p, fd, &fp)) != 0)
- return error;
- vp = fp->f_data;
- vref(vp);
- FRELE(fp, p);
- }
-
- error = doktrace(vp, SCARG(uap, ops), SCARG(uap, facs),
- SCARG(uap, pid), p);
- if (vp != NULL)
- vrele(vp);
-
- return error;
-}
-
int
ktrops(struct proc *curp, struct process *pr, int ops, int facs,
struct vnode *vp, struct ucred *cred)
-; $OpenBSD: syscalls.master,v 1.178 2017/09/25 23:00:33 espie Exp $
+; $OpenBSD: syscalls.master,v 1.179 2017/11/28 06:03:41 guenther Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
111 STD { int sys_sigsuspend(int mask); }
112 STD { int sys_sendsyslog(const char *buf, size_t nbyte, \
int flags); }
-#ifdef KTRACE
-113 STD { int sys_fktrace(int fd, int ops, \
- int facs, pid_t pid); }
-#else
113 UNIMPL fktrace
-#endif
114 OBSOL osendmsg
115 OBSOL vtrace
116 OBSOL t32_gettimeofday