Resolving Memory Dump Issues

Protection against memory dump is specified in the Mac Default Protection Settings Screen.

Sometimes, when protection against memory dump is enabled, executables cannot read from their code section. For example, the following source snippet will fail when protection against memory dump is enabled:

extern void func( void )__attribute((section("__TEXT,__text2")));
char *p = (char *)func;
putchar( *p );

The call to putchar() will try to read the first byte of the CPU instructions of func(). This Read access causes an exception and the executable crashes.

The solution to this problem is that attributes added to function declarations in the source code that require Read/Write permissions can be compiled in any other section. This section is neither encrypted nor protected against memory dump at run-time.

NOTE   Be aware that when using this solution, any of your Intellectual Property (IP) that is included in this section is fully exposed because the section is not encrypted.

Related Topics

Mac Default Protection Settings Screen