public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
* Re: Intercept System call using Kernel  module is 2.6 kernel
@ 2006-06-06 17:02 Jeff.Fellin
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff.Fellin @ 2006-06-06 17:02 UTC (permalink / raw)
  To: mmeswani; +Cc: linuxppc-dev, linuxppc-dev-bounces+jeff.fellin=rflelect.com

                                                                                                                                     
                      "Meswani, Mitesh" <mmeswani@utep•edu>                                                                          
                      Sent by:                                             To:       <linuxppc-dev@ozlabs•org>                       
                      linuxppc-dev-bounces+jeff.fellin=rflelect.com        cc:                                                       
                      @ozlabs.org                                          Subject:  Intercept System call using Kernel  module is   
                                                                            2.6 kernel                                               
                                                                                                                                     
                      06/06/2006 12:25                                                                                               
                                                                                                                                     
                                                                                                                                     










>Hello


>I am attempting to run some user code with kernel space permission. I am
using the ppc64 kernel version >2.6.16-rc4-3-ppc64 for IBM Power5
processors.
>In this kernel module I am trying to implement a function that can be
called from user space.
>
>I have found through various posts that using unused system calls and
replacing them temporarily can acheive this >objective.
>
>This is what I am doing, but its not working, please bear with the
slightly long code that follows:
>
>1) since the 2.6 kernel does not export sys_call_table, I grep it from the
boot image
First sign what you are doing is not a good idea. There are better methods
of this
1) device driver interface with read/write/ioctl interface
2) procfs files from a module/driver
3) sysfs files from a module/driver

SNIP
>
>The problem is that when I execute my user app I expect to see two things:
 >a) I should see a message in the log "Executing mitesh_func..." and
> b) A return value of 2
>However I get an error value -1 returned.
An indication of thinking of system calls vs other methods is wrong!.

>Any help and ideas are highly appreciated.
Don't add your own or hijack system calls

Thank you in advance,
Mitesh
 _______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs•org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread
* RE: Intercept System call using Kernel  module is 2.6 kernel
@ 2006-06-06 17:14 Jenkins, Clive
  0 siblings, 0 replies; 4+ messages in thread
From: Jenkins, Clive @ 2006-06-06 17:14 UTC (permalink / raw)
  To: Meswani, Mitesh, linuxppc-dev

>        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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-06-06 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <C26C730943E01145B4F89E37FE0A022002BBC7A2@itdsrvmail02.utep.edu>
2006-06-06 16:25 ` Intercept System call using Kernel module is 2.6 kernel Meswani, Mitesh
2006-06-06 17:48   ` Arnd Bergmann
2006-06-06 17:02 Jeff.Fellin
  -- strict thread matches above, loose matches on Subject: below --
2006-06-06 17:14 Jenkins, Clive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox