Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'probes-fixes-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull probe fixes from Masami Hiramatsu:

- probe-events: add NULL check for some BTF API calls which can return
error code and NULL.

- ftrace selftests: check fprobe and kprobe event correctly. This fixes
a miss condition of the test command.

- kprobes: do not allow probing functions that start with "__cfi_" or
"__pfx_" since those are auto generated for kernel CFI and not
executed.

* tag 'probes-fixes-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
kprobes: Prohibit probing on CFI preamble symbol
selftests/ftrace: Fix to check fprobe event eneblement
tracing/probes: Fix to add NULL check for BTF APIs

+18 -6
+13 -1
kernel/kprobes.c
··· 1545 1545 return 0; 1546 1546 } 1547 1547 1548 + static bool is_cfi_preamble_symbol(unsigned long addr) 1549 + { 1550 + char symbuf[KSYM_NAME_LEN]; 1551 + 1552 + if (lookup_symbol_name(addr, symbuf)) 1553 + return false; 1554 + 1555 + return str_has_prefix("__cfi_", symbuf) || 1556 + str_has_prefix("__pfx_", symbuf); 1557 + } 1558 + 1548 1559 static int check_kprobe_address_safe(struct kprobe *p, 1549 1560 struct module **probed_mod) 1550 1561 { ··· 1574 1563 within_kprobe_blacklist((unsigned long) p->addr) || 1575 1564 jump_label_text_reserved(p->addr, p->addr) || 1576 1565 static_call_text_reserved(p->addr, p->addr) || 1577 - find_bug((unsigned long)p->addr)) { 1566 + find_bug((unsigned long)p->addr) || 1567 + is_cfi_preamble_symbol((unsigned long)p->addr)) { 1578 1568 ret = -EINVAL; 1579 1569 goto out; 1580 1570 }
+4 -4
kernel/trace/trace_probe.c
··· 386 386 387 387 /* Get BTF_KIND_FUNC type */ 388 388 t = btf_type_by_id(btf, id); 389 - if (!btf_type_is_func(t)) 389 + if (!t || !btf_type_is_func(t)) 390 390 return ERR_PTR(-ENOENT); 391 391 392 392 /* The type of BTF_KIND_FUNC is BTF_KIND_FUNC_PROTO */ 393 393 t = btf_type_by_id(btf, t->type); 394 - if (!btf_type_is_func_proto(t)) 394 + if (!t || !btf_type_is_func_proto(t)) 395 395 return ERR_PTR(-ENOENT); 396 396 397 397 return t; ··· 443 443 if (!ctx->params) { 444 444 params = find_btf_func_param(ctx->funcname, &ctx->nr_params, 445 445 ctx->flags & TPARG_FL_TPOINT); 446 - if (IS_ERR(params)) { 446 + if (IS_ERR_OR_NULL(params)) { 447 447 trace_probe_log_err(ctx->offset, NO_BTF_ENTRY); 448 448 return PTR_ERR(params); 449 449 } ··· 1273 1273 1274 1274 params = find_btf_func_param(ctx->funcname, &nr_params, 1275 1275 ctx->flags & TPARG_FL_TPOINT); 1276 - if (IS_ERR(params)) { 1276 + if (IS_ERR_OR_NULL(params)) { 1277 1277 if (args_idx != -1) { 1278 1278 /* $arg* requires BTF info */ 1279 1279 trace_probe_log_err(0, NOSUP_BTFARG);
+1 -1
tools/testing/selftests/ftrace/test.d/dynevent/add_remove_btfarg.tc
··· 13 13 FPROBES=yes 14 14 fi 15 15 16 - if [ -z "$KPROBES" -a "$FPROBES" ] ; then 16 + if [ -z "$KPROBES" -a -z "$FPROBES" ] ; then 17 17 exit_unsupported 18 18 fi 19 19