Re: Accessing memory with /dev/port

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

 



On Sun, 3 Oct 2004 01:17:22 +0900, aq <aquynh@xxxxxxxxx> wrote:

> I heard that it is possible to modify the kernel memory via some
> special devices like /dev/mem, /dev/kmem, /dev/port and /dev/kcore.
> There are some papers about that techniques concerning /dev/mem and
> /dev/kmem, but I cannot find any information explaining how to do that
> (access and modify the memory of kernel) with /dev/port and
> /dev/kcore.
> 
> Anybody knows about these methods, please tell me?

The best thing to do is to consult the documentation for mmap and then
experiment with mapping these devices and making changes to the mapped
memory (make sure you perform any accesses to device memory using
volatile keywords in your pointer declarations). However I'd be really
very concerned if you want to actually modify kernel memory this way.

The best way to send information to or from the kernel is to use a
file in /proc and use conventional read/write file operations upon it.
The is the way we do things in UNIX.

Having said that, there can be times when mapping the raw memory is
useful - if for example you want to display the contents of various
bits of kernel data structures. I'm mulling the idea of writing a GUI
tool to visualise bits of kernel data graphically - I'm not bothered
by keeping it all in sync and up to date, just a view. I bet it's been
done.

Jon.

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