diff options
| author | Wander Lairson Costa <wander@redhat.com> | 2026-03-09 16:46:29 -0300 |
|---|---|---|
| committer | Tomas Glozar <tglozar@redhat.com> | 2026-03-11 15:29:50 +0100 |
| commit | 47dd74f68c0c068fdd29cdf9fe1860a19209bc1f (patch) | |
| tree | 949a857dca865bde8ffb7d1d25aa784fd8601d89 /rust/kernel/interop/git@git.tavy.me:linux-stable.git | |
| parent | 4bf4ef5292b9253d8607c61a875d9f6b14129976 (diff) | |
rtla/trace: Fix I/O handling in save_trace_to_file()
The read/write loop in save_trace_to_file() does not correctly handle
errors from the read() and write() system calls. If either call is
interrupted by a signal, it returns -1 with errno set to EINTR, but
the code treats this as a fatal error and aborts the save operation.
Additionally, write() may perform a partial write, returning fewer
bytes than requested, which the code does not handle.
Fix the I/O loop by introducing proper error handling. The return
value of read() is now stored in a ssize_t variable and checked for
errors, with EINTR causing a retry. For write(), an inner loop ensures
all bytes are written, handling both EINTR and partial writes. Error
messages now include strerror() output for better debugging.
This follows the same pattern established in the previous commit that
fixed trace_event_save_hist(), ensuring consistent and robust I/O
handling throughout the trace saving code.
Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Link: https://lore.kernel.org/r/20260309195040.1019085-17-wander@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
Diffstat (limited to 'rust/kernel/interop/git@git.tavy.me:linux-stable.git')
0 files changed, 0 insertions, 0 deletions
