linux – mmap内存保护的目的是什么PROT_NONE

linux – mmap内存保护的目的是什么PROT_NONE,第1张

概述我正在阅读mmap的 documentation,并落在这条线上: PROT_NONE Pages may not be accessed. 有没有用来将文件映射到内存,但是不能访问它? PROT_NONE可以用来实现 guard pages,微软有同样的概念( MSDN). 引用第一个链接: … allocation of additional inaccessible memory durin 我正在阅读mmap的 documentation,并落在这条线上:

PROT_NONE Pages may not be accessed.

有没有用来将文件映射到内存,但是不能访问它?

解决方法 PROT_NONE可以用来实现 guard pages,微软有同样的概念( MSDN).

引用第一个链接:

… allocation of additional inaccessible memory during memory allocation
operations is a technique for mitigating against exploitation of heap
buffer overflows. These guard pages are unmapped pages placed between
all memory allocations of one page or larger. The guard page causes a
segmentation fault upon any access.

因此在实现对诸如网络接口,虚拟机和解释器等领域的保护方面非常有用.示例用法:pthread_attr_setguardsize,pthread_attr_getguardsize.

总结

以上是内存溢出为你收集整理的linux – mmap内存保护的目的是什么PROT_NONE全部内容,希望文章能够帮你解决linux – mmap内存保护的目的是什么PROT_NONE所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/1043682.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存