Re: accessing kernel symbols

From: gshekar@in.ibm.com
Date: Fri Jul 28 2000 - 01:01:15 EST


     Well, use of kernel symbol table (/proc/ksym) (or exporting
unavailable functions)inside module is fine. I was looking for alternative
way of accessing(using) kernel symbols from user space other than system
call(outside kernel module), is it possible.
 And for this one solution iam thinking of is creating new system call from
the loadable kernel module itself, so the user can get access as usual.
thanks
girish

Matthew Jacob <mjacob@feral.com> on 07/28/2000 02:31:10 AM

Please respond to mjacob@feral.com

To: Keith Owens <kaos@ocs.com.au>
cc: Tigran Aivazian <tigran@veritas.com>, Girish C
      Shekar/India/IBM@IBMIN, linux-kernel@vger.rutgers.edu
Subject: Re: accessing kernel symbols

Uh- sure- but that's not what I meant. gshekar didn't say *why* he wanted
it.
I myself would use a cat of /proc/ksyms to find out whether an SMP kernel
is
running or not to decide which driver to load (e.g.). I wouldn't use the
output of ksyms except as a hint for something useful (like which flavor
down
or __down is to be used this week)

On Fri, 28 Jul 2000, Keith Owens wrote:

> On Thu, 27 Jul 2000 09:24:47 -0700 (PDT),
> Matthew Jacob <mjacob@feral.com> wrote:
> >Even better (from a module writer's perspective) you can just read
/proc/ksyms
> >to get address/name pairs of the functions it would be reasonably safe
for
> >your module to bind to.
>
> No, please I beg you - NOOOO! Grabbing addresses out of /proc/ksyms
> and doing direct branches to them
>
> (a) Will not work on architectures where a function pointer is a
> descriptor instead of just an address (like IA64).
> (b) Does not put any reference count on the symbol you are using. If the
> symbol is in a module and there is no refernce count, it can be
> removed under you - splat! Al Viro just did a huge cleanup on
> module reference counts, don't introduce a mechanism that destroys
> that work.
>
> If you want to access a symbol from a module just refer to it by name.
> Of course the symbol has to be exported. If you need a symbol that is
> not currently exported you have to ask yourself should it be exported
> or are you looking for the wrong interface.
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:26 EST