Re: Memory access

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

 



On Fri, 01 Aug 2003 12:56:01 -0700, Troy Davis wrote:

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

So basically you want to overwrite some arbitrary memory and then restore it
to its original value? On SMP your kernel will die a horrible death.

Wes Felter - wesley@felter.org - http://felter.org/wesley/

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