Skip to contentSkip to conversation

tracing/filters: strloc should be unsigned short

PATCH In review Li Zefan 2 participants 2 messages May 29, 2009 Tracing

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/2 tracing/filters: strloc should be unsigned short

I forgot to update filter code accordingly in "tracing/events: change the type of __str_loc_item to unsigned short" (commt b0aae68cc5508f3c2fbf728988c954db4c8b8a53)

It can cause system crash:

 # echo 1 > tracing/events/irq/irq_handler_entry/enable
 # echo 'name == eth0' > /mnt/tracing/events/irq/irq_handler_entry/filter

[ Impact: fix system crash while filtering on __string() field ]

---
 kernel/trace/trace_events_filter.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/trace_events_filter.c +1 -1
index a7430b1..a854eed 100644
@@ -178,7 +178,7 @@ static int filter_pred_string(struct filter_pred *pred, void *event,
 static int filter_pred_strloc(struct filter_pred *pred, void *event,
 			      int val1, int val2)
 {
-	int str_loc = *(int *)(event + pred->offset);
+	unsigned short str_loc = *(unsigned short *)(event + pred->offset);
 	char *addr = (char *)(event + str_loc);
 	int cmp, match;
 
Signature · 1 line
1.5.4.rc3
#1 lore raw

2009/5/29 Li Zefan <[email protected]>:

Quoted 21 lines

I forgot to update filter code accordingly in "tracing/events: change the type of __str_loc_item to unsigned short" (commt b0aae68cc5508f3c2fbf728988c954db4c8b8a53)

It can cause system crash:

 # echo 1 > tracing/events/irq/irq_handler_entry/enable
 # echo 'name == eth0' > /mnt/tracing/events/irq/irq_handler_entry/filter

[ Impact: fix system crash while filtering on __string() field ]

---
 kernel/trace/trace_events_filter.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/trace_events_filter.c +0 -0
index a7430b1..a854eed 100644

kernel/trace/trace_events_filter.c static int filter_pred_string(struct filter_pred *pred, void *event, · line 181

Quoted 5 lines
kernel/trace/trace_events_filter.c +1 -1
@@ -178,7 +178,7 @@ static int filter_pred_string(struct filter_pred *pred, void *event,
  static int filter_pred_strloc(struct filter_pred *pred, void *event,
                              int val1, int val2)
  {
-       int str_loc = *(int *)(event + pred->offset);
+       unsigned short str_loc = *(unsigned short *)(event + pred->offset);

Ouch, indeed :-)

I will apply this one and send it to Ingo, thanks!

Quoted 7 lines
kernel/trace/trace_events_filter.c +0 -1
        char *addr = (char *)(event + str_loc);
        int cmp, match;
 
--

1.5.4.rc3