Source Code Identification via Compiler Interception
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Static analysis systems face challenges in extracting all source code used to build an executable file due to insufficient read access in a file system, as build systems modify and delete temporary files during compilation.
Innovation Solution
A static analysis system intercepts compiler and linker calls using a shared library, providing access to source code and object files by overriding default process creation functions, allowing precise extraction of source code and identification of externally linked symbols without modifying the build system.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of information
If a static analysis system only has read access to source code files in the file system, then the system structure remains simple, but the system cannot extract all source code that is built by the build system
Solution Approach 1:
The patent introduces a shared library as an intermediary component between the build system and the static analysis system. This shared library intercepts compiler and linker calls, capturing source code and object file information that would otherwise be inaccessible. The intermediary enables comprehensive source code extraction without requiring direct modification of the build system or administrative privileges, resolving the contradiction between information completeness and system complexity.
2Productivity
If the build system modifies and deletes temporary files during compilation, then the build process efficiency is improved, but the static analysis system loses access to the source code
Solution Approach 1:
The patent implements preliminary action by having the shared library intercept and capture source code and object file information before the build system deletes temporary files. The library stores this information in a manner that preserves it for later static analysis, even though the original temporary files are subsequently removed. This allows the build process to maintain its efficiency while the static analysis system retains access to the necessary source code.
3Measurement precision
If the static analysis system intercepts compiler and linker calls using a shared library, then source code extraction accuracy is improved, but the build system complexity increases
Solution Approach 1:
The shared library implements self-service by automatically intercepting and processing compiler and linker calls without requiring external control or configuration. The library independently captures source code and object file information, manages its own data storage, and provides this information to the static analysis system. This self-contained approach improves source code identification accuracy while minimizing the increase in build system complexity, as the interception mechanism operates autonomously within the existing build infrastructure.
Data Source
Figure 1
Figure 2
Figure 3A
AI summary
Methods, systems, and apparatus, including computer programs encoded on computer storage media, for identifying source code used to build executable. One of the methods includes determining that a first newly created process is a compiler, the compiler being invoked to compile a source code file; after the compiler exits, generating a first hash value of an object file generated by the compiler; generating an object artifact that identifies the source code file and includes the first hash value of contents of the object file generated by the compiler; determining that the second newly created process is a linker, the linker being invoked to generate an executable file from one or more object files; generating a link artifact that includes respective hash values of each of the one or more object files used to generate the executable file; and providing the link artifact and object artifact to a static analysis system.