It serves no purpose beyond adding unnecessray argument passed to the filter callback. Just get rid of it, no one is actually using it.
Unified · Split
| @@ -28,20 +28,12 @@ struct page; · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | #define MAX_URETPROBE_DEPTH 64 |
| 30 | 30 | |
| 31 | −enum uprobe_filter_ctx { | |
| 32 | − UPROBE_FILTER_REGISTER, | |
| 33 | − UPROBE_FILTER_UNREGISTER, | |
| 34 | − UPROBE_FILTER_MMAP, | |
| 35 | −}; | |
| 36 | − | |
| 37 | 31 | struct uprobe_consumer { |
| 38 | 32 | int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); |
| 39 | 33 | int (*ret_handler)(struct uprobe_consumer *self, |
| 40 | 34 | unsigned long func, |
| 41 | 35 | struct pt_regs *regs); |
| 42 | − bool (*filter)(struct uprobe_consumer *self, | |
| 43 | − enum uprobe_filter_ctx ctx, | |
| 44 | − struct mm_struct *mm); | |
| 36 | + bool (*filter)(struct uprobe_consumer *self, struct mm_struct *mm); | |
| 45 | 37 | |
| 46 | 38 | struct uprobe_consumer *next; |
| 47 | 39 | }; |
| @@ -918,21 +918,19 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file, · 917 unmodified lines | ||
| 918 | 918 | return ret; |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | −static inline bool consumer_filter(struct uprobe_consumer *uc, | |
| 922 | − enum uprobe_filter_ctx ctx, struct mm_struct *mm) | |
| 921 | +static inline bool consumer_filter(struct uprobe_consumer *uc, struct mm_struct *mm) | |
| 923 | 922 | { |
| 924 | − return !uc->filter || uc->filter(uc, ctx, mm); | |
| 923 | + return !uc->filter || uc->filter(uc, mm); | |
| 925 | 924 | } |
| 926 | 925 | |
| 927 | −static bool filter_chain(struct uprobe *uprobe, | |
| 928 | − enum uprobe_filter_ctx ctx, struct mm_struct *mm) | |
| 926 | +static bool filter_chain(struct uprobe *uprobe, struct mm_struct *mm) | |
| 929 | 927 | { |
| 930 | 928 | struct uprobe_consumer *uc; |
| 931 | 929 | bool ret = false; |
| 932 | 930 | |
| 933 | 931 | down_read(&uprobe->consumer_rwsem); |
| 934 | 932 | for (uc = uprobe->consumers; uc; uc = uc->next) { |
| 935 | − ret = consumer_filter(uc, ctx, mm); | |
| 933 | + ret = consumer_filter(uc, mm); | |
| 936 | 934 | if (ret) |
| 937 | 935 | break; |
| 938 | 936 | } |
| @@ -1099,12 +1097,10 @@ register_for_each_vma(struct uprobe *uprobe, struct uprobe_consumer *new) · 160 unmodified lines | ||
| 1099 | 1097 | |
| 1100 | 1098 | if (is_register) { |
| 1101 | 1099 | /* consult only the "caller", new consumer. */ |
| 1102 | − if (consumer_filter(new, | |
| 1103 | − UPROBE_FILTER_REGISTER, mm)) | |
| 1100 | + if (consumer_filter(new, mm)) | |
| 1104 | 1101 | err = install_breakpoint(uprobe, mm, vma, info->vaddr); |
| 1105 | 1102 | } else if (test_bit(MMF_HAS_UPROBES, &mm->flags)) { |
| 1106 | − if (!filter_chain(uprobe, | |
| 1107 | − UPROBE_FILTER_UNREGISTER, mm)) | |
| 1103 | + if (!filter_chain(uprobe, mm)) | |
| 1108 | 1104 | err |= remove_breakpoint(uprobe, mm, info->vaddr); |
| 1109 | 1105 | } |
| 1110 | 1106 | |
| @@ -1387,7 +1383,7 @@ int uprobe_mmap(struct vm_area_struct *vma) · 276 unmodified lines | ||
| 1387 | 1383 | */ |
| 1388 | 1384 | list_for_each_entry_safe(uprobe, u, &tmp_list, pending_list) { |
| 1389 | 1385 | if (!fatal_signal_pending(current) && |
| 1390 | − filter_chain(uprobe, UPROBE_FILTER_MMAP, vma->vm_mm)) { | |
| 1386 | + filter_chain(uprobe, vma->vm_mm)) { | |
| 1391 | 1387 | unsigned long vaddr = offset_to_vaddr(vma, uprobe->offset); |
| 1392 | 1388 | install_breakpoint(uprobe, vma->vm_mm, vma, vaddr); |
| 1393 | 1389 | } |
| @@ -3320,8 +3320,7 @@ static int uprobe_prog_run(struct bpf_uprobe *uprobe, · 3319 unmodified lines | ||
| 3320 | 3320 | } |
| 3321 | 3321 | |
| 3322 | 3322 | static bool |
| 3323 | −uprobe_multi_link_filter(struct uprobe_consumer *con, enum uprobe_filter_ctx ctx, | |
| 3324 | − struct mm_struct *mm) | |
| 3323 | +uprobe_multi_link_filter(struct uprobe_consumer *con, struct mm_struct *mm) | |
| 3325 | 3324 | { |
| 3326 | 3325 | struct bpf_uprobe *uprobe; |
| 3327 | 3326 | |
| @@ -1078,9 +1078,7 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e · 1077 unmodified lines | ||
| 1078 | 1078 | return trace_handle_return(s); |
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | −typedef bool (*filter_func_t)(struct uprobe_consumer *self, | |
| 1082 | − enum uprobe_filter_ctx ctx, | |
| 1083 | − struct mm_struct *mm); | |
| 1081 | +typedef bool (*filter_func_t)(struct uprobe_consumer *self, struct mm_struct *mm); | |
| 1084 | 1082 | |
| 1085 | 1083 | static int trace_uprobe_enable(struct trace_uprobe *tu, filter_func_t filter) |
| 1086 | 1084 | { |
| @@ -1339,8 +1337,7 @@ static int uprobe_perf_open(struct trace_event_call *call, · 252 unmodified lines | ||
| 1339 | 1337 | return err; |
| 1340 | 1338 | } |
| 1341 | 1339 | |
| 1342 | −static bool uprobe_perf_filter(struct uprobe_consumer *uc, | |
| 1343 | − enum uprobe_filter_ctx ctx, struct mm_struct *mm) | |
| 1340 | +static bool uprobe_perf_filter(struct uprobe_consumer *uc, struct mm_struct *mm) | |
| 1344 | 1341 | { |
| 1345 | 1342 | struct trace_uprobe_filter *filter; |
| 1346 | 1343 | struct trace_uprobe *tu; |
| @@ -1426,7 +1423,7 @@ static void __uprobe_perf_func(struct trace_uprobe *tu, · 79 unmodified lines | ||
| 1426 | 1423 | static int uprobe_perf_func(struct trace_uprobe *tu, struct pt_regs *regs, |
| 1427 | 1424 | struct uprobe_cpu_buffer **ucbp) |
| 1428 | 1425 | { |
| 1429 | − if (!uprobe_perf_filter(&tu->consumer, 0, current->mm)) | |
| 1426 | + if (!uprobe_perf_filter(&tu->consumer, current->mm)) | |
| 1430 | 1427 | return UPROBE_HANDLER_REMOVE; |
| 1431 | 1428 | |
| 1432 | 1429 | if (!is_ret_probe(tu)) |