Explanation of MProtect Errno 12 (ENOMEM)

前端 未结 2 1651
忘了有多久
忘了有多久 2021-01-15 09:59

I\'m writing an iPhone application using Monotouch and recently the app has started crashing stating

Mprotect failed at 0x863a000 (length 8192) with errno 1         


        
2条回答
  •  隐瞒了意图╮
    2021-01-15 10:49

    mprotect(2) asks the operating system kernel to change the protection mode for some portion of address space.

    mprotect(2) is often used to make data sections of an address space non-executable, so that buffer overflows, format string vulnerabilities, use after free or freeing unallocated memory errors, or similar attacks cannot return into attacker-supplied data. Also, mprotect(2) is used to ensure that the program text space cannot be modified by those same vulnerabilities. (If an attacker can simply overwrite the functions you've supplied, that's no good.)

    But mprotect(2) isn't magic; it cannot prevent against return to libc attacks, or improper use of system(3) or other code interpreters, etc.

    What is the C symbol for the errno value 12 on the iPhone? Where and why does Monotouch use mprotect(2) itself? Any chance your software uses mprotect(2)?

提交回复
热议问题