I am trying to read a physical memory address in a device running embedded Linux with our application. The widely suggested method is to use mmap, convert it into virtual address and then read the value.
Now I would like to know if it a man in the midde attack is possible by replacing the standard mmap library with a spurious mmap library? That is, can a hacker prevent me from reading the intended value from the underlying hardware? Is there a secure way to read the physical address?
In other words I am looking to read a physical address and I would like to know the value that I read is from the actual hardware and not a spoofed value.