问题描述
我正在使用 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 上的所有可用内存.我们已经在应用程序中应用了一些通用的处理模式,并且通常会尽快处理掉任何重物.这意味着应用程序现在使用更少的内存运行.但是,我们仍然收到 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)
不是魔术;它无法防止返回libc攻击,或对系统的不当使用(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 上 errno
值 12
的 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) 的说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!