[PATCH 0/2] tracing/user_events: Share state between existing threads

From: Jeff Barnes

Date: Fri Oct 02 2026 - 11:40:28 EST


Threads sharing an mm_struct can create separate user_event_mm instances
when they were created before either thread first uses user_events. Each
instance then has its own enabler list, allowing two threads in the same
address space to register different events using the same enable address
and bit.

The first patch adds a deterministic regression test that creates both
threads before registration and verifies that the second registration is
rejected with EADDRINUSE.

The second patch makes current_user_event_mm() find and attach to an
existing user_event_mm for the current mm_struct, and synchronizes
attachment with removal of the last task.

Without the fix, the new selftest fails because the duplicate registration
succeeds. With the fix, the registration is rejected with EADDRINUSE and
all seven user_events ABI tests pass.

---
2.43.0