Kernel Refcount Bug Detection Based on the Consistency of Error Path Behavior

Xiong Xin,Tan Xin,Zhang Yuan
DOI: https://doi.org/10.7544/issn1000-1239.202220768
2023-01-01
Journal of Computer Research and Development
Abstract:Reference counting (refcount) bugs in the kernel could cause critical security problems including memory leak and use-after-free vulnerabilities. To detect such defects, this paper proposes a refcount bug detection system based on consistency analysis of error path behavior. Compared with the existing works, our method introduces semantic information of the error paths to infer the appropriate refcount behavior on these paths, thus detecting refcount defects that cannot be covered by the existing works. First, the system identifies all the error paths in the target function based on the function return value and fault handling code. Second, it performs path-sensitive analysis to collect the specific refcount behavior on each error path within the target function, which is aggregated to infer the dominant tendency of refcount behavior of the error paths in the target function. Finally, based on the idea of consistency checking, the error paths whose reference counting behavior is inconsistent with the dominant tendency are identified as potential refcount bugs. In the evaluation, the proposed system found 21 and 9 bugs on Linux kernel version 5.6-rc2 and version 5.17, respectively, most of which have been confirmed by the kernel developers. In addition, on kernel version 5.6-rc2, the system detected 9 new refcount bugs that could not be identified by existing works.
What problem does this paper attempt to address?