Understanding and Mitigating Twin Function Misuses in Operating System Kernel | IEEE Journals & Magazine | IEEE Xplore

Understanding and Mitigating Twin Function Misuses in Operating System Kernel


Abstract:

Major operating system kernels expose twin functions, which are groups of internal primitives that have mostly common but slightly diverging semantics, to kernel modules ...Show More

Abstract:

Major operating system kernels expose twin functions, which are groups of internal primitives that have mostly common but slightly diverging semantics, to kernel modules and subsystems. They are created to make the basic primitives work well in various scenarios. Unfortunately, though being expected as solutions, twin functions may turn to problem-makers in practice. As we have observed from over 500 patches applied to upstream Linux and FreeBSD, developers choose an improper one from the twins, leaving the kernel with stability and security bugs as well as error-prone code. In this paper, we aim to understand and mitigate the twin function misuse problem. First, we provide an informative discussion on the misuse-fix patches. We find that violating the constraints from calling context, missing the primitives with better performance, lacking the necessary security enhancements, and breaking the kernel coding style are the four major factors that lead to misuse. We then identify the programming rules from the patches and apply them with a static program analysis tool extended from Coccinelle, including callgraph tainting and type-based function pointer resolving. We have 136 patches accepted by the Linux community and fix 320 new misuses in the upstream Linux kernel.
Published in: IEEE Transactions on Computers ( Volume: 72, Issue: 8, 01 August 2023)
Page(s): 2181 - 2193
Date of Publication: 27 January 2023

ISSN Information:

Funding Agency:


Contact IEEE to Subscribe

References

References is not available for this document.