lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251023085937.0dbeac1fde692da17f5ec5a4@kernel.org>
Date: Thu, 23 Oct 2025 08:59:37 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Mark Rutland <mark.rutland@....com>, Mathieu Desnoyers
 <mathieu.desnoyers@...icios.com>, linux-kernel@...r.kernel.org,
 linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/2] tracing: Add an option to show symbols in
 _text+offset for function profiler

On Wed, 22 Oct 2025 12:32:59 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:

> On Thu, 23 Oct 2025 00:38:11 +0900
> "Masami Hiramatsu (Google)" <mhiramat@...nel.org> wrote:
> 
> > @@ -554,7 +556,29 @@ static int function_stat_show(struct seq_file *m, void *v)
> >  		return 0;
> >  #endif
> >  
> > -	kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
> > +	if (tr->trace_flags & TRACE_ITER(PROF_TEXT_OFFSET)) {
> > +		long offset;
> > +
> > +		if (core_kernel_text(rec->ip)) {
> > +			refsymbol = "_text";
> > +			offset = rec->ip - (unsigned long)_text;
> > +		} else {
> > +			struct module *mod;
> > +
> > +			guard(rcu)();
> > +			mod = __module_text_address(rec->ip);
> > +			if (mod) {
> > +				refsymbol = mod->name;
> > +				/* Calculate offset from module's text entry address. */
> > +				offset = rec->ip - (unsigned long)mod->mem[MOD_TEXT].base;
> > +			}
> > +		}
> > +		if (refsymbol)
> > +			snprintf(str, sizeof(str), "  %s%+ld", refsymbol, offset);
> 
> Let's be consistent as offsets are printed as hex every place else:

OK.

> 
> 			snprintf(str, sizeof(str), "  %s+%#lx", refsymbol, offset);
> 
> Also, did you mean to add the '+' after the '%'?

Ah, yes it is for the case if the offset < 0. It should not happen, but
for robustness.

Thank you,

> 
> -- Steve
> 
> 
> > +	}
> > +	if (!refsymbol)
> > +		kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
> > +
> >  	seq_printf(m, "  %-30.30s  %10lu", str, rec->counter);
> >  
> >  #ifdef CONFIG_FUNCTION_GRAPH_TRACER


-- 
Masami Hiramatsu (Google) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ