Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds a daemon, "dtprobed", which usually runs at boot (monitored by systemd, if possible), providing /dev/dtrace/helper using CUSE, accepting DOF from processes doing the usual DTrace ioctl()s to that device, and using infrastructure in prior commits in this series to pass the DOF to a child jailed with seccomp() for parsing, and accepting structures containing parsed results back, then emitting uprobes from these results before allowing the ioctl()ing. The uprobes created have stereotyped names and argument lists that include an encoded representation of the name of the corresponding DTrace USDT probe. (The name also contains the address and a number of other things, so that probes that appear in multiple places in a process still work.) (The CUSE device is an "unrestricted ioctl" device, which restricts dtprobed to running only as root, because the ioctl has to pull data -- the DOF -- out of arbitrary places in the client memory according to the passed-in structure. Since you need to be root to create uprobes at all this is not any kind of restriction.) Extra complexity is provided by changes to libfuse. Recent (> 2018) libfuse has a nice logging interface, which if available means that libfuse will log FUSE-side problems into syslog or anywhere else of your choosing: we emit into syslog if -d or -F (debug, foreground) are not specified and systemd is not in use (if systemd is in use, we never daemonize at all). But older libfuse does not provide this, and unfortunately OL8 (but not OL7!) has such an older libfuse. So we add a compatibility wrapper providing a minimal reimplementation of the logging interface if built against such an old libfuse. The wrapper is named like the header and source file implementing the real thing in FUSE itself, but prepended with rpl_ to avoid the possibility of dependencies on header file ordering when the new FUSE code is present. Testing-wise, in installed mode the running dtprobed daemon is used, but in in-source-tree mode runtest.sh kicks off a new dtprobed emitting to a local device file named /dev/dtrace/test-$pid, and uses a new testing-only environment variable to force drti.c to emit its ioctl()s to that temporary device. So in-tree testing always tests the actual dtprobed in the tree (with any bugfixes), not the system copy. Signed-off-by: Nick Alcock <nick.alcock@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information