ISSN 1000-1239 CN 11-1777/TP

Journal of Computer Research and Development ›› 2021, Vol. 58 ›› Issue (1): 189-207.doi: 10.7544/issn1000-1239.2021.20200284

Previous Articles     Next Articles

Recommending Interface Patches for Forward Porting of Linux Device Drivers Based on Existing Instances

Li Bin1,2, He Yeping1,2,3, Ma Hengtai1,2, Rui Jianwu1,2   

  1. 1(University of Chinese Academy of Sciences, Beijing 100049);2(National Engineering Center of Fundamental Software, Institute of Software, Chinese Academy of Sciences, Beijing 100190);3(State Key Laboratory of Computer Science(Institute of Software, Chinese Academy of Sciences), Beijing 100190)
  • Online:2021-01-01
  • Supported by: 
    This work was supported by the CAS Strategic Priority Program (XDA-Y01-01, XDC02010600).

Abstract: The extent and scope of associated impact of Linux kernel version upgraded frequently on the drivers are very large. In order to repair the inconsistency error of the driver calling the kernel interface caused by this related impact, constantly modifying the old version drivers’ codes for forward porting is a continuing and urgent problem. There are existing researches on assistant understanding of driven evolution, assistant adaptation of driver porting middle lib and assistant information of driver porting. The efficiency of driver porting is improved by retrieving assistant information at the statement level. However, the existing methods only focus on retrieving assistant information itself without distinguishing the effective patch materials. Therefore, manual analysis and manual construction of adaptable patches are required. To overcome the above limitations, in this paper we propose a new method to recommend high quality patches for interface errors in drivers forward porting. We observe that: there are the same or similar kernel interfaces’ calls between multiple different drivers that rely on the same kernel interface services, and there may be existing instance codes in the development history of other drivers, which share the same interfaces reuse and interfaces changes after kernel version is upgraded. This paper uses the commonality of the error interface statements and similar existing instances in historical development information to analyze the characteristics of the error problem, and extracts targeted interface modification modes and contents of fine-grained materials to generate patches to be recommended. Specifically, the effective modification modes are determined by combining boundary point identification, similarity calculation, fine-grained difference comparison and frequency calculation. A classification algorithm based on the different characteristics of existing instances is proposed for the first time, by distinguishing the different types of modification contents, then content materials from two data sources are extracted respectively. Finally we use the editing script technology to generate the recommended patches using above materials. Experiment on 9 different types of real drivers shows that this method can recommend for 7 types of interface errors patches in driver porting, and the effective patches account for about 67.4%. Partly, it effectively supplements and expands existing assistant methods for driver porting.

Key words: driver porting, existing instances, interface reuse, modification modes, patches recommend, interface error

CLC Number: