Re: [PATCH] kprobes for 2.5.47

Vamsi Krishna S . (vamsi@in.ibm.com)
Wed, 13 Nov 2002 12:52:33 +0530


On Tue, Nov 12, 2002 at 05:58:39PM -0800, Rusty Lynch wrote:
> When register_kprobe() is called with a bad addr, we crash the kernel.
> Should it be the reponsibility of the caller, or the kernel to make sure the
> addr is ok?
>
kprobes is an in-kernel low-level interface for placing probes. The user
of the interface is going to be the kernel itself or a kernel module. It
is the responsibility of the caller (which too is in kernel space) to
ensure that:

- register_kprobe is called with a valid address
- that address is at the beginning of an instruction.

So, IMO these address checks don't belong in register_kprobe.

> BTW, I have a stupid little sample char driver that reads in address/message
> pairs and then adds a probe that printk's the message at the address. This
> was just my way of learning how to use kprobes. Should I post it? I would
> love to get feedback on what I did wrong, but I hate to spam the list.
>
This driver gets input (address to put probe at) from user, like all user
this address needs to be validated, in this driver. I am writing a kernel
module on top of kprobes that interacts with the user and provides
higher level of functionality (similar to dprobes) than what is provided
by the raw kprobes interface. It is in this module that all the user input
including addresses are validated before calling register_kprobe.

Regards,
Vamsi.

-- 
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: vamsi@in.ibm.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/