Skip to content

tracing/user_events: Fixes and improvements for 6.4

Beau Belgrave linux-trace-kernel lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 0 repliesNew
  2. v13 patches 5 repliesSuperseded

Changes in v2 from the cover letter

Add bracket to complex for_each line.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4tracing/user_events: Ensure write index cannot be negativekernel/trace/trace_events_user.c tools/testing/selftests/user_events/ftrace_test.c+8 -00 replies
2/4tracing/user_events: Ensure bit is cleared on unregisterkernel/trace/trace_events_user.c tools/testing/selftests/user_events/abi_test.c+40 -30 replies
3/4tracing/user_events: Prevent same address and bit per processkernel/trace/trace_events_user.c tools/testing/selftests/user_events/ftrace_test.c+49 -10 replies
4/4tracing/user_events: Limit max fault-in attemptskernel/trace/trace_events_user.c+35 -140 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] tracing/user_events: Fixes and improvements for 6.4

Now that user_events is in for-next we broadened our integration of user_events. During this integration we found a few things that can help prevent the debugging of issues for user_events when user processes use the ABI directly.

The most important thing found is an out of bounds fix with the write index. If it is negative, an out of bounds access is attempted. This bug was introduced on one of the very first user_events patches and remained unseen for a long time. Apologies for not catching that sooner.

We think users will expect the kernel to always clear the registered bit when events are unregistered, even if the event is still enabled in a kernel tracer. The user process could do this after unregistering, but it seems appropriate for the kernel side to attempt this. We also discussed if it makes sense for the kernel to allow user processes to tie multiple events to the same value and bit. While this doesn't cause any issues on the kernel side, it leads to very undefined behavior for the user process. Depending on which event gets enabled when, the bit will vary.

Change history

V2:
Add bracket to complex for_each line.

Add patch to ensure in all cases we only limit up to 10 attempts to fault-in data if the user is able to cause write failures with successful fault-in sequences.

Beau Belgrave (4):
tracing/user_events: Ensure write index cannot be negative tracing/user_events: Ensure bit is cleared on unregister tracing/user_events: Prevent same address and bit per process tracing/user_events: Limit max fault-in attempts

 kernel/trace/trace_events_user.c              | 123 ++++++++++++++++--
 .../testing/selftests/user_events/abi_test.c  |   9 +-
 .../selftests/user_events/ftrace_test.c       |  14 +-
 3 files changed, 130 insertions(+), 16 deletions(-)

base-commit: 88fe1ec75fcb296579e05eaf3807da3ee83137e4

Signature · 1 line
2.25.1