mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@hpl.hp.com>
To: Paulo Marques <pmarques@grupopie.com>
Cc: linux-kernel@vger.kernel.org, perfmon@napali.hpl.hp.com
Subject: Re: /proc/kallsyms and symbol size
Date: Tue, 25 Sep 2007 23:50:47 -0700	[thread overview]
Message-ID: <20070926065047.GE1993@frankl.hpl.hp.com> (raw)
In-Reply-To: <46F93572.6070105@grupopie.com>

Paulo,

On Tue, Sep 25, 2007 at 05:21:06PM +0100, Paulo Marques wrote:
> Stephane Eranian wrote:
> >Hello,
> 
> Hi, Stephane
> 
> >Many monitoring tools use /proc/kallsyms to build a symbol table for the 
> >kernel.
> >This technique has the advantage that it does not require root privileges, 
> >nor
> >an up-to-date /boot/System.map, nor a decompressed kernel in /boot.
> >
> >The problem is that /proc/kallsyms does not report the size of the symbols.
> >Yet, the information is available in the kernel as it is used by functions 
> >such as __print_symbol(). Having the size is useful to correlate the address 
> >obtained
> >is a sample with a symbol name. Most tools use an approximation which 
> >assumes
> >symbols are contiguous to estimate the size.
> 
> That is actually what the kernel does internally, too. It does not keep 
> the size of the symbol, but tries to guess it from the address of the 
> next non-aliased symbol.
> 
> Since the addresses are sorted, this works fine most of the time. This 
> is done to reduce the size used by the symbol table in the running kernel.
> 
> Just take a look at "get_symbol_pos" in kernel/kallsyms.c and 
> "get_ksymbol" in kernel/module.c to see exactly how this is done
> 
Ok. Then we cannot really do better. 

Also thank you for alerting me on the aliased symbols. I have modified
my user code to only keep the first symbol.

Thanks for you help.

-- 

-Stephane

      reply	other threads:[~2007-09-26  6:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-24 20:55 Stephane Eranian
2007-09-25 16:21 ` Paulo Marques
2007-09-26  6:50   ` Stephane Eranian [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070926065047.GE1993@frankl.hpl.hp.com \
    --to=eranian@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perfmon@napali.hpl.hp.com \
    --cc=pmarques@grupopie.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®