History

tracing/probes: Eliminate recursion in parse_probe_arg()

To avoid potential stack overflows on limited kernel stacks, convert parse_probe_arg() from a recursive function into a loop-based implementation with a simple local state stack. Since recursion is eliminated using a loop with a fixed-size stack in the context, this restricts the dereference nesting depth. The maximum nesting depth of dereferences is now restricted to the same limit as typecasts (TRACEPROBE_MAX_NESTED_LEVEL, which is 8) and reports the same TOO_MANY_NESTED error. Update ftrace selftests to reflect this restriction and simplify the checks. Note that this change slightly alters the behavior of nested dereferencing in fetcharg. Previously, dereferencing without BTF allowed for up to 14 levels of nesting, whereas dereferencing with BTF was limited to 3 levels. With this change, the nesting depth is now limited to 8 levels in both cases. Link: https://lore.kernel.org/all/178399141396.27810.5390060618628718661.stgit@devnote2/

Masami Hiramatsu committed 4 months ago

Commit 1a0ffe11 parent 47e4ec65 files · +242 −139Browse files

Unified · Split

5 files
  1. kernel/trace/trace_probe.c +207 −131
  2. kernel/trace/trace_probe.h +30 −3
  3. tools/testing/selftests/ftrace/test.d/dynevent/fprobe_syntax_errors.tc +2 −2
  4. tools/testing/selftests/ftrace/test.d/dynevent/tprobe_syntax_errors.tc +1 −1
  5. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +2 −2
kernel/trace/trace_probe.c+207−131
@@ -356,61 +356,10 @@ parse_probe_arg(char *arg, const struct fetch_type *type, · 355 unmodified lines
356356 struct fetch_insn **pcode, struct fetch_insn *end,
357357 struct traceprobe_parse_context *ctx);
358358
359−/* handle dereference nested call */
360−static inline int handle_dereference(char *arg, struct fetch_insn **pcode,
361− struct fetch_insn *end, struct traceprobe_parse_context *ctx,
362− int deref, long offset)
359+static int parse_this_cpu(char *arg, struct traceprobe_parse_context *ctx)
363360 {
364− const struct fetch_type *type = find_fetch_type(NULL, ctx->flags);
365− struct fetch_insn *code = *pcode;
366− int cur_offs = ctx->offset;
361+ bool is_read = false;
367362 char *tmp;
368− int ret;
369−
370− tmp = strrchr(arg, ')');
371− if (!tmp) {
372− trace_probe_log_err(ctx->offset + strlen(arg),
373− DEREF_OPEN_BRACE);
374− return -EINVAL;
375− }
376−
377− *tmp = '\0';
378− ret = parse_probe_arg(arg, type, &code, end, ctx);
379− if (ret)
380− return ret;
381− ctx->offset = cur_offs;
382− if (code->op == FETCH_OP_COMM || code->op == FETCH_OP_IMMSTR) {
383− trace_probe_log_err(ctx->offset, COMM_CANT_DEREF);
384− return -EINVAL;
385− }
386−
387− /*
388− * this_cpu_ptr(@SYM) does not use SYM value, but use SYM address.
389− * So we overwrite the last FETCH_OP_DEREF with FETCH_OP_CPU_PTR.
390− */
391− if (!(deref == FETCH_OP_CPU_PTR && *arg == '@')) {
392− code++;
393− if (code == end) {
394− trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
395− return -EINVAL;
396− }
397− }
398− *pcode = code;
399−
400− code->op = deref;
401− code->offset = offset;
402− /* Reset the last type if used */
403− ctx->last_type = NULL;
404− return 0;
405−}
406−
407−static int parse_this_cpu(char *arg, struct fetch_insn **pcode,
408− struct fetch_insn *end,
409− struct traceprobe_parse_context *ctx)
410−{
411− struct fetch_insn *code;
412− bool is_ptr = false;
413− int ret;
414363
415364 /*
416365 * This is only for kernel probes, excluding eprobe, because per-cpu
@@ -424,27 +373,29 @@ static int parse_this_cpu(char *arg, struct fetch_insn **pcode, · 7 unmodified lines
424373 if (str_has_prefix(arg, THIS_CPU_PTR_PREFIX)) {
425374 arg += THIS_CPU_PTR_LEN;
426375 ctx->offset += THIS_CPU_PTR_LEN;
427− is_ptr = true;
428376 } else if (str_has_prefix(arg, THIS_CPU_READ_PREFIX)) {
429377 arg += THIS_CPU_READ_LEN;
430378 ctx->offset += THIS_CPU_READ_LEN;
431− } else
379+ is_read = true;
380+ } else {
381+ trace_probe_log_err(ctx->offset, BAD_FETCH_ARG);
432382 return -EINVAL;
383+ }
433384
434− ret = handle_dereference(arg, pcode, end, ctx, FETCH_OP_CPU_PTR, 0);
435− if (ret || is_ptr)
436− return ret;
437−
438− /* this_cpu_read(VAR) -> +0(this_cpu_ptr(VAR)) */
439− code = *pcode;
440− code++;
441− if (code == end) {
442− trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
385+ tmp = strrchr(arg, ')');
386+ if (!tmp) {
387+ trace_probe_log_err(ctx->offset + strlen(arg),
388+ DEREF_OPEN_BRACE);
443389 return -EINVAL;
444390 }
445− code->op = FETCH_OP_DEREF;
446− code->offset = 0;
447− *pcode = code;
391+ *tmp = '\0';
392+
393+ ctx->stack[ctx->depth].type = STATE_DEREF;
394+ ctx->stack[ctx->depth].deref.deref = FETCH_OP_CPU_PTR;
395+ ctx->stack[ctx->depth].deref.offset = 0;
396+ ctx->stack[ctx->depth].deref.cur_offs = ctx->offset;
397+ ctx->stack[ctx->depth].deref.inner_arg = arg;
398+ ctx->stack[ctx->depth].deref.is_cpu_read = is_read;
448399 return 0;
449400 }
450401
@@ -1007,14 +958,12 @@ static char *find_matched_close_paren(char *s) · 556 unmodified lines
1007958 return NULL;
1008959 }
1009960
1010−static int handle_typecast(char *arg, struct fetch_insn **pcode,
1011− struct fetch_insn *end,
1012− struct traceprobe_parse_context *ctx)
961+static int handle_typecast(char *arg, struct traceprobe_parse_context *ctx)
1013962 {
1014963 int orig_offset = ctx->offset;
1015964 char *close;
1016965 char *tmp;
1017− int ret;
966+ char *fieldname;
1018967
1019968 if (!(tparg_is_event_probe(ctx->flags) ||
1020969 tparg_is_function_entry(ctx->flags) ||
@@ -1028,12 +977,6 @@ static int handle_typecast(char *arg, struct fetch_insn **pcode, · 7 unmodified lines
1028977 * For example: (STRUCT)VAR->FIELD and (STRUCT)(VAR)->FIELD are same.
1029978 * VAR is solved in the nested call.
1030979 */
1031− ctx->nested_level++;
1032− if (ctx->nested_level > TRACEPROBE_MAX_NESTED_LEVEL) {
1033− trace_probe_log_err(ctx->offset, TOO_MANY_NESTED);
1034− return -E2BIG;
1035− }
1036−
1037980 tmp = strchr(arg, ')');
1038981 if (!tmp) {
1039982 trace_probe_log_err(ctx->offset + strlen(arg),
@@ -1103,30 +1046,19 @@ static int handle_typecast(char *arg, struct fetch_insn **pcode, · 63 unmodified lines
11031046 }
11041047 *close = '\0';
11051048
1106− /* We need to parse the nested one */
1107− ret = parse_probe_arg(tmp, find_fetch_type(NULL, ctx->flags),
1108− pcode, end, ctx);
1109− if (ret < 0)
1110− return ret;
1111− ctx->nested_level--;
1112− clear_struct_btf(ctx);
1113−
1114− /* Let tmp point the field name. */
1049+ /* Let fieldname point the field name. */
11151050 if (close[1] == '-')
1116− tmp = close + 3; /* Skip "->" after closing parenthesis */
1051+ fieldname = close + 3; /* Skip "->" after closing parenthesis */
11171052 else
1118− tmp = close + 2; /* Skip ">" after inner variable name */
1119−
1120− /* resolve the typecast struct name */
1121− ctx->offset = orig_offset + 1; /* for the '(' */
1122− ret = parse_btf_casttype(arg + 1, ctx);
1123− if (ret < 0)
1124− return ret;
1125−
1126− ctx->offset = orig_offset + tmp - arg;
1127− ret = parse_btf_field(tmp, ctx->last_struct, pcode, end, ctx);
1128− ctx->prefix_byteoffs = 0;
1129− return ret;
1053+ fieldname = close + 2; /* Skip ">" after inner variable name */
1054+
1055+ ctx->stack[ctx->depth].type = STATE_TYPECAST;
1056+ ctx->stack[ctx->depth].typecast.casttype = arg + 1;
1057+ ctx->stack[ctx->depth].typecast.fieldname = fieldname;
1058+ ctx->stack[ctx->depth].typecast.orig_offset = orig_offset;
1059+ ctx->stack[ctx->depth].typecast.field_offset_diff = fieldname - arg;
1060+ ctx->stack[ctx->depth].typecast.inner_arg = tmp;
1061+ return 0;
11301062 }
11311063
11321064 #else /* !CONFIG_PROBE_EVENTS_BTF_ARGS */
@@ -1171,9 +1103,20 @@ static int check_prepare_btf_string_fetch(char *typename, · 38 unmodified lines
11711103 return 0;
11721104 }
11731105
1174−static int handle_typecast(char *arg, struct fetch_insn **pcode,
1175− struct fetch_insn *end,
1106+static int parse_btf_casttype(char *casttype,
1107+ struct traceprobe_parse_context *ctx)
1108+{
1109+ return -EOPNOTSUPP;
1110+}
1111+
1112+static int parse_btf_field(char *fieldname, const struct btf_type *type,
1113+ struct fetch_insn **pcode, struct fetch_insn *end,
11761114 struct traceprobe_parse_context *ctx)
1115+{
1116+ return -EOPNOTSUPP;
1117+}
1118+
1119+static int handle_typecast(char *arg, struct traceprobe_parse_context *ctx)
11771120 {
11781121 trace_probe_log_err(ctx->offset, NOSUP_BTFARG);
11791122 return -EOPNOTSUPP;
@@ -1598,9 +1541,7 @@ static int parse_probe_arg_mem_symbol(char *arg, struct fetch_insn **pcode, · 418 unmodified lines
15981541 return 0;
15991542 }
16001543
1601−static int parse_probe_arg_deref(char *arg, struct fetch_insn **pcode,
1602− struct fetch_insn *end,
1603− struct traceprobe_parse_context *ctx)
1544+static int parse_probe_arg_deref(char *arg, struct traceprobe_parse_context *ctx)
16041545 {
16051546 int deref = FETCH_OP_DEREF;
16061547 long offset = 0;
@@ -1627,7 +1568,22 @@ static int parse_probe_arg_deref(char *arg, struct fetch_insn **pcode, · 20 unmodified lines
16271568 }
16281569 ctx->offset += (tmp + 1 - arg) + (arg[0] != '-' ? 1 : 0);
16291570 arg = tmp + 1;
1630− return handle_dereference(arg, pcode, end, ctx, deref, offset);
1571+
1572+ tmp = strrchr(arg, ')');
1573+ if (!tmp) {
1574+ trace_probe_log_err(ctx->offset + strlen(arg),
1575+ DEREF_OPEN_BRACE);
1576+ return -EINVAL;
1577+ }
1578+ *tmp = '\0';
1579+
1580+ ctx->stack[ctx->depth].type = STATE_DEREF;
1581+ ctx->stack[ctx->depth].deref.deref = deref;
1582+ ctx->stack[ctx->depth].deref.offset = offset;
1583+ ctx->stack[ctx->depth].deref.cur_offs = ctx->offset;
1584+ ctx->stack[ctx->depth].deref.inner_arg = arg;
1585+ ctx->stack[ctx->depth].deref.is_cpu_read = false;
1586+ return 0;
16311587 }
16321588
16331589 static int parse_probe_arg_imm(char *arg, struct fetch_insn *code,
@@ -1659,11 +1615,6 @@ static int parse_probe_arg_default(char *arg, struct fetch_insn **pcode, · 25 unmodified lines
16591615 {
16601616 int ret;
16611617
1662− if (str_has_prefix(arg, THIS_CPU_PTR_PREFIX) ||
1663− str_has_prefix(arg, THIS_CPU_READ_PREFIX)) {
1664− return parse_this_cpu(arg, pcode, end, ctx);
1665− }
1666−
16671618 if (isalpha(arg[0]) || arg[0] == '_') {
16681619 /* BTF variable or event field */
16691620 if (ctx->flags & TPARG_FL_TEVENT) {
@@ -1685,11 +1636,56 @@ static int parse_probe_arg_default(char *arg, struct fetch_insn **pcode, · 15 unmodified lines
16851636 return 0;
16861637 }
16871638
1688−/* Recursive argument parser */
1689−static int
1690−parse_probe_arg(char *arg, const struct fetch_type *type,
1691− struct fetch_insn **pcode, struct fetch_insn *end,
1692− struct traceprobe_parse_context *ctx)
1639+static int parse_probe_arg_nested(char **parg, struct traceprobe_parse_context *ctx)
1640+{
1641+ char *arg = *parg;
1642+ int ret;
1643+
1644+ while (true) {
1645+ /* Determine if this is a nested argument */
1646+ if (arg[0] != '+' && arg[0] != '-' && arg[0] != '(' &&
1647+ !str_has_prefix(arg, THIS_CPU_PTR_PREFIX) &&
1648+ !str_has_prefix(arg, THIS_CPU_READ_PREFIX))
1649+ break;
1650+
1651+ /* If nested, check the maximum depth limit */
1652+ if (ctx->depth >= TRACEPROBE_MAX_NESTED_LEVEL) {
1653+ trace_probe_log_err(ctx->offset, TOO_MANY_NESTED);
1654+ return -E2BIG;
1655+ }
1656+
1657+ /* Perform the actual parsing subroutine calls */
1658+ switch (arg[0]) {
1659+ case '+':
1660+ case '-':
1661+ ret = parse_probe_arg_deref(arg, ctx);
1662+ if (ret)
1663+ return ret;
1664+ arg = ctx->stack[ctx->depth].deref.inner_arg;
1665+ break;
1666+ case '(':
1667+ ret = handle_typecast(arg, ctx);
1668+ if (ret)
1669+ return ret;
1670+ arg = ctx->stack[ctx->depth].typecast.inner_arg;
1671+ break;
1672+ default:
1673+ ret = parse_this_cpu(arg, ctx);
1674+ if (ret)
1675+ return ret;
1676+ arg = ctx->stack[ctx->depth].deref.inner_arg;
1677+ break;
1678+ }
1679+ ctx->depth++;
1680+ }
1681+
1682+ *parg = arg;
1683+ return 0;
1684+}
1685+
1686+static int parse_probe_arg_leaf(char *arg, const struct fetch_type *type,
1687+ struct fetch_insn **pcode, struct fetch_insn *end,
1688+ struct traceprobe_parse_context *ctx)
16931689 {
16941690 struct fetch_insn *code = *pcode;
16951691 int ret;
@@ -1704,26 +1700,112 @@ parse_probe_arg(char *arg, const struct fetch_type *type, · 8 unmodified lines
17041700 case '@': /* memory, file-offset or symbol */
17051701 ret = parse_probe_arg_mem_symbol(arg, pcode, end, ctx);
17061702 break;
1707− case '+': /* deref memory */
1708− case '-':
1709− ret = parse_probe_arg_deref(arg, pcode, end, ctx);
1710− break;
17111703 case '\\': /* Immediate value */
17121704 ret = parse_probe_arg_imm(arg, code, ctx);
17131705 break;
1714− case '(':
1715− ret = handle_typecast(arg, pcode, end, ctx);
1716− break;
17171706 default:
17181707 ret = parse_probe_arg_default(arg, pcode, end, ctx);
17191708 break;
17201709 }
1721− if (!ret && code->op == FETCH_OP_NOP) {
1710+
1711+ if (ret)
1712+ return ret;
1713+
1714+ if (code->op == FETCH_OP_NOP) {
17221715 /* Parsed, but do not find fetch method */
17231716 trace_probe_log_err(ctx->offset, BAD_FETCH_ARG);
1724− ret = -EINVAL;
1717+ return -EINVAL;
17251718 }
1726− return ret;
1719+
1720+ return 0;
1721+}
1722+
1723+static int unwind_parse_states(struct fetch_insn **pcode, struct fetch_insn *end,
1724+ struct traceprobe_parse_context *ctx)
1725+{
1726+ struct parse_state *state;
1727+ struct fetch_insn *code;
1728+ int ret;
1729+
1730+ while (ctx->depth > 0) {
1731+ ctx->depth--;
1732+ state = &ctx->stack[ctx->depth];
1733+
1734+ if (state->type == STATE_DEREF) {
1735+ code = *pcode;
1736+ ctx->offset = state->deref.cur_offs;
1737+ if (code->op == FETCH_OP_COMM || code->op == FETCH_OP_IMMSTR) {
1738+ trace_probe_log_err(ctx->offset, COMM_CANT_DEREF);
1739+ return -EINVAL;
1740+ }
1741+
1742+ if (!(state->deref.deref == FETCH_OP_CPU_PTR &&
1743+ *state->deref.inner_arg == '@')) {
1744+ code++;
1745+ if (code == end) {
1746+ trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
1747+ return -EINVAL;
1748+ }
1749+ }
1750+ *pcode = code;
1751+
1752+ code->op = state->deref.deref;
1753+ code->offset = state->deref.offset;
1754+ ctx->last_type = NULL;
1755+
1756+ if (state->deref.is_cpu_read) {
1757+ code = *pcode;
1758+ code++;
1759+ if (code == end) {
1760+ trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
1761+ return -EINVAL;
1762+ }
1763+ code->op = FETCH_OP_DEREF;
1764+ code->offset = 0;
1765+ *pcode = code;
1766+ }
1767+ } else if (state->type == STATE_TYPECAST) {
1768+ clear_struct_btf(ctx);
1769+
1770+ /* resolve the typecast struct name */
1771+ ctx->offset = state->typecast.orig_offset + 1; /* for the '(' */
1772+ ret = parse_btf_casttype(state->typecast.casttype, ctx);
1773+ if (ret < 0)
1774+ return ret;
1775+
1776+ ctx->offset = state->typecast.orig_offset +
1777+ state->typecast.field_offset_diff;
1778+ ret = parse_btf_field(state->typecast.fieldname,
1779+ ctx->last_struct, pcode,
1780+ end, ctx);
1781+ ctx->prefix_byteoffs = 0;
1782+ if (ret < 0)
1783+ return ret;
1784+ }
1785+ }
1786+
1787+ return 0;
1788+}
1789+
1790+/* Loop-based (non-recursive) argument parser */
1791+static int
1792+parse_probe_arg(char *arg, const struct fetch_type *type,
1793+ struct fetch_insn **pcode, struct fetch_insn *end,
1794+ struct traceprobe_parse_context *ctx)
1795+{
1796+ int ret;
1797+
1798+ ctx->depth = 0;
1799+
1800+ ret = parse_probe_arg_nested(&arg, ctx);
1801+ if (ret)
1802+ return ret;
1803+
1804+ ret = parse_probe_arg_leaf(arg, type, pcode, end, ctx);
1805+ if (ret)
1806+ return ret;
1807+
1808+ return unwind_parse_states(pcode, end, ctx);
17271809 }
17281810
17291811 /* Bitfield type needs to be parsed into a fetch function */
@@ -1984,12 +2066,6 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, · 254 unmodified lines
19842066 ctx);
19852067 if (ret < 0)
19862068 goto fail;
1987− /* nested_level must be 0 here, otherwise there is a bug. */
1988− if (WARN_ON_ONCE(ctx->nested_level)) {
1989− ret = -EINVAL;
1990− goto fail;
1991− }
1992−
19932069 /* Update storing type if BTF is available */
19942070 if (IS_ENABLED(CONFIG_PROBE_EVENTS_BTF_ARGS) &&
19952071 ctx->last_type) {
kernel/trace/trace_probe.h+30−3
@@ -437,6 +437,34 @@ static inline bool tparg_is_event_probe(unsigned int flags) · 436 unmodified lines
437437 return !!(flags & TPARG_FL_TEVENT);
438438 }
439439
440+/* Each typecast consumes nested level. So the max number of typecast is 8. */
441+#define TRACEPROBE_MAX_NESTED_LEVEL 8
442+
443+enum parse_state_type {
444+ STATE_DEREF,
445+ STATE_TYPECAST,
446+};
447+
448+struct parse_state {
449+ int type;
450+ union {
451+ struct {
452+ int deref;
453+ long offset;
454+ int cur_offs;
455+ char *inner_arg;
456+ bool is_cpu_read;
457+ } deref;
458+ struct {
459+ char *casttype;
460+ char *fieldname;
461+ int orig_offset;
462+ int field_offset_diff;
463+ char *inner_arg;
464+ } typecast;
465+ };
466+};
467+
440468 struct traceprobe_parse_context {
441469 struct trace_event_call *event;
442470 /* BTF related parameters */
@@ -453,12 +481,11 @@ struct traceprobe_parse_context { · 10 unmodified lines
453481 struct trace_probe *tp;
454482 unsigned int flags;
455483 int offset;
456− int nested_level;
457484 int prefix_byteoffs; /* The byte offset of the prefix field of typecast */
485+ struct parse_state stack[TRACEPROBE_MAX_NESTED_LEVEL + 1];
486+ int depth;
458487 };
459488
460−/* Each typecast consumes nested level. So the max number of typecast is 3. */
461−#define TRACEPROBE_MAX_NESTED_LEVEL 3
462489
463490 extern int traceprobe_parse_probe_arg(struct trace_probe *tp, int i,
464491 const char *argv,
tools/testing/selftests/ftrace/test.d/dynevent/fprobe_syntax_errors.tc+2−2
@@ -60,7 +60,7 @@ check_error 'f vfs_read ^&1' # BAD_FETCH_ARG · 59 unmodified lines
6060
6161 # We've introduced this limitation with array support
6262 if grep -q ' <type>\\\[<array-size>\\\]' README; then
63−check_error 'f vfs_read +0(^+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(@0))))))))))))))' # TOO_MANY_OPS?
63+check_error 'f vfs_read +0(+0(+0(+0(+0(+0(+0(+0(^+0(@0)))))))))' # TOO_MANY_NESTED
6464 check_error 'f vfs_read +0(@11):u8[10^' # ARRAY_NO_CLOSE
6565 check_error 'f vfs_read +0(@11):u8[10]^a' # BAD_ARRAY_SUFFIX
6666 check_error 'f vfs_read +0(@11):u8[^10a]' # BAD_ARRAY_NUM
@@ -114,7 +114,7 @@ check_error 'f vfs_read file^-.foo' # BAD_HYPHEN · 47 unmodified lines
114114 check_error 'f vfs_read ^file:string' # BAD_TYPE4STR
115115 if grep -qF "[(structname" README ; then
116116 check_error 'f vfs_read arg1=(task_struct)file^' # TYPECAST_REQ_FIELD
117−check_error 'f vfs_read arg1=(a)((b)((c)(^(d)file->d)->c)->b)->a' # TOO_MANY_NESTED
117+check_error 'f vfs_read arg1=(a)((b)((c)((d)((e)((f)((g)((h)(^(i)file->i)->h)->g)->f)->e)->d)->c)->b)->a' # TOO_MANY_NESTED
118118 check_error 'f vfs_read arg1=(task_struct,^in_execve)file->comm' # TYPECAST_NOT_ALIGNED
119119 check_error 'f vfs_read arg1=(task_struct,^foo_bar)file->pid' # NO_BTF_FIELD
120120 check_error 'f vfs_read arg1=(^task_struct1234)file->pid' # NO_PTR_STRCT
tools/testing/selftests/ftrace/test.d/dynevent/tprobe_syntax_errors.tc+1−1
@@ -46,7 +46,7 @@ check_error 't kfree ^&1' # BAD_FETCH_ARG · 45 unmodified lines
4646
4747 # We've introduced this limitation with array support
4848 if grep -q ' <type>\\\[<array-size>\\\]' README; then
49−check_error 't kfree +0(^+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(@0))))))))))))))' # TOO_MANY_OPS?
49+check_error 't kfree +0(+0(+0(+0(+0(+0(+0(+0(^+0(@0)))))))))' # TOO_MANY_NESTED
5050 check_error 't kfree +0(@11):u8[10^' # ARRAY_NO_CLOSE
5151 check_error 't kfree +0(@11):u8[10]^a' # BAD_ARRAY_SUFFIX
5252 check_error 't kfree +0(@11):u8[^10a]' # BAD_ARRAY_NUM
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc+2−2
@@ -56,7 +56,7 @@ check_error 'p vfs_read ^&1' # BAD_FETCH_ARG · 55 unmodified lines
5656
5757 # We've introduced this limitation with array support
5858 if grep -q ' <type>\\\[<array-size>\\\]' README; then
59−check_error 'p vfs_read +0(^+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(@0))))))))))))))' # TOO_MANY_OPS?
59+check_error 'p vfs_read +0(+0(+0(+0(+0(+0(+0(+0(^+0(@0)))))))))' # TOO_MANY_NESTED
6060 check_error 'p vfs_read +0(@11):u8[10^' # ARRAY_NO_CLOSE
6161 check_error 'p vfs_read +0(@11):u8[10]^a' # BAD_ARRAY_SUFFIX
6262 check_error 'p vfs_read +0(@11):u8[^10a]' # BAD_ARRAY_NUM
@@ -117,7 +117,7 @@ check_error 'p kfree ^$arg10' # NO_BTFARG (exceed the number of parameters) · 54 unmodified lines
117117 check_error 'r kfree ^$retval' # NO_RETVAL
118118 if grep -qF "[(structname" README ; then
119119 check_error 'p vfs_read arg1=(task_struct)file^' # TYPECAST_REQ_FIELD
120−check_error 'p vfs_read arg1=(a)((b)((c)(^(d)file->d)->c)->b)->a' # TOO_MANY_NESTED
120+check_error 'p vfs_read arg1=(a)((b)((c)((d)((e)((f)((g)((h)(^(i)file->i)->h)->g)->f)->e)->d)->c)->b)->a' # TOO_MANY_NESTED
121121 check_error 'p vfs_read arg1=(task_struct,^in_execve)file->comm' # TYPECAST_NOT_ALIGNED
122122 check_error 'p vfs_read arg1=(task_struct,^foo_bar)file->pid' # NO_BTF_FIELD
123123 check_error 'p vfs_read arg1=(^task_struct1234)file->pid' # NO_PTR_STRCT

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t