TraceFS: The Newest Linux File-System

Rostedt explained the purpose of TraceFS well via his LKML announcement:
There has been complaints that tracing is tied too much to debugfs, as there are systems that would like to perform tracing, but do not mount debugfs for security reasons. That is because any subsystem may use debugfs for debugging, and these interfaces are not always tested for security.So basically TraceFS provides the same functionality now for kernel traces that is done currently via DebugFS. With TraceFS though you don't need to worry about enabling the potentially security-prone DebugFS and by having their own file-system it can implement features not supported by DebugFS (e.g. mkdir and rmdir support). Assuming it clears developer review fine, it's possible we could see TraceFS for Linux 3.20 or another near-term kernel update.
Creating a new tracefs that the tracing directory will now be attached to allows system admins the ability to access the tracing directory without the need to mount debugfs.
Another advantage is that debugfs does not support the system calls for mkdir and rmdir. Tracing uses these system calls to create new instances for sub buffers. This was done by a hack that hijacked the dentry ops from the "instances" debugfs dentry, and replacing it with one that could work.
Instead of using this hack, tracefs can provide a proper interface to allow the tracing system to have a mkdir and rmdir feature.
To maintain backward compatibility with older tools that expect that the tracing directory is mounted with debugfs, the tracing directory is still created under debugfs and tracefs is automatically mounted there.
Finally, a new directory is created when tracefs is enabled called /sys/kernel/tracing. This will be the new location that system admins may mount tracefs if they are not using debugfs.
8 Comments