xref: /linux/tools/testing/selftests/ftrace/test.d/kprobe/uprobe_syntax_errors.tc (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: Uprobe event parser error log check
4# requires: uprobe_events error_log
5
6check_error() { # command-with-error-pos-by-^
7    ftrace_errlog_check 'trace_uprobe' "$1" 'uprobe_events'
8}
9
10check_error 'p ^/non_exist_file:100'	# FILE_NOT_FOUND
11check_error 'p ^/sys:100'		# NO_REGULAR_FILE
12check_error 'p /bin/sh:^10a'		# BAD_UPROBE_OFFS
13check_error 'p /bin/sh:10(^1a)'		# BAD_REFCNT
14check_error 'p /bin/sh:10(10^'		# REFCNT_OPEN_BRACE
15check_error 'p /bin/sh:10(10)^a'	# BAD_REFCNT_SUFFIX
16
17check_error 'p /bin/sh:10 ^@+ab'	# BAD_FILE_OFFS
18check_error 'p /bin/sh:10 ^@symbol'	# SYM_ON_UPROBE
19
20# %return suffix error
21if grep -q "place (uprobe): .*%return.*" README; then
22check_error 'p /bin/sh:10^%hoge'	# BAD_ADDR_SUFFIX
23check_error 'p /bin/sh:10(10)^%return'	# BAD_REFCNT_SUFFIX
24fi
25
26# symstr is not supported by uprobe
27if grep -q ".*symstr.*" README; then
28check_error 'p /bin/sh:10 $stack0:^symstr'	# BAD_TYPE
29fi
30
31exit 0
32