O'Reilly logo

Hands-On System Programming with Linux by Kaiwan N Billimoria

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Memory-region protection

Perhaps the most important benefit of VM is this: the ability to define protections on virtual memory and have them honored by the OS.

Unix and friends (including Linux), allow four protection or permission values on memory pages:

Protection or permission type Meaning
None No permission to do anything on the page
Read Page can be read from
Write Page can be written to
Execute Page (code) can be executed
Table 5:  Protection or permission values on memory pages

Let's consider a small example: we allocate four pages of memory in our process (numbered 0 to 3). By default, the default permission or protections on the pages is RW (Read-Write), which means the pages can be both read from and written to.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required