0

I installed XenServer 6.0.0 and DDK, and I want to develop a kernel module, so I code a basic kprobes program. It is running OK on normal linux like redhat and output "Before sys_ioctl", but on XenServer it just output "Hypercall FI kernel module: init", and can not output "Before sys_ioctl".

So, what is the reason? XenServer doesn't support Kprobes or my program have bugs?

Here is my simple code. kp.addr is different based on cat /proc/kallsyms | grep sys_ioctl, and I tried do_fork, question is also exist.

#include <linux/kprobes.h>
#include <linux/kallsyms.h>
#include <linux/module.h>

static struct kprobe kp;

int handler_pre_target(struct kprobe *p, struct pt_regs *regs)
{
    printk("Before sys_ioctl\n");
    return 0;
}

static int __init myinit(void)
{
    kp.addr = (kprobe_opcode_t *) 0xc048498d;
    kp.pre_handler = handler_pre_target;
    register_kprobe(&kp);
    printk("Hypercall FI kernel module: init\n");
    return 0;
}

static void __exit myexit(void)
{
    unregister_kprobe(&kp);
    printk("Hypercall FI kernel module: exit\n");
}

module_init(myinit);
module_exit(myexit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("fg");
MODULE_DESCRIPTION("Hypercall test");
Feng Gang
  • 597
  • 1
  • 5
  • 10
  • It's likely that you don't have kprobe support on your Xen server. You can check it from /sys/kernel/debug/kprobes/enable. – rakib_ May 26 '13 at 07:28
  • @rakib Thank you, but there is no file named `kprobes` in `/sys/kernel/debug`,no matter XenServer or normal linux like RHEL 6.x. – Feng Gang May 28 '13 at 01:04

1 Answers1

0

Finally, I solved this problem. I used XenServer 6.1 and 6.1.0 ddk, and that's OK.

kernel version is:2.6.32.43-0.4.1.xs1.6.10.741.170752xen

I suspect it was a bug that can not use kprobes in XenServer 6.0.

Feng Gang
  • 597
  • 1
  • 5
  • 10