Where in the linux code is linux's instruction memory made non writable?
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Where in the linux code is linux's instruction memory made non writable?
Hi,
I am a computer science student and doing a project on trying to find bugs in the linux kernel.
For that I needed to patch the linux instruction memory while the kernel is running. I have changed the code of the linux kernel to do this.
My code runs fine just as the kernel boots but then after 1-2 seconds when I try to write in the instruction memory the kernel panics. So most probably after the kernel is booted its instruction memory is made non writable by the kernel itself (as for 1-2 seconds I am able to change the instruction memory and for that time my code runs perfectly).
So it would be a great help to me if anyone could tell me where in the linux kernel code is the kernel's instruction memory is made non-writable.
I don't know why you would be doing this, when "/dev/mem" exists to enable rootly programs to do this sort of thing.
Kernel code is protected through the use of page and segment tables. Each process's view of "memory" is governed by these tables and the same is actually true of the kernel.
changing the linux code has to do with my project.
but as you said can we change the linux instruction memory using /dev/mem
if yes that will be great.
thanks for your help
Hi,
I tried /dev/mem to read and write in physical memory. But when I try to write to the location where kernel code is loaded it gives me a error. So I am still stuck on how do I make the linux kernel code writable while the kernel is running..
by linux's instruction memory i mean the memory where the kernel image is loaded, from where the cpu reads and execute instructions.
OK, I don't KNOW this, but the area of memory where the Linux kernel resides would be protected - how have you modified the kernel so that you can write to this memory?
OK, I don't KNOW this, but the area of memory where the Linux kernel resides would be protected - how have you modified the kernel so that you can write to this memory?
Do you have an understanding of protected mode?
I have changed the code of linux kernel to do that. but whenever my code try to write into instruction memory kernel panics.
Thought initially for about 1-2 sec I can write but after that I can't so it must be made non-writable by the kernel itself.
I don't know what protected mode you are talking about.
You program the Linux kernel, but you don't know what protected mode is???!! I would ask you to post a little of whatever code it is (I don't program in C), but as it is I don't think I can help you. Maybe someone else on this forum...?
You program the Linux kernel, but you don't know what protected mode is???!! I would ask you to post a little of whatever code it is (I don't program in C), but as it is I don't think I can help you. Maybe someone else on this forum...?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.