RE: Intercept System call using Kernel module is 2.6 kernel
From: Jenkins, Clive <hidden>
Date: 2006-06-06 17:51:41
x=3Dmitesh_func();=20
printf("mitesh_func returned %d\n",x);
The first thing would be to change your user-space program
to print the error number from errno after your "system call".
x=3Dmitesh_func();=20
printf("mitesh_func returned %d, errno=3D%d\n",x,errno);
Or you can use perror() -- look it up.
Clive
=20
4) I verify from the system logs that when I insmod the kernel module I
get all the print statements. I verified from the logs that the address
of the sys_call_table is correctly passed and from /proc/kallsysms I can
see that my function mitesh_func has been defined and has the address as
indicated in the logs.=20
The problem is that when I execute my user app I expect to see two
things:=20
a) I should see a message in the log "Executing mitesh_func..." and=20
b) A return value of 2=20
However I get an error value -1 returned.=20
Any help and ideas are highly appreciated. =20
Thank you in advance,=20
Mitesh=20