mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Calling kernel functions from kprobes/jprobes
@ 2006-06-27  8:00 Samuel
  2006-06-27  9:53 ` Alan Cox
  2006-06-27 15:12 ` Frank Ch. Eigler
  0 siblings, 2 replies; 4+ messages in thread
From: Samuel @ 2006-06-27  8:00 UTC (permalink / raw)
  To: linux-kernel


Hi,

I am using kprobes/jprobes to try and understand how IP options are handled in the kernel. From one of these probes I want to call another function inside the kernel, namely ip_options_get_from_user. It is defined in net/ipv4/ip_options.c and declared in include/net/ip.h. I have included the ip.h header file in my probe, but on compilation I get a warning saying the function is undefined. Also, inserting the probe fails - "Unknown symbol in module".

Any help would be appreciated.

BR,

Samuel Korpi

_______________________________________________
No banners. No pop-ups. No kidding.
Make My Way  your home on the Web - http://www.myway.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Calling kernel functions from kprobes/jprobes
  2006-06-27  8:00 Calling kernel functions from kprobes/jprobes Samuel
@ 2006-06-27  9:53 ` Alan Cox
  2006-06-27 15:12 ` Frank Ch. Eigler
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Cox @ 2006-06-27  9:53 UTC (permalink / raw)
  To: samuelkorpi; +Cc: linux-kernel

Ar Maw, 2006-06-27 am 04:00 -0400, ysgrifennodd Samuel:
> Hi,
> 
> I am using kprobes/jprobes to try and understand how IP options are
> handled in the kernel. From one of these probes I want to call another
> function inside the kernel, namely ip_options_get_from_user. It is
> defined in net/ipv4/ip_options.c and declared in include/net/ip.h. I
> have included the ip.h header file in my probe, but on compilation I
> get a warning saying the function is undefined. Also, inserting the
> probe fails - "Unknown symbol in module".

Not all symbols are visible or kept. If you want to explore the
internals of the kernel in more depth like this you might find building
user mode linux with debugging enabled and using gdb is both easier and
a lot more fun.

Alan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Calling kernel functions from kprobes/jprobes
  2006-06-27  8:00 Calling kernel functions from kprobes/jprobes Samuel
  2006-06-27  9:53 ` Alan Cox
@ 2006-06-27 15:12 ` Frank Ch. Eigler
  1 sibling, 0 replies; 4+ messages in thread
From: Frank Ch. Eigler @ 2006-06-27 15:12 UTC (permalink / raw)
  To: samuelkorpi; +Cc: linux-kernel

"Samuel" <samuelkorpi@myway.com> writes:

> [...]  I am using kprobes/jprobes to try and understand how IP
> options are handled in the kernel. From one of these probes I want
> to call another function inside the kernel, namely
> ip_options_get_from_user. [...]

Other than symbol exporting issues, you may encounter another problem
that we have encountered in systemtap (which is also a kprobes
client).  That is that the context where the kprobe was placed may be
such that calling most ordinary kernel routines is unsafe.  In
particular, ip_options_get_from_user may sleep, which may or may not
be legal from the context of the kprobe.  (In systemtap probes, we
don't permit anything to block/sleep/schedule, so instead suffer
absent-page errors.)

- FChE

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Calling kernel functions from kprobes/jprobes
@ 2006-06-27 11:20 Samuel Korpi
  0 siblings, 0 replies; 4+ messages in thread
From: Samuel Korpi @ 2006-06-27 11:20 UTC (permalink / raw)
  To: alan, samuelkorpi; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="US-ASCII", Size: 763 bytes --]



 --- On Tue 06/27, Alan Cox < alan@lxorguk.ukuu.org.uk > wrote:

> Not all symbols are visible or kept. If you want to explore the internals of the
> kernel in more depth like this you might find building user mode linux with 
> debugging enabled and using gdb is both easier and a lot more fun.

Hmm. I´ll have to take a look at that. http://user-mode-linux.sourceforge.net/ seems to have something on the subject. Are there any other good places to look for info (tutorials etc.)?

However, just to make things clear - is there any way of finding out which symbols are visible to kernel modules?

Br,

Samuel Korpi

_______________________________________________
No banners. No pop-ups. No kidding.
Make My Way  your home on the Web - http://www.myway.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-06-27 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-27  8:00 Calling kernel functions from kprobes/jprobes Samuel
2006-06-27  9:53 ` Alan Cox
2006-06-27 15:12 ` Frank Ch. Eigler
2006-06-27 11:20 Samuel Korpi

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®