MProtect Errno 12(ENOMEM)的说明 [英] Explanation of MProtect Errno 12 (ENOMEM)

查看:963
本文介绍了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)不是魔术;它无法防止返回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.

errno的C符号是什么< iPhone上的$ code>值 12 ? 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)的说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆