[GIT PULL] tracing: Do not warn when connecting eprobe to non existing event

From: Steven Rostedt
Date: Wed Oct 27 2021 - 22:16:39 EST


Linus,

Do not WARN when attaching event probe to non-existent event

If the user tries to attach an event probe (eprobe) to an event that does
not exist, it will trigger a warning. There's an error check that only
expects memory issues otherwise it is considered a bug. But changes in the
code to move around the locking made it that it can error out if the user
attempts to attach to an event that does not exist, returning an -ENODEV.
As this path can be caused by user space putting in a bad value, do not
trigger a WARN.


Please pull the latest trace-v5.15-rc6-2 tree, which can be found at:


git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.15-rc6-2

Tag SHA1: 9fae737f622d42e0b9469ff6f481eed539363d90
Head SHA1: 7fa598f9706d40bd16f2ab286bdf5808e1393d35


Steven Rostedt (VMware) (1):
tracing: Do not warn when connecting eprobe to non existing event

----
kernel/trace/trace_eprobe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---------------------------
commit 7fa598f9706d40bd16f2ab286bdf5808e1393d35
Author: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
Date: Wed Oct 27 12:08:54 2021 -0400

tracing: Do not warn when connecting eprobe to non existing event

When the syscall trace points are not configured in, the kselftests for
ftrace will try to attach an event probe (eprobe) to one of the system
call trace points. This triggered a WARNING, because the failure only
expects to see memory issues. But this is not the only failure. The user
may attempt to attach to a non existent event, and the kernel must not
warn about it.

Link: https://lkml.kernel.org/r/20211027120854.0680aa0f@xxxxxxxxxxxxxxxxxx

Fixes: 7491e2c442781 ("tracing: Add a probe that attaches to trace events")
Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>

diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c
index c4a15aef36af..5c5f208c15d3 100644
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -904,8 +904,8 @@ static int __trace_eprobe_create(int argc, const char *argv[])

if (IS_ERR(ep)) {
ret = PTR_ERR(ep);
- /* This must return -ENOMEM, else there is a bug */
- WARN_ON_ONCE(ret != -ENOMEM);
+ /* This must return -ENOMEM or misssing event, else there is a bug */
+ WARN_ON_ONCE(ret != -ENOMEM && ret != -ENODEV);
ep = NULL;
goto error;
}