I used fmem project
https://github.com/NateBrune/fmem to access the physical memory through /dev/fmem dev without /dev/mem restrictions.
I tried this but i don't see any difference with PaX or without it in real working.
This my real plan of testing^
1. Load kernel without PaX
2. Load this program
- Code: Select all
#include <stdio.h> /* printf, scanf, NULL */
#include <stdlib.h> /* malloc, free, rand */
int main ()
{
int i,n;
char * buffer;
i = 8192;
buffer = (char*) malloc (i+1);
if (buffer==NULL) exit (1);
for (n=0; n<i; n++)
buffer[n]=rand()%26+'a';
buffer[i]='\0';
sleep(30);
printf("END\n");
return 0;
}
3. Dump process memory with py script through /proc/pid/pagemap and /proc/pid/maps to file.
4. Translate virtual memory addresses from /proc/pid/maps to physical offset of /dev/fmem device and dump it to another file with py script.
(3 and 4 output files are the same at this time). At this step i see content of the buffer in "[heap]" section of the maps file. This script makes file with offsets too.
5. Wait while 2. program will end.
6. Dump memory from /dev/fmem with offset file 4. in another file. There is no buffer content in that dump contrary to my expectations.
I repeat this step for PaX kernel and there is no any principal differences between dumps.
What iam doing wrong?