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
356 struct fetch_insn **pcode, struct fetch_insn *end,356 struct fetch_insn **pcode, struct fetch_insn *end,
357 struct traceprobe_parse_context *ctx);357 struct traceprobe_parse_context *ctx);
358 358
359/* handle dereference nested call */359static int parse_this_cpu(char *arg, struct traceprobe_parse_context *ctx)
360static 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)
363{360{
364 const struct fetch_type *type = find_fetch_type(NULL, ctx->flags);361 bool is_read = false;
365 struct fetch_insn *code = *pcode;
366 int cur_offs = ctx->offset;
367 char *tmp;362 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
407static 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;
414 363
415 /*364 /*
416 * This is only for kernel probes, excluding eprobe, because per-cpu365 * 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
424 if (str_has_prefix(arg, THIS_CPU_PTR_PREFIX)) {373 if (str_has_prefix(arg, THIS_CPU_PTR_PREFIX)) {
425 arg += THIS_CPU_PTR_LEN;374 arg += THIS_CPU_PTR_LEN;
426 ctx->offset += THIS_CPU_PTR_LEN;375 ctx->offset += THIS_CPU_PTR_LEN;
427 is_ptr = true;
428 } else if (str_has_prefix(arg, THIS_CPU_READ_PREFIX)) {376 } else if (str_has_prefix(arg, THIS_CPU_READ_PREFIX)) {
429 arg += THIS_CPU_READ_LEN;377 arg += THIS_CPU_READ_LEN;
430 ctx->offset += THIS_CPU_READ_LEN;378 ctx->offset += THIS_CPU_READ_LEN;
431 } else379 is_read = true;
380 } else {
381 trace_probe_log_err(ctx->offset, BAD_FETCH_ARG);
432 return -EINVAL;382 return -EINVAL;
383 }
433 384
434 ret = handle_dereference(arg, pcode, end, ctx, FETCH_OP_CPU_PTR, 0);385 tmp = strrchr(arg, ')');
435 if (ret || is_ptr)386 if (!tmp) {
436 return ret;387 trace_probe_log_err(ctx->offset + strlen(arg),
437 388 DEREF_OPEN_BRACE);
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);
443 return -EINVAL;389 return -EINVAL;
444 }390 }
445 code->op = FETCH_OP_DEREF;391 *tmp = '\0';
446 code->offset = 0;392
447 *pcode = code;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;
448 return 0;399 return 0;
449}400}
450 401
@@ -1007,14 +958,12 @@ static char *find_matched_close_paren(char *s) · 556 unmodified lines
1007 return NULL;958 return NULL;
1008}959}
1009 960
1010static int handle_typecast(char *arg, struct fetch_insn **pcode,961static int handle_typecast(char *arg, struct traceprobe_parse_context *ctx)
1011 struct fetch_insn *end,
1012 struct traceprobe_parse_context *ctx)
1013{962{
1014 int orig_offset = ctx->offset;963 int orig_offset = ctx->offset;
1015 char *close;964 char *close;
1016 char *tmp;965 char *tmp;
1017 int ret;966 char *fieldname;
1018 967
1019 if (!(tparg_is_event_probe(ctx->flags) ||968 if (!(tparg_is_event_probe(ctx->flags) ||
1020 tparg_is_function_entry(ctx->flags) ||969 tparg_is_function_entry(ctx->flags) ||
@@ -1028,12 +977,6 @@ static int handle_typecast(char *arg, struct fetch_insn **pcode, · 7 unmodified lines
1028 * For example: (STRUCT)VAR->FIELD and (STRUCT)(VAR)->FIELD are same.977 * For example: (STRUCT)VAR->FIELD and (STRUCT)(VAR)->FIELD are same.
1029 * VAR is solved in the nested call.978 * VAR is solved in the nested call.
1030 */979 */
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
1037 tmp = strchr(arg, ')');980 tmp = strchr(arg, ')');
1038 if (!tmp) {981 if (!tmp) {
1039 trace_probe_log_err(ctx->offset + strlen(arg),982 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
1103 }1046 }
1104 *close = '\0';1047 *close = '\0';
1105 1048
1106 /* We need to parse the nested one */1049 /* Let fieldname point the field name. */
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. */
1115 if (close[1] == '-')1050 if (close[1] == '-')
1116 tmp = close + 3; /* Skip "->" after closing parenthesis */1051 fieldname = close + 3; /* Skip "->" after closing parenthesis */
1117 else1052 else
1118 tmp = close + 2; /* Skip ">" after inner variable name */1053 fieldname = close + 2; /* Skip ">" after inner variable name */
1119 1054
1120 /* resolve the typecast struct name */1055 ctx->stack[ctx->depth].type = STATE_TYPECAST;
1121 ctx->offset = orig_offset + 1; /* for the '(' */1056 ctx->stack[ctx->depth].typecast.casttype = arg + 1;
1122 ret = parse_btf_casttype(arg + 1, ctx);1057 ctx->stack[ctx->depth].typecast.fieldname = fieldname;
1123 if (ret < 0)1058 ctx->stack[ctx->depth].typecast.orig_offset = orig_offset;
1124 return ret;1059 ctx->stack[ctx->depth].typecast.field_offset_diff = fieldname - arg;
1125 1060 ctx->stack[ctx->depth].typecast.inner_arg = tmp;
1126 ctx->offset = orig_offset + tmp - arg;1061 return 0;
1127 ret = parse_btf_field(tmp, ctx->last_struct, pcode, end, ctx);
1128 ctx->prefix_byteoffs = 0;
1129 return ret;
1130}1062}
1131 1063
1132#else /* !CONFIG_PROBE_EVENTS_BTF_ARGS */1064#else /* !CONFIG_PROBE_EVENTS_BTF_ARGS */
@@ -1171,9 +1103,20 @@ static int check_prepare_btf_string_fetch(char *typename, · 38 unmodified lines
1171 return 0;1103 return 0;
1172}1104}
1173 1105
1174static int handle_typecast(char *arg, struct fetch_insn **pcode,1106static int parse_btf_casttype(char *casttype,
1175 struct fetch_insn *end,1107 struct traceprobe_parse_context *ctx)
1108{
1109 return -EOPNOTSUPP;
1110}
1111
1112static int parse_btf_field(char *fieldname, const struct btf_type *type,
1113 struct fetch_insn **pcode, struct fetch_insn *end,
1176 struct traceprobe_parse_context *ctx)1114 struct traceprobe_parse_context *ctx)
1115{
1116 return -EOPNOTSUPP;
1117}
1118
1119static int handle_typecast(char *arg, struct traceprobe_parse_context *ctx)
1177{1120{
1178 trace_probe_log_err(ctx->offset, NOSUP_BTFARG);1121 trace_probe_log_err(ctx->offset, NOSUP_BTFARG);
1179 return -EOPNOTSUPP;1122 return -EOPNOTSUPP;
@@ -1598,9 +1541,7 @@ static int parse_probe_arg_mem_symbol(char *arg, struct fetch_insn **pcode, · 418 unmodified lines
1598 return 0;1541 return 0;
1599}1542}
1600 1543
1601static int parse_probe_arg_deref(char *arg, struct fetch_insn **pcode,1544static int parse_probe_arg_deref(char *arg, struct traceprobe_parse_context *ctx)
1602 struct fetch_insn *end,
1603 struct traceprobe_parse_context *ctx)
1604{1545{
1605 int deref = FETCH_OP_DEREF;1546 int deref = FETCH_OP_DEREF;
1606 long offset = 0;1547 long offset = 0;
@@ -1627,7 +1568,22 @@ static int parse_probe_arg_deref(char *arg, struct fetch_insn **pcode, · 20 unmodified lines
1627 }1568 }
1628 ctx->offset += (tmp + 1 - arg) + (arg[0] != '-' ? 1 : 0);1569 ctx->offset += (tmp + 1 - arg) + (arg[0] != '-' ? 1 : 0);
1629 arg = tmp + 1;1570 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;
1631}1587}
1632 1588
1633static int parse_probe_arg_imm(char *arg, struct fetch_insn *code,1589static 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
1659{1615{
1660 int ret;1616 int ret;
1661 1617
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
1667 if (isalpha(arg[0]) || arg[0] == '_') {1618 if (isalpha(arg[0]) || arg[0] == '_') {
1668 /* BTF variable or event field */1619 /* BTF variable or event field */
1669 if (ctx->flags & TPARG_FL_TEVENT) {1620 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
1685 return 0;1636 return 0;
1686}1637}
1687 1638
1688/* Recursive argument parser */1639static int parse_probe_arg_nested(char **parg, struct traceprobe_parse_context *ctx)
1689static int1640{
1690parse_probe_arg(char *arg, const struct fetch_type *type,1641 char *arg = *parg;
1691 struct fetch_insn **pcode, struct fetch_insn *end,1642 int ret;
1692 struct traceprobe_parse_context *ctx)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
1686static 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)
1693{1689{
1694 struct fetch_insn *code = *pcode;1690 struct fetch_insn *code = *pcode;
1695 int ret;1691 int ret;
@@ -1704,26 +1700,112 @@ parse_probe_arg(char *arg, const struct fetch_type *type, · 8 unmodified lines
1704 case '@': /* memory, file-offset or symbol */1700 case '@': /* memory, file-offset or symbol */
1705 ret = parse_probe_arg_mem_symbol(arg, pcode, end, ctx);1701 ret = parse_probe_arg_mem_symbol(arg, pcode, end, ctx);
1706 break;1702 break;
1707 case '+': /* deref memory */
1708 case '-':
1709 ret = parse_probe_arg_deref(arg, pcode, end, ctx);
1710 break;
1711 case '\\': /* Immediate value */1703 case '\\': /* Immediate value */
1712 ret = parse_probe_arg_imm(arg, code, ctx);1704 ret = parse_probe_arg_imm(arg, code, ctx);
1713 break;1705 break;
1714 case '(':
1715 ret = handle_typecast(arg, pcode, end, ctx);
1716 break;
1717 default:1706 default:
1718 ret = parse_probe_arg_default(arg, pcode, end, ctx);1707 ret = parse_probe_arg_default(arg, pcode, end, ctx);
1719 break;1708 break;
1720 }1709 }
1721 if (!ret && code->op == FETCH_OP_NOP) {1710
1711 if (ret)
1712 return ret;
1713
1714 if (code->op == FETCH_OP_NOP) {
1722 /* Parsed, but do not find fetch method */1715 /* Parsed, but do not find fetch method */
1723 trace_probe_log_err(ctx->offset, BAD_FETCH_ARG);1716 trace_probe_log_err(ctx->offset, BAD_FETCH_ARG);
1724 ret = -EINVAL;1717 return -EINVAL;
1725 }1718 }
1726 return ret;1719
1720 return 0;
1721}
1722
1723static 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 */
1791static int
1792parse_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);
1727}1809}
1728 1810
1729/* Bitfield type needs to be parsed into a fetch function */1811/* 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
1984 ctx);2066 ctx);
1985 if (ret < 0)2067 if (ret < 0)
1986 goto fail;2068 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
1993 /* Update storing type if BTF is available */2069 /* Update storing type if BTF is available */
1994 if (IS_ENABLED(CONFIG_PROBE_EVENTS_BTF_ARGS) &&2070 if (IS_ENABLED(CONFIG_PROBE_EVENTS_BTF_ARGS) &&
1995 ctx->last_type) {2071 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
437 return !!(flags & TPARG_FL_TEVENT);437 return !!(flags & TPARG_FL_TEVENT);
438}438}
439 439
440/* Each typecast consumes nested level. So the max number of typecast is 8. */
441#define TRACEPROBE_MAX_NESTED_LEVEL 8
442
443enum parse_state_type {
444 STATE_DEREF,
445 STATE_TYPECAST,
446};
447
448struct 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
440struct traceprobe_parse_context {468struct traceprobe_parse_context {
441 struct trace_event_call *event;469 struct trace_event_call *event;
442 /* BTF related parameters */470 /* BTF related parameters */
@@ -453,12 +481,11 @@ struct traceprobe_parse_context { · 10 unmodified lines
453 struct trace_probe *tp;481 struct trace_probe *tp;
454 unsigned int flags;482 unsigned int flags;
455 int offset;483 int offset;
456 int nested_level;
457 int prefix_byteoffs; /* The byte offset of the prefix field of typecast */484 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;
458};487};
459 488
460/* Each typecast consumes nested level. So the max number of typecast is 3. */
461#define TRACEPROBE_MAX_NESTED_LEVEL 3
462 489
463extern int traceprobe_parse_probe_arg(struct trace_probe *tp, int i,490extern int traceprobe_parse_probe_arg(struct trace_probe *tp, int i,
464 const char *argv,491 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
60 60
61# We've introduced this limitation with array support61# We've introduced this limitation with array support
62if grep -q ' <type>\\\[<array-size>\\\]' README; then62if grep -q ' <type>\\\[<array-size>\\\]' README; then
63check_error 'f vfs_read +0(^+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(@0))))))))))))))' # TOO_MANY_OPS?63check_error 'f vfs_read +0(+0(+0(+0(+0(+0(+0(+0(^+0(@0)))))))))' # TOO_MANY_NESTED
64check_error 'f vfs_read +0(@11):u8[10^' # ARRAY_NO_CLOSE64check_error 'f vfs_read +0(@11):u8[10^' # ARRAY_NO_CLOSE
65check_error 'f vfs_read +0(@11):u8[10]^a' # BAD_ARRAY_SUFFIX65check_error 'f vfs_read +0(@11):u8[10]^a' # BAD_ARRAY_SUFFIX
66check_error 'f vfs_read +0(@11):u8[^10a]' # BAD_ARRAY_NUM66check_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
114check_error 'f vfs_read ^file:string' # BAD_TYPE4STR114check_error 'f vfs_read ^file:string' # BAD_TYPE4STR
115if grep -qF "[(structname" README ; then115if grep -qF "[(structname" README ; then
116check_error 'f vfs_read arg1=(task_struct)file^' # TYPECAST_REQ_FIELD116check_error 'f vfs_read arg1=(task_struct)file^' # TYPECAST_REQ_FIELD
117check_error 'f vfs_read arg1=(a)((b)((c)(^(d)file->d)->c)->b)->a' # TOO_MANY_NESTED117check_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
118check_error 'f vfs_read arg1=(task_struct,^in_execve)file->comm' # TYPECAST_NOT_ALIGNED118check_error 'f vfs_read arg1=(task_struct,^in_execve)file->comm' # TYPECAST_NOT_ALIGNED
119check_error 'f vfs_read arg1=(task_struct,^foo_bar)file->pid' # NO_BTF_FIELD119check_error 'f vfs_read arg1=(task_struct,^foo_bar)file->pid' # NO_BTF_FIELD
120check_error 'f vfs_read arg1=(^task_struct1234)file->pid' # NO_PTR_STRCT120check_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
46 46
47# We've introduced this limitation with array support47# We've introduced this limitation with array support
48if grep -q ' <type>\\\[<array-size>\\\]' README; then48if grep -q ' <type>\\\[<array-size>\\\]' README; then
49check_error 't kfree +0(^+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(@0))))))))))))))' # TOO_MANY_OPS?49check_error 't kfree +0(+0(+0(+0(+0(+0(+0(+0(^+0(@0)))))))))' # TOO_MANY_NESTED
50check_error 't kfree +0(@11):u8[10^' # ARRAY_NO_CLOSE50check_error 't kfree +0(@11):u8[10^' # ARRAY_NO_CLOSE
51check_error 't kfree +0(@11):u8[10]^a' # BAD_ARRAY_SUFFIX51check_error 't kfree +0(@11):u8[10]^a' # BAD_ARRAY_SUFFIX
52check_error 't kfree +0(@11):u8[^10a]' # BAD_ARRAY_NUM52check_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
56 56
57# We've introduced this limitation with array support57# We've introduced this limitation with array support
58if grep -q ' <type>\\\[<array-size>\\\]' README; then58if grep -q ' <type>\\\[<array-size>\\\]' README; then
59check_error 'p vfs_read +0(^+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(@0))))))))))))))' # TOO_MANY_OPS?59check_error 'p vfs_read +0(+0(+0(+0(+0(+0(+0(+0(^+0(@0)))))))))' # TOO_MANY_NESTED
60check_error 'p vfs_read +0(@11):u8[10^' # ARRAY_NO_CLOSE60check_error 'p vfs_read +0(@11):u8[10^' # ARRAY_NO_CLOSE
61check_error 'p vfs_read +0(@11):u8[10]^a' # BAD_ARRAY_SUFFIX61check_error 'p vfs_read +0(@11):u8[10]^a' # BAD_ARRAY_SUFFIX
62check_error 'p vfs_read +0(@11):u8[^10a]' # BAD_ARRAY_NUM62check_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
117check_error 'r kfree ^$retval' # NO_RETVAL117check_error 'r kfree ^$retval' # NO_RETVAL
118if grep -qF "[(structname" README ; then118if grep -qF "[(structname" README ; then
119check_error 'p vfs_read arg1=(task_struct)file^' # TYPECAST_REQ_FIELD119check_error 'p vfs_read arg1=(task_struct)file^' # TYPECAST_REQ_FIELD
120check_error 'p vfs_read arg1=(a)((b)((c)(^(d)file->d)->c)->b)->a' # TOO_MANY_NESTED120check_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
121check_error 'p vfs_read arg1=(task_struct,^in_execve)file->comm' # TYPECAST_NOT_ALIGNED121check_error 'p vfs_read arg1=(task_struct,^in_execve)file->comm' # TYPECAST_NOT_ALIGNED
122check_error 'p vfs_read arg1=(task_struct,^foo_bar)file->pid' # NO_BTF_FIELD122check_error 'p vfs_read arg1=(task_struct,^foo_bar)file->pid' # NO_BTF_FIELD
123check_error 'p vfs_read arg1=(^task_struct1234)file->pid' # NO_PTR_STRCT123check_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