Skip to contentSkip to conversation

selftests/kprobe: Do not test for GRP/ without event failures

PATCH In review Steven Rostedt 3 participants 7 messages Jul 12, 2022 – Jul 21, 2022

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

PATCH 1/1 selftests/kprobe: Do not test for GRP/ without event failures

From: "Steven Rostedt (Google)" <[email protected]>

A new feature is added where kprobes (and other probes) do not need to explicitly state the event name when creating a probe. The event name will come from what is being attached.

That is:

  # echo 'p:foo/ vfs_read' > kprobe_events

Will no longer error, but instead create an event:

  # cat kprobe_events
 p:foo/p_vfs_read_0 vfs_read

This should not be tested as an error case anymore. Remove it from the selftest as now this feature "breaks" the selftest as it no longer fails as expected.

---
 .../selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc       | 1 -
 1 file changed, 1 deletion(-)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +0 -1
index fa928b431555..7c02509c71d0 100644
@@ -21,7 +21,6 @@ check_error 'p:^/bar vfs_read'		# NO_GROUP_NAME
 check_error 'p:^12345678901234567890123456789012345678901234567890123456789012345/bar vfs_read'	# GROUP_TOO_LONG
 
 check_error 'p:^foo.1/bar vfs_read'	# BAD_GROUP_NAME
-check_error 'p:foo/^ vfs_read'		# NO_EVENT_NAME
 check_error 'p:foo/^12345678901234567890123456789012345678901234567890123456789012345 vfs_read'	# EVENT_TOO_LONG
 check_error 'p:foo/^bar.1 vfs_read'	# BAD_EVENT_NAME
 
Signature · 1 line
2.35.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Tue, 12 Jul 2022 16:17:07 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Google)" <[email protected]>

A new feature is added where kprobes (and other probes) do not need to explicitly state the event name when creating a probe. The event name will come from what is being attached.

That is:

  # echo 'p:foo/ vfs_read' > kprobe_events
Quoted 8 lines

Will no longer error, but instead create an event:

  # cat kprobe_events
 p:foo/p_vfs_read_0 vfs_read

This should not be tested as an error case anymore. Remove it from the selftest as now this feature "breaks" the selftest as it no longer fails as expected.

Good catch!

BTW, in this case, NO_EVENT_NAME error should not happen anymore. Let me cleanup the code.

Thank you,

Quoted 23 lines
---
 .../selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc       | 1 -
 1 file changed, 1 deletion(-)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +0 -1
index fa928b431555..7c02509c71d0 100644
@@ -21,7 +21,6 @@ check_error 'p:^/bar vfs_read'		# NO_GROUP_NAME
 check_error 'p:^12345678901234567890123456789012345678901234567890123456789012345/bar vfs_read'	# GROUP_TOO_LONG
 
 check_error 'p:^foo.1/bar vfs_read'	# BAD_GROUP_NAME
-check_error 'p:foo/^ vfs_read'		# NO_EVENT_NAME
 check_error 'p:foo/^12345678901234567890123456789012345678901234567890123456789012345 vfs_read'	# EVENT_TOO_LONG
 check_error 'p:foo/^bar.1 vfs_read'	# BAD_EVENT_NAME
 
Signature · 1 line
2.35.1
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
#2 lore raw
Quoted 22 lines · On Mon, 18 Jul 2022 11:08:53 +0900 Masami Hiramatsu (Google)…
Quoted 10 lines · On Tue, 12 Jul 2022 16:17:07 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Google)" <[email protected]>

A new feature is added where kprobes (and other probes) do not need to explicitly state the event name when creating a probe. The event name will come from what is being attached.

That is:

  # echo 'p:foo/ vfs_read' > kprobe_events
Quoted 8 lines

Will no longer error, but instead create an event:

  # cat kprobe_events
 p:foo/p_vfs_read_0 vfs_read

This should not be tested as an error case anymore. Remove it from the selftest as now this feature "breaks" the selftest as it no longer fails as expected.

Quoted 6 lines

Good catch!

BTW, in this case, NO_EVENT_NAME error should not happen anymore. Let me cleanup the code.

Oops, no. There is an error case of NO_EVENT_NAME. 'p: vfs_read' will cause this error because it expects an event name after ':'. Thus, the correct fix is just removing "foo/":

check_error 'p:^ vfs_read' # NO_EVENT_NAME

Thank you,

Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
#3 lore raw

PATCH 1/1 selftests/kprobe: Update test for no event name syntax error

From: Masami Hiramatsu (Google) <[email protected]>

The commit 208003254c32 ("selftests/kprobe: Do not test for GRP/ without event failures") removed a syntax which is no more cause a syntax error (NO_EVENT_NAME error with GRP/). However, there are another case (NO_EVENT_NAME error without GRP/) which causes a same error. This adds a test for that case.

---
 .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc   |    1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +1 -0
index 7c02509c71d0..9e85d3019ff0 100644
@@ -21,6 +21,7 @@ check_error 'p:^/bar vfs_read'		# NO_GROUP_NAME
 check_error 'p:^12345678901234567890123456789012345678901234567890123456789012345/bar vfs_read'	# GROUP_TOO_LONG
 
 check_error 'p:^foo.1/bar vfs_read'	# BAD_GROUP_NAME
+check_error 'p:^ vfs_read'		# NO_EVENT_NAME
 check_error 'p:foo/^12345678901234567890123456789012345678901234567890123456789012345 vfs_read'	# EVENT_TOO_LONG
 check_error 'p:foo/^bar.1 vfs_read'	# BAD_EVENT_NAME
 
#4 lore raw

Re: [PATCH] selftests/kprobe: Update test for no event name syntax error

hi Masami,

Quoted 18 lines · Masami Hiramatsu (Google)

From: Masami Hiramatsu (Google) <[email protected]>

The commit 208003254c32 ("selftests/kprobe: Do not test for GRP/ without event failures") removed a syntax which is no more cause a syntax error (NO_EVENT_NAME error with GRP/). However, there are another case (NO_EVENT_NAME error without GRP/) which causes a same error. This adds a test for that case.

---
  .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc   |    1 +
  1 file changed, 1 insertion(+)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +0 -0
index 7c02509c71d0..9e85d3019ff0 100644

tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc check_error 'p:^/bar vfs_read' # NO_GROUP_NAME · line 24

Quoted 4 lines
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +1 -0
@@ -21,6 +21,7 @@ check_error 'p:^/bar vfs_read'		# NO_GROUP_NAME
  check_error 'p:^12345678901234567890123456789012345678901234567890123456789012345/bar vfs_read'	# GROUP_TOO_LONG
 
  check_error 'p:^foo.1/bar vfs_read'	# BAD_GROUP_NAME
+check_error 'p:^ vfs_read'		# NO_EVENT_NAME

i think you fix the issue which exist from start, right ?

is there better comment than NO_EVENT_NAME  ?

Quoted 4 lines
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +0 -0
  check_error 'p:foo/^12345678901234567890123456789012345678901234567890123456789012345 vfs_read'	# EVENT_TOO_LONG
  check_error 'p:foo/^bar.1 vfs_read'	# BAD_EVENT_NAME
 
#5 lore raw

Re: [PATCH] selftests/kprobe: Update test for no event name syntax error

Quoted 23 lines · On Mon, 18 Jul 2022 17:36:43 +0800 Linyu Yuan <[email protected]> wrote:

hi Masami,

Quoted 20 lines · Masami Hiramatsu (Google)

From: Masami Hiramatsu (Google) <[email protected]>

The commit 208003254c32 ("selftests/kprobe: Do not test for GRP/ without event failures") removed a syntax which is no more cause a syntax error (NO_EVENT_NAME error with GRP/). However, there are another case (NO_EVENT_NAME error without GRP/) which causes a same error. This adds a test for that case.

---
  .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc   |    1 +
  1 file changed, 1 insertion(+)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +0 -0
index 7c02509c71d0..9e85d3019ff0 100644
@@ -21,6 +21,7 @@ check_error 'p:^/bar vfs_read'		# NO_GROUP_NAME
  check_error 'p:^12345678901234567890123456789012345678901234567890123456789012345/bar vfs_read'	# GROUP_TOO_LONG
 
Quoted 4 lines

tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc check_error 'p:^/bar vfs_read' # NO_GROUP_NAME · line 24

Quoted 2 lines
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +1 -0
  check_error 'p:^foo.1/bar vfs_read'	# BAD_GROUP_NAME
+check_error 'p:^ vfs_read'		# NO_EVENT_NAME

i think you fix the issue which exist from start, right ?

Yes, this is not a new bug but the error case which still exists.

Quoted 2 lines

is there better comment than NO_EVENT_NAME  ?

These comments are corresponding to the error name, so that we can find the logging code easily. (Not for users)

Thank you,

Quoted 5 lines
Quoted 5 lines
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +0 -0
  check_error 'p:foo/^12345678901234567890123456789012345678901234567890123456789012345 vfs_read'	# EVENT_TOO_LONG
  check_error 'p:foo/^bar.1 vfs_read'	# BAD_EVENT_NAME
 
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
author maintainer Applied
#6 lore raw

Re: [PATCH] selftests/kprobe: Update test for no event name syntax error

In reply to Masami Hiramatsu (Google)
Quoted 9 lines · On Mon, 18 Jul 2022 16:05:10 +0900 "Masami Hiramatsu (Google)"…

From: Masami Hiramatsu (Google) <[email protected]>

The commit 208003254c32 ("selftests/kprobe: Do not test for GRP/ without event failures") removed a syntax which is no more cause a syntax error (NO_EVENT_NAME error with GRP/). However, there are another case (NO_EVENT_NAME error without GRP/) which causes a same error. This adds a test for that case.

Queued. Thanks Masami!

-- Steve

Quoted 16 lines
---
 .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc   |    1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +1 -0
index 7c02509c71d0..9e85d3019ff0 100644
@@ -21,6 +21,7 @@ check_error 'p:^/bar vfs_read'		# NO_GROUP_NAME
 check_error 'p:^12345678901234567890123456789012345678901234567890123456789012345/bar vfs_read'	# GROUP_TOO_LONG
 
 check_error 'p:^foo.1/bar vfs_read'	# BAD_GROUP_NAME
+check_error 'p:^ vfs_read'		# NO_EVENT_NAME
 check_error 'p:foo/^12345678901234567890123456789012345678901234567890123456789012345 vfs_read'	# EVENT_TOO_LONG
 check_error 'p:foo/^bar.1 vfs_read'	# BAD_EVENT_NAME