kfence 在释放对象时没有释放objcg钩子,可导致内存泄露和cgroup统计不准。
Hi pengliustd, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: Kernel, and any of the maintainers: @YangYingliang , @pi3orama , @成坚 (CHENG Jian) , @jiaoff , @Xie XiuQi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
分析:该问题是通过syzbot发现的,而且通过二分法定位到触发问题的补丁并不是kfence的补丁,但根因确是kfence导致的。kfence由于没有释放objcg钩子导致内存泄露并不是能轻易观测的,因为并不是每次申请内存时都分配一个钩子。
内核原有释放cache调用栈
__cache_free
___cache_free
memcg_slab_free_hook
在原有调用栈中有调用memcg_slab_free_hook,但走到kfence流程时确没有调用到该函数。
解决方法:
当释放kfence对象时也调用memcg_slab_free_hook释放objcg钩子
登录 后才可以发表评论