Messages in this thread | | | Date | Mon, 5 Sep 2022 11:29:00 -0400 | From | Steven Rostedt <> | Subject | Re: [PATCH 2/4] tracing/hist: Call hist functions directly via a switch statement |
| |
On Mon, 5 Sep 2022 22:48:49 +0900 Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> Hi Steve, > > I found this crashed the kernel if I ran > > # ftracetest test.d/trigger/trigger-hist-expressions.tc > > More specifically, here is the minimum reproduce command. > > # echo "hist:keys=common_pid:x=16-8-4" > events/sched/sched_process_fork/trigger > [ 75.874402] BUG: kernel NULL pointer dereference, address: 0000000000000038 > [ 75.875378] #PF: supervisor read access in kernel mode > > I investigated it and found you missed to set correct fn_num for > combined constant field; > > > @@ -2725,7 +2748,8 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, > > if (var2) > > expr->operands[1] = var2; > > > > - expr->constant = op_fn(expr, NULL, NULL, NULL, NULL); > > + expr->fn_num = op_fn; > > + expr->constant = hist_fn_call(expr, NULL, NULL, NULL, NULL); > > > > expr->operands[0] = NULL; > > expr->operands[1] = NULL; > > Here, we need this; > > expr->fn_num = HIST_FIELD_FN_CONST; > > Without this fix, the binary op_fn is kept on this const field and it > causes the problem because the const field doesn't have operands. >
Thanks Masami,
Today is a US holiday, and I'm only cleaning out some email (and working on my LPC presentation for tomorrow's speaker's training), but not doing any other work. I'll look at this tomorrow.
-- Steve
| |