当前位置:网站首页>ASAN 极简原理
ASAN 极简原理
2022-04-23 07:12:00 【maray】
- 物理内存有限,虚拟内存无限。
- ASAN 接管了应用程序的 malloc 流程
- 每次分配内存,一定使用全新的虚拟地址,并且在地址两端加页保护
OVER
要点:因为虚拟内存资源是“无限”的,所以可以大量浪费。浪费体现在两个方面:
- 分配过的地址空间,即使 free 过了,也不会再次分配给用户。用户感受到的就是内存分配器每次分配出来的内存地址总是比上一次的高。
- 已经 free 过的内存区域这里称为 Dead Zone
- 每次分配一段内存时,总会在两端预留一个页面,并且将这两个页面做读写保护。
- 两端预留的页面称为 Red Zone
在这个机制的基础上,ASAN 只需要跟踪好每次内存分配的堆栈,就能在出问题的时候准确报告出出问题点。能探测到的内存问题:
- 访问已经 free 过的内存,触发 Dead Zone 报警
- 内存访问越界,触发 Red Zone 报警
- 部分野指针问题,触发 Dead Zone / Red Zone 报警
什么问题 ASAN 不能解决?
- 部分野指针问题(正好写到了还没有 “Dead” 的内存区域,不会触发任何报警)
版权声明
本文为[maray]所创,转载请带上原文链接,感谢
https://blog.csdn.net/maray/article/details/124292477
边栏推荐
- Mobile web (Font Icon, plane conversion, color gradient)
- BUUCTF [极客大挑战 2019]EasySQL1
- 多目视觉SLAM
- Briefly describe the hierarchical strategy of memory
- [Effective Go 中文翻译] 第一篇
- Compiler des questions de principe - avec des réponses
- NFT ecological development of Ignis public chain: unicorn Donation and development of Art
- C language learning record -- use and analysis of string function (2)
- 为什么会存在1px问题?怎么解决?
- Alibaba sentinel learning QA
猜你喜欢
岛屿的个数
Thinkphp6 + JWT realizes login verification
AAAI 2022招募讲者啦!!
[programming practice / embedded competition] learning record of embedded competition (I): establishment of TCP server and web interface
Data security has become a hidden danger. Let's see how vivo can make "user data" armor again
Mobile terminal layout (3D conversion, animation)
Ribbon start process
Principle of sentinel integrating Nacos to update data dynamically
Go语学习笔记 - 结构体 | 从零开始Go语言
一款拥有漂亮外表的Typecho简洁主题_Scarfskin 源码下载
随机推荐
Find the largest of 3 strings (no more than 20 characters per string).
An idea plug-in that doesn't work, but can install X
[effective go Chinese translation] function
GUI,CLI与Unix哲学
Planification du mouvement du manipulateur dans l'assemblage 3c
输入 “ net start mysql ”,出现 “ 发生系统错误 5。 拒绝访问 ” 。问题详解
Why are there 1px problems? How?
干货!以点为形:可微分的泊松求解器
Compiler des questions de principe - avec des réponses
2022.4.11-4.17 AI行业周刊(第93期):AI行业的困局
Quick rehearsal exercise
redis主从服务器问题
社区团购小程序源码+界面diy+附近团长+供应商+拼团+菜谱+秒杀+预售+配送+直播
The following program deletes n consecutive words starting from the ith character from the string str
Discussion on ES6 tail tune optimization
欧圣电气深交所上市:市值52亿 陆为东父女为美国籍
ApplicationReadyEvent的使用
多目视觉SLAM
idea:使用easyYapi插件导出yapi接口
输入/输出系统