This is a NOP.
The COMPAT_IA32 was renamed in r205014 to COMPAT_FREEBSD32 and
COMPAT_ARCH32 does not seem to have existed. Also remove some
leftovers from the sysent rework in r301404. Include
freebsd32_util.h for the freebsd32_sysent prototype.
X-MFC-With: r301404
Reported by: kib
MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
PowerPC64 has two different ABIs, neither of which is elf64_freebsd_sysvec.
Using sysent and freebsd32_sysent achieves the same effect.
X-MFC-With: r301130
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
This also prevents tracing to a P_INEXEC process since it could race
with other processes attaching to it in filemon_event_process_exec() due
to the filemon_get_proc() race of incrementing ref and then locking the
filemon. With the no-P_INEXEC invariant in place the p_filemon may only
be the same or NULL when trying to drop it in
filemon_event_process_exec().
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6545
This will be more accurate as the actual name is provided if ran
from an absolute path in do_execve().
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
Skip the log entry as there is nothing good to write out. Don't fail
the syscall though since it already succeeded. There's no reason
filemon's tracing failure should fail the already-succeeded syscall.
Record the error for later to return from close(2) on the filemon devfs
file descriptor.
Discussed with: markj, sjg, kib (briefly with kib)
Reported by: mjg
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
None of lstat(2), fstat(2), fstatat(2) were tracked either.
The other filemon implementations also do not track stat(2), nor
does bmake utilize it. The act of opening a file for read should
be enough to decide that a file is a dependency. There could be
rare cases where just having a file would cause a dependency but it
is unlikely.
MFC after: 2 weeks
Also noted by: sjg
Sponsored by: EMC / Isilon Storage Division
- proc.p_filemon is added which is protected by PROC_LOCK. This improves
performance and avoids double-fork issues, taking allproc_lock
while in syscalls, and walking the process tree in syscalls. A
particular proc.p_filemon can only be changed to NULL or another
filemon, or the filemon inherited, while the filemon->lock is held.
- Filemon are reference counted. On the last reference the log will be closed.
- When closing the devfs file handle, the filemon will be detached from all
processes and inheritance prevented.
- Disallow attaching to a process already being traced since filemon is
typically intended to be used on children only. This is allowed for
curproc as bmake relies on this behavior for rare cases when combining
.MAKE with .META.
- Detach any previously tracked process on ioctl(FILEMON_SET_PID).
- Handle error from devfs_set_cdevpriv() in filemon_open().
- The global filemon lock and lists are removed.
- A free list is no longer kept. Previously this list was
forever-expanding and never garbage cleaned.
- No longer loses track of double-forks. If the process holding the filemon
handle closes it will close the log rather than wait on a daemonized process,
but it will log all activity until it closes its handle. The filemon
will be removed from the process and not inherited.
- A separate process count is kept only as an optimization for
forced detachment to avoid taking allproc_lock and walking the entire
process tree.
- struct filemon access is protected by sx(9) filemon->lock as it was before.
- Add more comments and KASSERTS.
MFC after: 2 weeks
Reviewed by: kib, mjg, markj (all on previous versions)
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D5520
The process is not held since the process_exit hook is called after the
exithold. There is no need to hold the process since the hook will
always see it exiting via the process_exit event.
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
This fixes some cases where a process could exit without being untracked
by filemon.
Reported by: mjg
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
It only prints the header from filemon_ioctl. Keep the name though to stay
closer to other implementations.
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
If the pathname is absolute or dirfd is AT_FDCWD we can
handle it exactly like open(2).
Otherwise we output an A record to indicate that the path of
an open directory needs to be used (earlier in the trace).
Differential Revision: D2810
Reviewed by: jhb
MFC after: a bit
PID is valid for monitoring in FILEMON_SET_PID ioctl.
- Set the monitored PID to -1 when the process exits.
Suggested by: jilles
Tested by: sjg
MFC after: 3 days