@
lslqtz 关于这个,我查阅了下参考,不确定引用的段落是否正确,欢迎指正:
> Memory Protection
>
> When an object is mapped, various application accesses to the mapped region may result in signals. In this context, SIGBUS is used to indicate an error using the mapped object, and SIGSEGV is used to indicate a protection violation or misuse of an address:
> - A mapping may be restricted to disallow some types of access.
> - Write attempts to memory that was mapped without write access, or any access to memory mapped PROT_NONE, shall result in a SIGSEGV signal.
> - References to unmapped addresses shall result in a SIGSEGV signal.
> - Reference to whole pages within the mapping, but beyond the current length of the object, shall result in a SIGBUS signal.
> - The size of the object is unaffected by access beyond the end of the object (even if a SIGBUS is not generated).
---- The Open Group Base Specifications Issue 7, 2018 Edition
https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_08_03_03