免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: 独孤九贱

[内存管理] 请教mem_cache_alloc引起的oops-熟悉内存管理的同学指点一下 [复制链接]

论坛徽章:
0
发表于 2012-12-19 22:03 |显示全部楼层
是slub么? slub的overwrite在memory overwrite中还是属于比较好查的
在kernel的启动参数中加上 slab_debug=FUPZ
slub系统会自动替你检查很多东西

论坛徽章:
0
发表于 2012-12-19 22:43 |显示全部楼层
本帖最后由 独孤九贱 于 2012-12-19 22:50 编辑
onlyxuyang 发表于 2012-12-19 22:03
是slub么? slub的overwrite在memory overwrite中还是属于比较好查的
在kernel的启动参数中加上 slab_debu ...


谢谢楼上,我试试。

论坛徽章:
0
发表于 2012-12-19 23:49 |显示全部楼层
回复 12# 独孤九贱


啊啊啊 抱歉,不是slab_debug 是 slub_debug,

一般来说slub_debug=FUPZ 会比较小影响系统运行,系统可以正常跑下去。

see kernel\Documentation\vm\slub.txt

Parameters may be given to slub_debug. If none is specified then full
debugging is enabled. Format:

slub_debug=<Debug-Options>       Enable options for all slabs
slub_debug=<Debug-Options>,<slab name>
                                Enable options only for select slabs

Possible debug options are
        F                Sanity checks on (enables SLAB_DEBUG_FREE. Sorry
                        SLAB legacy issues)
        Z                Red zoning
        P                Poisoning (object and padding)
        U                User tracking (free and alloc)
        T                Trace (please only use on single slabs)
        A                Toggle failslab filter mark for the cache
        O                Switch debugging off for caches that would have
                        caused higher minimum slab orders
        -                Switch all debugging off (useful if the kernel is
                        configured with CONFIG_SLUB_DEBUG_ON)


   

论坛徽章:
0
发表于 2012-12-20 09:32 |显示全部楼层
onlyxuyang 发表于 2012-12-19 23:49
回复 12# 独孤九贱


回楼上同学,很多资料提到使用slub_debug,而不带任何参数,带参数的各个含义,文档中已经写得很清楚了,但是不带参数呢?它们之间的区别在哪儿呢?

论坛徽章:
0
发表于 2012-12-20 20:12 |显示全部楼层
"If none is specified then full debugging is enabled"

感觉不带任何参数的话相当于会把所有开关都打开吧,我实践中这样系统很难跑起来,因为记录的东西太多了。

我记得我当时用的时候不知道是 开了TAO中的哪一个,开机一直吐log 根本跑不起来。

实践中如果是查bug的话,感觉FUPZ一般足够了,会替你检查 double free,overwrite。

想更详细的了解的话,读slub.c的源码吧,写的精简干练,非常短,认真读的话3到4天就可以初步了解。

论坛徽章:
0
发表于 2012-12-20 21:00 |显示全部楼层
帮顶了.内存的问题貌似一直都是重头戏.学习

论坛徽章:
0
发表于 2012-12-28 21:51 |显示全部楼层
kmem_cache_alloc+0x40 addr2line -e vmlinux 0xffffffff810fce90

找到哪行,怀疑要不slub管理被踩坏了,要不你的释放的地址是个非法的
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP