Memory Protection Without MMU

I would like to know how memory can be protected without MMU support. I tried to do this, but did not see any valuable articles or studies. And those that relate to this use only errors, such as uninitialized pointers, and not memory corruption due to a soft error, that is, due to a hardware interrupt error that distorts the instruction that writes to the memory location.

The reason I want to know this is because I work on my own multi-platform platform without memory protection. Now, to my question, is it possible to use software to protect memory, especially for wild recordings due to soft eros (unlike programmer errors). Any help on this would be greatly appreciated.

+6
source share
4 answers

If you are looking for Runtime memory protection, then only hardware support is a smart option. Hardware is the only way to tamper with poor memory access before it can cause damage. Any software solution will be vulnerable to the very memory errors that it is trying to protect.

With software, you can implement a verification / detection scheme. You can periodically check portions of memory that the current program should not have access, and see if they have been changed (perhaps by CRCing these areas). But, of course, if the rogue program damages the area where the checksums are stored, or where the verification code is held, then all bets are disabled.

Even this software verification solution would be more of a debugging utility than a real-time runtime protection. It is likely that a device without an MMU is a small integrated device that will not have spare cycles for constantly checking the device’s memory.

Typically, devices without an MMU are designed to run a single program without a kernel or anything else, and thus there is no protection. If you need to run several programs and feel that you need protection, you probably need more advanced hardware that supports the features you are looking for.

+5
source

If you want the software to implement memory protection, you will need support from your compiler and its associated libraries. I expect that there is only one compiler on this platform, so you should contact your provider. I would not hope for a positive answer. Even if they had such tools, I would expect that software protection performance would be unacceptable.

+2
source

Systems with fewer MMUs are present in several embedded solutions.

Memory is controlled by kernel code. All memory (heap) is divided into heaps of different sizes (heap lists can be 4 bytes, 8 bytes, 16 bytes ..... up to 1024 bytes in size), and a header attached to each heap block indicates that a particular heap block is taken or not. So, when you need to assign a new heap block, you can browse the heap lists and see which heap blocks are free and can assign them to the requesting application. And the same thing happens when you free a heap block of a certain size, the headers of this block are updated to reflect that it was freed.

Now this implementation should take care of the scenario when the application requested a specific heap block size and this heap list size is full. In this case, you break a block from the following heap list or combine smaller heap blocks and add heaps of a given size to the list.

The implementation is much simpler than it seems.

+1
source

Depends on which application platform will work. There is a technology called Type-Safe Language (ATS, for example) that can protect against software errors. And such languages ​​can have good performance (for example, ATS, for example).

0
source

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


All Articles