[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201014093813.74490c26@gandalf.local.home>
Date: Wed, 14 Oct 2020 09:38:13 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...nel.org>
Subject: Re: [RFC PATCH 1/1] tracepoints: tree-wide: Replace %p with %px
On Wed, 14 Oct 2020 17:59:19 +0900
Masami Hiramatsu <mhiramat@...nel.org> wrote:
> To help debugging kernel, use %px to show real addresses on
> tracefs/trace file.
>
> Since ftrace human-readable format uses vsprintf(), all %p are
> translated to hash values instead of pointer address.
>
> However, when debugging the kernel, raw address value gives a
> hint when comparing with the memory mapping in the kernel.
> (Those are sometimes used with crash log, which is not hashed too)
>
> Moreover, this is not improving the security because the tracefs
> can be used only by root user and the raw address values are readable
> from tracefs/percpu/cpu*/trace_pipe_raw file.
>
> Note that this has been done by the following script.
>
> #!/bin/sh
> tmp=`mktemp`
> for h in include/trace/events/*.h ; do
> sed -e 's/\(%p\)\([^a-zA-Z]\)/\1x\2/g' $h > $tmp
> cp $tmp $h
> done
> rm $tmp
>
> Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
Hi Masami,
I think a better approach is to inject on the output side a conversion of
"%p" to "%px" before printing. That is, in the trace_raw_output_##call()
function, instead of calling trace_seq_printf(s, print), we call a new
function trace_event_printf(s, print), that will take the fmt parameter,
and copies it to something that does your 's/\(%p\)\([^a-zA-Z]\)/\1x\2/g'
inline before passing it off to trace_seq_printf().
-- Steve
Powered by blists - more mailing lists