Unlike kprobe events, fprobe and uprobe events only register their
underlying probes when the trace event is enabled. When a new probe is
appended to an existing multiprobe fprobe or uprobe event that is
already enabled, the appended probe is linked into the event's probe
list without being registered.
As a result, the newly appended probe never fires until the event is
disabled and re-enabled. Moreover, disabling an fprobe event calls
unregister_fprobe() on the unregistered fprobe, and opening or closing a
perf event on an enabled uprobe event dereferences a NULL tu->uprobe in
uprobe_apply().
Register and enable the newly appended fprobe or uprobe immediately when
the target event is already enabled.
Link: https://lore.kernel.org/all/179455849798.403392.135678786198324285.stgit@devnote2/
Fixes: 41af3cf587 ("tracing/uprobe: Add multi-probe per uprobe event support")
Fixes: 2db832ec90 ("tracing: fprobe-events: Register fprobe-events only when it is enabled")
Cc: [email protected]
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>