[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230213105633.006a22fc@rorschach.local.home>
Date: Mon, 13 Feb 2023 10:56:33 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Cc: Tom Zanussi <zanussi@...nel.org>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, akpm@...ux-foundation.org,
zwisler@...gle.com, chinglinyu@...gle.com
Subject: Re: [PATCH 1/4] tracing/histogram: Don't use strlen to find length
of stacktrace variables
On Tue, 14 Feb 2023 00:24:18 +0900
Masami Hiramatsu (Google) <mhiramat@...nel.org> wrote:
> > - e = stack_trace_save((void *)str,
> > + e = stack_trace_save((void *)stack_start,
> > HIST_STACKTRACE_DEPTH,
> > HIST_STACKTRACE_SKIP);
>
> BTW, the size of "str" is enough to store HIST_STACKTRACE_DEPTH?
> In string case,
>
> size = min(val->size, STR_VAR_LEN_MAX);
>
> will limit the max size.
Well, we have:
#define HIST_STACKTRACE_DEPTH 16
And 16 * 8 = 128
#define STR_VAR_LEN_MAX MAX_FILTER_STR_VAL
#define MAX_FILTER_STR_VAL 256U
So 128 < 256, with plenty of room. I wouldn't do this runtime, but we
should add here:
BUILD_BUG_ON((HIST_STACKTRACE_DEPTH + 1) * sizeof(long) >= STR_VAR_LEN_MAX);
-- Steve
Powered by blists - more mailing lists