Re: sys_call_table [again]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Leon,

This code is for kernel modules that need to use
sys_call_table on kernels that is no longer exported.
If you follow this instructions you won't need to
recompile the kernel!!.

All you have to do is to modify your module adding:

....
#include <linux/syscall.h>
#include <asm/unistd.h>

static void **sys_call_table;
extern void *system_utsname;

removing if exists:

extern void *sys_call_table[];

then add a new function:

static int locate_sys_call_table(void) {
    unsigned long *begin;
    int i;

    begin=(unsigned long *) &system_utsname;
    for (i=0;i<1024;i++) {
        if (*(begin+i)==(unsigned long)
sys_socketcall) {
            sys_call_table=(void *)
(begin+i-__NR_socketcall);
            if (sys_call_table[__NR_exit]==(void *)
sys_exit) {
                printk("success: located
sys_call_table: %X\n",(unsigned
int) sys_call_table);
                return(1);
            }
        }
    }
    return(0);
}

and at the begin of the init function of the module:

if (!locate_sys_call_table()) return (-1);
 
That's all.

I hope this will solve your problems assuming that the
best way is patching the kernel, of course.

bye.

___________________________________________________
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux