This patchset is a prototype implementation of the feature requested in GHAK issue #9 [1].
I decided for a simple auxiliary record with just 2 fields (fd and path) that is emitted
whenever we want to record the full path for a file descriptor passed to a syscall (e.g.
the dirfd argument of openat(2)). I choose this approach because for some syscalls there
is more than one file descriptor we might be interested in (a good example is the
renameat(2) syscall).
The motivation for this feature (as I understand it) is to avoid the need to reconstruct
the paths corresponding to the file descriptors passed to syscalls, as this might be
difficult and time consuming or even impossible in case not all of the right sycalls are
being logged. Note that it is always possible to disable these records by simply adding an
exclude filter rule matching all records of type FD_PATH.
At this moment I only implement logging for a single syscall (openat(2)) to keep it
simple. In the final version I plan to add support for other similar syscalls ()mkdirat,
mknodeat, fchownat, ...).
Please let me know if the general approach and the proposed record format make sense to
you so I can improve/complete the solution.
Thanks,
Ondrej
[1]
https://github.com/linux-audit/audit-kernel/issues/9