Memory access

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

 



Hello-
	I'm wondering if the following sequence of events is legal in a kernel
module, and if not, why.

Get our base pointer.
Use get_free_page() to get the kernel addresses of 2 pages of memory.  One
is used as a place-holder, the other as a holder for a pattern.
Set the pattern.
Disable interrupts (spin_lock_irqsave).
Copy a page of memory to one of the pages acquired above.  An arbitrary page
aligned kernel address is used (not the kernel, not the base pointer page,
and not one of the pages acquired above).
Copy a pattern into the arbitrary page-aligned kernel address.
Compare the arbitrary page-aligned kernel address to the pattern.
Restore the arbitrary page-aligned kernel address.
Enable interrupts (spin_lock_irqrestore).

	My question is with interrupts disabled, the overwriting of a piece of
memory not owned by us shouldn't matter as long as it is restored before
re-enabling interrupts, or are there memory management or kernel events that
I don't know of that will make this impossible?
	Using the base pointer, and knowing that the base pointer+size of module is
less than a page, is it safe to assume that the module is in fact in a
single page?

Troy Davis

--
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