C++ SEGV_ACCERR 是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19119943/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does SEGV_ACCERR mean?
提问by Saltymule
I am examining a few crashes that all have the signal SIGSEGV with the reason SEGV_ACCERR. After searching for SEGV_ACCERR, the closest thing I have found to a human readable explanation is: Invalid Permissions for object
我正在检查一些因 SEGV_ACCERR 而带有 SIGSEGV 信号的崩溃。搜索 SEGV_ACCERR 后,我发现最接近人类可读解释的是:对象的权限无效
What does this mean in a more general sense? When would a SEGV_ACCERR arise? Is there more specific documentation on this reason?
这在更一般的意义上意味着什么?SEGV_ACCERR 何时会出现?有没有关于这个原因的更具体的文件?
回答by jjxtra
This is an error that I have mostly seen on 64 bit iOS devices and can happen if multiple threads read and change a variable under ARC. For example, I fixed a crash today where multiple background threads were reading and using a static NSDate and NSString variable and updating them without doing any kind of locking or queueing.
这是我在 64 位 iOS 设备上经常看到的错误,如果多个线程在 ARC 下读取和更改变量,就会发生这种错误。例如,我今天修复了一个崩溃,其中多个后台线程正在读取和使用静态 NSDate 和 NSString 变量,并在不进行任何锁定或排队的情况下更新它们。
Using core data objects on multiple threads can also cause this crash, as I have seen many times in my crash logs.
在多个线程上使用核心数据对象也会导致此崩溃,正如我在崩溃日志中多次看到的那样。
I also use Crittercism, and this particular crash was a SEGV_ACCERR that only affected 64 bit devices.
我也使用了 Crittercism,这个特殊的崩溃是 SEGV_ACCERR,它只影响 64 位设备。
回答by germinolegrand
As stated in the man page of sigaction, SEGV_ACCERRis a signal code for SIGSEGV that specifies Invalid permissions for mapped object. Contrary to SEGV_MAPERR which means that the address is not mapped to a valid object, SEGV_ACCERR means the address matches an object, but for sure it is neither the good one, nor one the process is allowed to access.
如sigaction的手册页所述,SEGV_ACCERR是 SIGSEGV 的信号代码,用于指定映射对象的无效权限。与 SEGV_MAPERR 相反,SEGV_MAPERR 意味着地址未映射到有效对象,SEGV_ACCERR 意味着地址匹配一个对象,但肯定它既不是好的对象,也不是允许进程访问的对象。
回答by Sameer
I've seen this in cases where code tries to execute from places other than "text".
在代码试图从“文本”以外的地方执行的情况下,我已经看到了这一点。
For eg, if your pointer is pointing to a function in heap or stack and you try to execute that code (from heap or stack), the CPU throws this exception.
例如,如果您的指针指向堆或堆栈中的函数,而您尝试执行该代码(从堆或堆栈),CPU 将抛出此异常。
回答by Joseph Thomson
It's possible to get a SEGV_ACCERR
because of a stack overflow. Specifically, this happened to me on Android ARM64 with the following:
SEGV_ACCERR
由于stack overflow可能会得到 a 。具体来说,我在 Android ARM64 上发生了以下情况:
VeryLargeStruct s;
s = {}; // SEGV_ACCERR
It seems that the zero-initialization created a temporary that caused a stack overflow. This only happened with -O0
; presumably the temporary was optimized away at higher optimization levels.
似乎零初始化创建了一个临时导致堆栈溢出。这只发生在-O0
; 大概是在更高的优化级别上优化了临时文件。