The HyperNews Linux KHG Discussion Pages

Feedback: Re: Can I make syscall from inside a kernel module?

Forum: The Linux Kernel Hackers' Guide
Re: Question Can I make syscall from inside a kernel module? (Shawn Chang)
Keywords: syscall, module, lock physical page
Date: Sat, 17 Jan 1998 07:39:25 GMT
From: Massoud Asgharifard <asghari@ce.sharif.ac.ir>

hi, Well, no. when you are doing a syscall from user space, the syscall parameters are in segment register fs (assuming x86). The functions memcpy_fromfs and memcpy_tofs are called in kernel to retrieve the parameters for kernel function. but module code is kernel code anyway, and can't do that. (Segmentation fault....) (try rewriting the syscall, but reference kernel memory for parameters.) If you want to call kernel-internal-functions from your module code, (which is not exported normally) you should register it into file linux/kernel/ksyms.c this will export that function's name and insmod will install your module. Sorry for typos and mistakes, if any.