Results 1 to 1 of 1
hai sir,
I am G.kumar raja studying 4th b.tech.I had a problem developing kernel program.So I would like to seek some help from the kernel developers.
Problem::
I had worked ...
- 12-08-2006 #1Just Joined!
- Join Date
- Dec 2006
- Posts
- 1
kernel function hijacking
hai sir,
I am G.kumar raja studying 4th b.tech.I had a problem developing kernel program.So I would like to seek some help from the kernel developers.
Problem::
I had worked out function hijacking mechanism by silvio and was successful except that as soon as i load the module the console is scrolling.But the problem i had is, I need the parameters of the hijacked function for developing my own function. Iam sending the code also
#define CODESIZE 7
static char originalcode[CODESIZE];
static char jmpcode[CODESIZE]=
"\xb8\x00\x00\x00\x00" /*movl $0,%eax*/
"\xff\xe0" /* jmp *%eax */
;
void modfun(unsigned int,int);
int (*getkeycode)(unsigned int scancode)=(int (*)(unsigned
int))0xc022fae0;
int keycode;
void (*kbd_keycode)(unsigned int keycode,int down,struct pt_regs
*regs)=
(void(*)(unsigned int keycode,int down,struct pt_regs
*regs))0xc0230d30;
int init_module(void)
{
printk(KERN_INFO "ENTERED INTO INIT MODULE\n");
keycode=(getkeycode(0x1e));
*(long *)&jmpcode[1]=(long)modfun;
memcpy(originalcode,kbd_keycode,CODESIZE);
memcpy(kbd_keycode,jmpcode,CODESIZE);
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "ENTERED INTO CLEANUP MODULE\n");
memcpy(kbd_keycode,originalcode,CODESIZE);
}
void modfun(unsigned int keycode,int down)
{
printk("ENTERED INTO MODIFIED FUNCTION\n");
if(keycode==30)
memcpy(kbd_keycode,originalcode,CODESIZE);
else
printk("KEY IS NOT 'a'\n");
}
kbd_keycode is the first function to be called when we press a key.


Reply With Quote