[Bug 224015] filemon(4) can't deal with newlines in paths

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Jan 24 18:51:51 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224015

--- Comment #2 from Jan Bramkamp <crest at bultmann.eu> ---
There is no way an existing user of the filemon(4) API can correctly deal with
newlines in paths. As such I would recommend the following changes to maintain
compatiblity:

 * Drop paths incompatible with the current format from the event stream. This
keeps existing code working for all paths encodable without violating data
transparency.
 * The simplest solution would be to add an ioctl() switching the encoding to
be used before attaching a file descriptor to the filemon file descriptor.

It would be enough to just use NUL as separator between records. If records
contain multiple NUL terminated string the the consumer would have to deduce
the number of string arguments from the first byte of a record unless. But this
is kind of encoding would still be a fragile hack and existing code couldn't
skip over new record types. Because of this I would recommend fixing this
problem in a way to minimize the impact of future changes by migrating the
encoding to a stream of djb style netstrings. They are very easy to generate
and fairly easy to parse without switching to a binary encoding.

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


More information about the freebsd-bugs mailing list