什么是SEGV_MAPERR?

发布于 2024-07-25 12:04:42 字数 64 浏览 3 评论 0原文

什么是SEGV_MAPERR,为什么它总是出现SIGSEGV

What is SEGV_MAPERR, why does it always come up with SIGSEGV?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

扬花落满肩 2024-08-01 12:04:43

有两种常见的 SEGV ,这是由无效内存访问导致的错误:

  1. 访问的页面具有错误的权限。 例如,它是只读的,但您的代码尝试写入它。 这将报告为 SEGV_ACCERR
  2. 访问的页面甚至根本没有映射到应用程序的地址空间。 这通常是由于取消引用空指针或被小整数值损坏的指针而导致的。 这被报告为 SEGV_MAPERR

SEGV_MAPERR 的某种文档(索引 Linux 源代码)位于:https://elixir.bootlin.com/linux/latest/A/ident/SEGV_MAPERR

There are two common kinds of SEGV, which is an error that results from an invalid memory access:

  1. A page was accessed which had the wrong permissions. E.g., it was read-only but your code tried to write to it. This will be reported as SEGV_ACCERR.
  2. A page was accessed that is not even mapped into the address space of the application at all. This will often result from dereferencing a null pointer or a pointer that was corrupted with a small integer value. This is reported as SEGV_MAPERR.

Documentation of a sort (indexed Linux source code) for SEGV_MAPERR is here: https://elixir.bootlin.com/linux/latest/A/ident/SEGV_MAPERR.

只是偏爱你 2024-08-01 12:04:43

这是一个分段错误。 最有可能是悬空指针问题,或某种缓冲区溢出。

SIGSSEGV 是根据分段错误问题终止它的信号。

检查悬空指针以及溢出问题。

启用核心转储将帮助您确定问题。

It's a segmentation fault. Most probably a dangling pointer issue, or some sort of buffer overflow.

SIGSSEGV is the signal that terminates it based on the issue, segmentation fault.

Check for dangling pointers as well as the overflow issue.

Enabling core dumps will help you determine the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文