Pages

Monday, March 2, 2015

Exporting System Call Table in 2 6 x Kernel

System call table was exported till 2.4 kernels, because of security reasons and preventing kernel crash from malicious applications system call table is no more exported. Here is the patch to export system call table.
                Hey...! patch is not something strange programming concept :), its just to edit few source files in kernel to export system call table. 

+ symbol implies the line of code to be added.
 - symbol implies the line of code to be removed.

Here is the patch....! (I am implementing for i386 architecture, as most of desktops are with this architecture)

1) open the file: /src/linux-2.6.32.21/arch/i386/kernel/entry.s

-.section .rodata,"a"
+.section .data,"aw"
#include "syscall_table.S"

syscall_table_size=(.-sys_call_table)
2) open the file: /src/linux-2.6.32.21/kernel/kallsyms.c
 
__initcall(kallsyms_init);

EXPORT_SYMBOL(__print_symbol);
+
+extern void *sys_call_table;
+EXPORT_SYMBOL(sys_call_table);
 
After modifications save changes to above files and rebuild the kernel so that System Call Table is exported in the next boot.

Read Me: I have ever read somewhere on the Internet, implementing a new system call is not the right way to control a module. The right way is to use ioctl() instead. More importantly, it is a silly thing to expose `sys_call_table for modules to fiddle with it. For experimentation its not big deal.....! have fun exporting sys_call_table.




Click here: How to build kernel source?

 




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.