Export sys_call_table

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

 



Hi there. I'd like to know if there is a way to export the
sys_call_table symbol in the kernel 2.6.28.7. i know it's a bad thing to
do but I need to to this for a didactical purpose. Here follows what
I've tried.

First of all, I made the sys_call_table writable modifing the section
definition in the following assembly file:

*----- file: arch/x86/kernel/entry_32.S ----*
-.section .rodata, "a"
+.section .data, "aw"

Then I exported the symbol:

*---- file: kernel/kallsyms.c ----*
+extern void *sys_call_table;
+EXPORT_SYMBOL(sys_call_table);

So, I built the kernel and tried to load a basic module that reads the
address of the read sys_call and substitutes it with a dummy wrapper.
The module compiles and loads without any complaint, but then I get this
error:

BUG: unable to handle kernel paging request at c022bd98
...
Oops: 0003 [#1]SMP
...

I understood that this is due to this line:

-> sys_call_table[__NR_read] = my_read;

i.e. the istruction that tries to modify the sys_call_table. If I get
rid of it and just leave the instruction that reads the address of the
read system call:

-> o_read = sys_call_table[__NR_read];

the module works without crashing.

Can anyone explain this to me? What did I do wrong?

Thanks,
Donato


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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