//------------------------------------------------------------------- // myexport.c // // This module provides a convenient 'workaround' for the fact // that newer versions of the official Linux kernel sources do // not export the 'sys_call_table[]' array as a public symbol. // // Using an accompanying shell script ('myscript'), the kernel // address for the 'sys_call_table[]' symbol is extracted from // the uncompressed kernel ('vmlinux'), and then supplied as a // command-line argument during installation of this module. // // NOTE: Written and tested using Linux kernel version 2.4.17. // // programmer: ALLAN CRUSE // written on: 24 JUN 2004 // revised on: 09 MAY 2005 -- for Linux kernel version 2.6.10 //------------------------------------------------------------------- #include // for init_module() #include // for sscanf() static char modname[] = "myexport"; unsigned long myval; char *svctable = "blah"; MODULE_PARM(svctable, "s"); unsigned long *sys_call_table; EXPORT_SYMBOL(sys_call_table); int init_module( void ) { printk( "<1>\nInstalling \'%s\' module ", modname ); printk( "with svctable=%s \n", svctable ); myval = simple_strtoul( svctable, 0, 16 ); if ( myval == 0 ) return -EINVAL; sys_call_table = (unsigned long*)myval; printk( "<1> sys_call_table[] at %p \n", sys_call_table ); return 0; // SUCCESS } void cleanup_module( void ) { printk( "<1>Removing \'%s\' module\n", modname ); } MODULE_LICENSE("GPL");