How 2 procecces can corrupt each other while having different virtual memory space

61 views Asked by At

As I understand, every process has its own virtual address space (2 processes can have the same range, but the OS will map the logical addresses to different physical addresses). I read about memory corruption which might happen, for example, when process A change data belongs to process B.

Qu 1: How is is possible? process A can use any of its virtual address space, and if it tries to write to an address (in a page) which it didn't use yet, the OS will make a page fault. And if the address is forbidden to access, so the process will get an alert. So, there is no option that process A changes the data of process B because the virtual address space of process A is not related at all to the virtual address space of process B. The MMU will always map process A's virtual address to a page it owns, or unmapped page and therefore a page fault will happen, but there is no case to map it to a process B's physical address. As I see it, a process can corrupt only its own data, not any other process data. where is my mistake?

Qu 2: I understand that the virtual address space size of a process is limited by the disk size. How can two processes have virtual address space size of disk size (or RAM size), their size can sum up to much more than the disk size (or RAM size).

Thanks :)

1

There are 1 answers

0
Wayne King On

Answer Qu 1: By design, this should not happen if the associated hardware and software designs and implementations are correct, and the pertinent hardware is always operating correctly. Different processes should only be allowed to change another processes memory through defined interfaces, when they are communicating with each other by design.