Memory Protection Article Index for
Memory
Website Links For
Memory
 

Information About

Memory Protection




# bug in one process affecting another process.
# malicious software gaining unwanted access to the system.


METHODS

There are different ways to achieve memory protection. These include: {Link without Title}


Segmentation


Segmentation refers to dividing a computer's memory into segments.

The X86 architecture has multiple segmentation features, which are useful for those who wish to use protected memory on this architecture. {Link without Title}
On the x86 architecture, the Global Descriptor Table and Local Descriptor Tables can be used to reference segments in the computer's memory.
Pointers to memory segments on x86 processors can also be stored in the processor's segment registers. Initially x86 processors had 4 segment registers, CS, SS, DS and ES; later another two segment registers were added – FS and GS. {Link without Title}


Paging

Paging is the method mostly used for memory protection. In paging, the memory address space is divided into small pieces, called pages. Using a Virtual Memory mechanism, each page can be made to reside in any location of the physical memory, or be flagged as being protected. Paging makes it possible to have a linear virtual memory address space access pieces out of a fragmented Physical Memory space.

Each process is given a Page Table to define the valid addresses and map them to physical memory. The page table is usually invisible to the process. Page tables make it easy to allocate new memory for a process, as each new page can be allocated from anywhere in physical memory.

Parts of an Application 's memory can be " Swapped out" to other forms of Storage . This happens to memory that is seldom used, and it allows the application to act as if it has a much larger working memory than actually exists. By swapping out memory, the virtual memory layout will not change, but it frees a lot of physical memory (i.e. RAM ) for other uses.

If the process is accessing a virtual memory location that is not mapped by the page table, a Page Fault will occur. Page faults could mean either that the process has tried to access memory that it should not have access to, or that part of the application's memory has been swapped out. In the last case, the page will be swapped back in and execution will proceed where it was interrupted.

If both paging and segmentation are used at the same time, as in the IA-32 architecture, paging does not map into physical memory at once, but goes through a Linear Memory stage first. Linear memory is the memory as seen solely by the processors segmentation circuitry, or as if the pages were turned off but the segmentation was still active.

It is important to note that virtual memory is ''not'' the same as RAM, that linear memory is a Hardware Register -defined ''part of'' the RAM and that physical memory ''more or less'' is the equivalent of RAM. Physical memory is actually both RAM ''and'' memory mapped I/O-ports.


Protection keys

A protection key mechanism divides physical memory up into blocks of a particular size (e.g. 2KB), each of which has an associated numerical value called a protection key. Each process also has a protection key value associated with it. On a memory access the hardware checks that the current process's protection key matches the value associated with the memory block being accessed; if not, an exception occurs. This mechanism was used in the System/360 architecture.


Simulated segmentation

Simulation is use of a Monitoring Program to interpret the machine code instructions of some computer. Such a simulator can provide memory protection by using a segmentation-like scheme and validating the target address and length of each instruction in real time before actually executing them. The simulator must calculate the target address and length and compare this against a list of valid address ranges that it holds concerning the Thread 's environment, such as any dynamic Memory blocks acquired since the thread's inception plus any ("valid") shared static memory slots. The meaning of valid may change throughout the thread's life depending upon context. In other words, it may sometimes be allowed to alter a static block of storage, and sometimes not, depending upon the current mode of execution which may or may not depend on a storage key or supervisor state.

Its generally not advisable to use this method of memory protection where adequate facilities existl on a CPU, as this takes valuable processing power from the computer. Also doing could be compared to "reinventing the wheel".


MEASURES

A useful estimation of the protection level of a particular implementation, is to measure how closely it adheres to the Principle Of Minimum Privilege .Cook, D.J. '' Measuring memory protection '', accepted for 3rd International Conference on Software Engineering, Atlanta, Georgia, May 1978.


MEMORY PROTECTION IN DIFFERENT OPERATING SYSTEMS


There are very few operating systems that do not use some form of memory protection. CP/M and all variants of MS-DOS lacked it. Even then, early versions of Microsoft Windows implemented memory protection on top of DOS.

Some operating systems that do implement memory protection include



SEE ALSO



REFS



EXTERNAL LINKS

  • http://www.intel.com/design/processor/manuals/253665.pdf - Intel Developer Manuals. These contain a lot more in depth information on memory protection, on the Intel based architectures.