Support perf-style return probe ("SYMBOL%return") for uprobe events as same as kprobe events does. Link: https://lkml.kernel.org/r/159972814601.428528.7641183316212425445.stgit@devnote2
Showing the changes to kernel (2 of 2 files). Show all
Unified · Split
| @@ -5125,7 +5125,7 @@ static const char readme_msg[] = · 5124 unmodified lines | ||
| 5125 | 5125 | "place (kretprobe): [<module>:]<symbol>[+<offset>]%return|<memaddr>\n" |
| 5126 | 5126 | #endif |
| 5127 | 5127 | #ifdef CONFIG_UPROBE_EVENTS |
| 5128 | − " place (uprobe): <path>:<offset>[(ref_ctr_offset)]\n" | |
| 5128 | + " place (uprobe): <path>:<offset>[%return][(ref_ctr_offset)]\n" | |
| 5129 | 5129 | #endif |
| 5130 | 5130 | "\t args: <name>=fetcharg[:type]\n" |
| 5131 | 5131 | "\t fetcharg: %<register>, @<address>, @<symbol>[+|-<offset>],\n" |
| @@ -528,7 +528,7 @@ end: · 527 unmodified lines | ||
| 528 | 528 | |
| 529 | 529 | /* |
| 530 | 530 | * Argument syntax: |
| 531 | − * - Add uprobe: p|r[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS] | |
| 531 | + * - Add uprobe: p|r[:[GRP/]EVENT] PATH:OFFSET[%return][(REF)] [FETCHARGS] | |
| 532 | 532 | */ |
| 533 | 533 | static int trace_uprobe_create(int argc, const char **argv) |
| 534 | 534 | { |
| @@ -617,6 +617,19 @@ static int trace_uprobe_create(int argc, const char **argv) · 82 unmodified lines | ||
| 617 | 617 | } |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | + /* Check if there is %return suffix */ | |
| 621 | + tmp = strchr(arg, '%'); | |
| 622 | + if (tmp) { | |
| 623 | + if (!strcmp(tmp, "%return")) { | |
| 624 | + *tmp = '\0'; | |
| 625 | + is_return = true; | |
| 626 | + } else { | |
| 627 | + trace_probe_log_err(tmp - filename, BAD_ADDR_SUFFIX); | |
| 628 | + ret = -EINVAL; | |
| 629 | + goto fail_address_parse; | |
| 630 | + } | |
| 631 | + } | |
| 632 | + | |
| 620 | 633 | /* Parse uprobe offset. */ |
| 621 | 634 | ret = kstrtoul(arg, 0, &offset); |
| 622 | 635 | if (ret) { |