public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* System call interposition/unprotecting the table
@ 2007-08-13 22:05 hinoue
  2007-08-13 23:09 ` Alan Cox
  0 siblings, 1 reply; 14+ messages in thread
From: hinoue @ 2007-08-13 22:05 UTC (permalink / raw)
  To: linux-kernel

I have a question about changing the page attributes of the
system call table.

I am writing a kernel module that does some system call interposition.
This works fine on my debian system, but apparently the stock Fedora
kernel (2.6.22) has the system call table write protected.  So I would like
the module to add write permissions to the system call table before
it modifies it.

This is the code in my init_module that is problematic:

// Storing the original call
orig_kill = sys_call_table[__NR_kill];

// Change to write
pg = virt_to_page(sys_call_table);
change_page_attr(pg, 1, PAGE_KERNEL);
global_flush_tlb();

// Test write, should change nothing, but oopses instead
sys_call_table[__NR_kill] = (void*)orig_kill;

I imagine that I'm doing something obviously wrong; I've only been looking
at kernel code for a couple weeks.  Can someone please explain what my
error is?

-Hajime Inoue

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2007-08-18 10:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-13 22:05 System call interposition/unprotecting the table hinoue
2007-08-13 23:09 ` Alan Cox
2007-08-14  5:12   ` Avi Kivity
2007-08-14 11:34     ` Alan Cox
2007-08-14 14:22     ` James Morris
2007-08-14 17:27   ` Hajime Inoue
2007-08-14 17:48     ` Alan Cox
2007-08-14 17:57     ` Arjan van de Ven
2007-08-14 19:50     ` Andi Kleen
2007-08-14 21:09       ` Jan Engelhardt
2007-08-14 22:42       ` Alan Cox
2007-08-14 22:48         ` Andi Kleen
2007-08-17 14:19           ` Dave Jones
2007-08-18 10:37             ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox