Re: [RFC] kreplace: Rebootless kernel updates

From: Masami Hiramatsu
Date: Fri Nov 21 2008 - 09:42:01 EST


Hi Nikanth,

Nikanth Karthikesan wrote:
This RFC patch adds support for limited form of rebootless kernel patching even without building the entire kernel.

When looking for a shortcut to avoid the rebuild/reboot cycle when hacking the kernel - the ksplice[1] was posted. This patch extends kprobes to do something similar, which would require even lesser time to _experiment_ with the running kernel.

This small patch extends jprobes so that the jprobe's handler is executed but skips executing the actual function. But this has its own limitations such as Cannot access symbols not exported for modules (ofcourse hacks like pointers[2] can be used.), problems related to return values[3], etc... This is currently a x86_64 only _hack_.

Hmm,
Would you like to replace a function to another function?
If so, AFAIK, you can do that with kprobe and below pre_handler.
(see booster enabled path in setup_singlestep())

pre_handler(...)
{
reset_current_kprobe(); /* this kprobe doesn't need any more */
regs->ip = new_function; /* change IP to new function */
preempt_enable_no_resched(); /* recover preempt count */
return 1; /* No need to setup singlestep */
}

Thank you,


--
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@xxxxxxxxxx

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