What is the current state of memory protection?

The more I read about low-level languages ​​such as C and pointers and memory management, it makes me think about the current state of affairs with modern operating systems and memory protection. For example, what checks exist that prevent a rogue program from accidentally trying to read as much address space as possible and ignore the rules set by the operating system?

In general terms, how do these memory protection schemes work? What are their strengths and weaknesses? In other words, is there something that simply cannot be done when starting the compiled program in a modern OS, even if you have C and you have your own compiler with any tweaks that you want?

+3
source share
4 answers

( ). , . , , " ", . ( ) , , . , CPU .

CPU, , , , ( ).

, :

  • ​​

, -, .

, ​​ (, Win32 ReadProcessMemory), API ( ).

+4

, , KBs.

:

, , . , . , .

, , x86, .

. . , .

, , , , , (PF). .

+4

Google , . , , .

Windows Vista ( 7) dll, , , . .

+1

, , . , , , , ( ), ​​ , , , SIGSEV (segmentation fault) , ( Linux/Unix ), Windows - ,

Note: you can take a look at mprotect () on Linux and POSIX operating systems, this allows you to protect memory pages explicitly, functions like malloc (), return memory to pages with default protection, which you can then change, so you You can protect memory areas only as read (but only in page size blocks, usually around 4 KB).

+1
source

Source: https://habr.com/ru/post/1718739/


All Articles