Skip to content

Commit 2b2c0f2

Browse files
committed
Merge tag 'trace-v5.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
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
2 parents df36588 + 6bbfa44 commit 2b2c0f2

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

include/linux/kprobes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ struct kretprobe {
153153
struct kretprobe_holder *rph;
154154
};
155155

156+
#define KRETPROBE_MAX_DATA_SIZE 4096
157+
156158
struct kretprobe_instance {
157159
union {
158160
struct freelist_node freelist;

kernel/kprobes.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,6 +2086,9 @@ int register_kretprobe(struct kretprobe *rp)
20862086
}
20872087
}
20882088

2089+
if (rp->data_size > KRETPROBE_MAX_DATA_SIZE)
2090+
return -E2BIG;
2091+
20892092
rp->kp.pre_handler = pre_handler_kretprobe;
20902093
rp->kp.post_handler = NULL;
20912094

kernel/trace/trace_events_hist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3757,7 +3757,7 @@ static int check_synth_field(struct synth_event *event,
37573757

37583758
if (strcmp(field->type, hist_field->type) != 0) {
37593759
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))
37613761
return -EINVAL;
37623762
}
37633763

kernel/trace/tracing_map.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/jhash.h>
1616
#include <linux/slab.h>
1717
#include <linux/sort.h>
18+
#include <linux/kmemleak.h>
1819

1920
#include "tracing_map.h"
2021
#include "trace.h"
@@ -307,6 +308,7 @@ static void tracing_map_array_free(struct tracing_map_array *a)
307308
for (i = 0; i < a->n_pages; i++) {
308309
if (!a->pages[i])
309310
break;
311+
kmemleak_free(a->pages[i]);
310312
free_page((unsigned long)a->pages[i]);
311313
}
312314

@@ -342,6 +344,7 @@ static struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts,
342344
a->pages[i] = (void *)get_zeroed_page(GFP_KERNEL);
343345
if (!a->pages[i])
344346
goto free;
347+
kmemleak_alloc(a->pages[i], PAGE_SIZE, 1, GFP_KERNEL);
345348
}
346349
out:
347350
return a;

0 commit comments

Comments
 (0)