本文介绍了MProtect Errno 12 (ENOMEM) 的解释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Monotouch 编写一个 iPhone 应用程序,最近该应用程序开始崩溃,说明

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

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

随后是相当长的堆栈跟踪和 Springboard 通知应用程序异常退出,信号 6".

followed by a rather lengthly stack trace and Springboard informing that "the application exited abormally with signal 6".

我已阅读此问题,其中指出该应用程序已用尽 iPhone 上的所有可用内存.我们在应用程序中应用了一些通用的 Dispose 模式,并且通常会尽快处理任何重物.这意味着应用程序现在使用更少的内存运行.但是,我们仍然收到 MProtect 失败消息.

I've read this question which states that the app has exhaused all the memory available on the iPhone.We have applied some general Dispose patterns to the app and generally disposed of any heavy objects as soon as we could. This meant the app now runs using less memory. However we are still getting the MProtect failed message.

还需要注意的是,当在仪器下运行应用程序时,仪器报告有大量可用内存可供设备使用 (~40mb).

Also curious to note is that when running the app under instruments, instruments is reporting that there is plenty of free memory available to the device (~40mb).

我想知道是否有人能够解释 MProtect 和这次失败,因为我认为我没有完全正确理解它.

I was wondering whether anyone would be able to explain MProtect and this failure as I don't think I've quite understood it properly.

推荐答案

mprotect(2) 要求操作系统内核更改地址空间某些部分的保护模式.

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

mprotect(2) 通常用于使地址空间的数据部分不可执行,因此 缓冲区溢出, 格式字符串漏洞, 免费后使用释放未分配的内存错误,或类似的攻击无法返回攻击者提供的数据.此外,mprotect(2) 用于确保程序text 空间不会被相同的漏洞修改.(如果攻击者可以简单地覆盖您提供的函数,那就不好了.)

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.)

但是 mprotect(2) 并不神奇;它无法防止 return to libc 攻击,或不当使用 system(3)或其他代码解释器等

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.

iPhone 上 errno12 的 C 符号是什么?Monotouch 在哪里以及为什么使用 mprotect(2) 本身?您的软件有可能使用 mprotect(2) 吗?

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)?

这篇关于MProtect Errno 12 (ENOMEM) 的解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-19 15:30