Pull tracing fixes from Steven Rostedt: "Three tracing fixes: - Allow compares of strings when using signed and unsigned characters - Fix kmemleak false positive for histogram entries - Handle negative numbers for user defined kretprobe data sizes" * tag 'trace-v5.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: kprobes: Limit max data_size of the kretprobe instances tracing: Fix a kmemleak false positive in tracing_map tracing/histograms: String compares should not care about signed values
Unified · Split
| @@ -153,6 +153,8 @@ struct kretprobe { · 152 unmodified lines | ||
| 153 | 153 | struct kretprobe_holder *rph; |
| 154 | 154 | }; |
| 155 | 155 | |
| 156 | +#define KRETPROBE_MAX_DATA_SIZE 4096 | |
| 157 | + | |
| 156 | 158 | struct kretprobe_instance { |
| 157 | 159 | union { |
| 158 | 160 | struct freelist_node freelist; |
| @@ -2086,6 +2086,9 @@ int register_kretprobe(struct kretprobe *rp) · 2085 unmodified lines | ||
| 2086 | 2086 | } |
| 2087 | 2087 | } |
| 2088 | 2088 | |
| 2089 | + if (rp->data_size > KRETPROBE_MAX_DATA_SIZE) | |
| 2090 | + return -E2BIG; | |
| 2091 | + | |
| 2089 | 2092 | rp->kp.pre_handler = pre_handler_kretprobe; |
| 2090 | 2093 | rp->kp.post_handler = NULL; |
| 2091 | 2094 | |
| @@ -3757,7 +3757,7 @@ static int check_synth_field(struct synth_event *event, · 3756 unmodified lines | ||
| 3757 | 3757 | |
| 3758 | 3758 | if (strcmp(field->type, hist_field->type) != 0) { |
| 3759 | 3759 | if (field->size != hist_field->size || |
| 3760 | − field->is_signed != hist_field->is_signed) | |
| 3760 | + (!field->is_string && field->is_signed != hist_field->is_signed)) | |
| 3761 | 3761 | return -EINVAL; |
| 3762 | 3762 | } |
| 3763 | 3763 | |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/jhash.h> |
| 16 | 16 | #include <linux/slab.h> |
| 17 | 17 | #include <linux/sort.h> |
| 18 | +#include <linux/kmemleak.h> | |
| 18 | 19 | |
| 19 | 20 | #include "tracing_map.h" |
| 20 | 21 | #include "trace.h" |
| @@ -307,6 +308,7 @@ static void tracing_map_array_free(struct tracing_map_array *a) · 286 unmodified lines | ||
| 307 | 308 | for (i = 0; i < a->n_pages; i++) { |
| 308 | 309 | if (!a->pages[i]) |
| 309 | 310 | break; |
| 311 | + kmemleak_free(a->pages[i]); | |
| 310 | 312 | free_page((unsigned long)a->pages[i]); |
| 311 | 313 | } |
| 312 | 314 | |
| @@ -342,6 +344,7 @@ static struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts, · 29 unmodified lines | ||
| 342 | 344 | a->pages[i] = (void *)get_zeroed_page(GFP_KERNEL); |
| 343 | 345 | if (!a->pages[i]) |
| 344 | 346 | goto free; |
| 347 | + kmemleak_alloc(a->pages[i], PAGE_SIZE, 1, GFP_KERNEL); | |
| 345 | 348 | } |
| 346 | 349 | out: |
| 347 | 350 | return a; |