Marking a page read-only (because of kexec segments being corrupted)
Hello all,
We are facing a strange corruption of the segment which is loaded using kexec command.
The steps which are we following is this
- Loading a new kernel using "kexec -l" command and then
- We are doing many proprietary shutdowns of the devices and finally we are executing
- "kexec -e" to jump to the new kernel.
Between the "kexec -l" and "kexec -e" our proprietary code is going and corrupting the loaded the segments and hence we couldn't successfully execute the new kernel (the system is hung not even early debugs are printed from the new kernel). But if we execute "kexec -e" immediately after "kexec -l" the new kernel executes perfectly.
In order to find who is the culprit, I want to mark the pages which are allocated as part of segment loading as read-only(after copying the content), so that if someone tries to write it throws an exception and we can catch it easily. To do that I want to mark the pages which are returned by alloc_pages(GFP_HIGHUSER, 0) as read-only after the required content is copied.
Could you please let me know how to do this ?
Thanks,
Senthil
|