Hi, Here is the v8 of the series to improve backup instances of the persistent ring buffer. The previous version is here:
https://lore.kernel.org/all/177062912135.1230888.17419570791737357433.st...@mhiramat.tok.corp.google.com/ In this version, I modified the tracefs to check the file permission even if the user has CAP_DAC_OVERRIDE as same as sysfs[3/6] and remove read-only check from each read() operations[4/6]. Also add a bugfix [2/6] for per-cpu buffer_size_kb permission. Series Description ------------------ Since backup instances are a kind of snapshot of the persistent ring buffer, it should be readonly. And if it is readonly there is no reason to keep it after reading all data via trace_pipe because the data has been consumed. But user should be able to remove the readonly instance by rmdir or truncating `trace` file. Thus, [3/5] makes backup instances readonly (not able to write any events, cleanup trace, change buffer size). Also, [4/5] removes the backup instance after consuming all data via trace_pipe. With this improvements, even if we makes a backup instance (using the same amount of memory of the persistent ring buffer), it will be removed after reading the data automatically. --- Masami Hiramatsu (Google) (6): tracing: Fix to set write permission to per-cpu buffer_size_kb tracing: Reset last_boot_info if ring buffer is reset tracefs: Check file permission even if user has CAP_DAC_OVERRIDE tracing: Make the backup instance non-reusable tracing: Remove the backup instance automatically after read tracing/Documentation: Add a section about backup instance Documentation/trace/debugging.rst | 19 +++++ fs/tracefs/event_inode.c | 2 + fs/tracefs/inode.c | 36 +++++++++- fs/tracefs/internal.h | 3 + kernel/trace/trace.c | 140 ++++++++++++++++++++++++++++--------- kernel/trace/trace.h | 13 +++ kernel/trace/trace_boot.c | 5 + kernel/trace/trace_events.c | 76 ++++++++++++-------- 8 files changed, 224 insertions(+), 70 deletions(-) -- Masami Hiramatsu (Google) <[email protected]>
