lkml.org 
[lkml]   [2000]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: accessing kernel symbols
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.047 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site