Process Interception Library for Source Code Extraction
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Static analysis systems face challenges in extracting all source code compiled by a build system, as mere read access to source code files in a file system is insufficient, and existing methods require analyzing, replicating, or emulating the build system's behavior.
Innovation Solution
A static analysis system intercepts compiler calls using a shared library, overriding default process creation functions to provide access to source code files being compiled, allowing extraction without modifying build utilities or compilers, and running in user process space without administrative privileges.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of information
If a static analysis system uses read access to source code files in the file system, then it can access source code, but it cannot extract all source code that is built by the build system (including temporarily copied or generated files)
Solution Approach 1:
The patent introduces a process interception library as an intermediary component that sits between the build system and the static analysis system. This library intercepts process creation calls made by the build system when invoking compilers, and passes the source code file locations to the static analysis system without requiring direct access to build system internals or file system operations. This resolves the contradiction by enabling complete source code extraction through an intermediary mechanism rather than direct file system access.
2Loss of information
If the static analysis system analyzes, replicates, or emulates the build system's behavior to extract source code, then it can identify compiled files, but the process becomes complex and requires modifying build utilities or compilers
Solution Approach 1:
The build system continues to operate exactly as it would normally, invoking compilers and processing source files without any modification. The process interception library leverages the build system's own process creation mechanisms to extract source code information, meaning the build system serves itself by inadvertently providing the information needed for extraction through its normal operation. This eliminates the need to modify build utilities or compilers while maintaining accurate source code extraction.
Solution Approach 2:
The process interception library acts as a mediator that observes the build system's natural behavior without requiring changes to the build system itself. It intercepts process creation calls and extracts source code information from these intercepted calls, enabling accurate extraction while maintaining ease of integration since no modifications to existing build utilities or compilers are needed.
3Loss of information
If the static analysis system requires administrative privileges or modification of system calls to extract source code, then it can access comprehensive build information, but the system becomes harder to deploy and maintain
Solution Approach 1:
The build system's own process creation mechanisms provide the necessary information for source code extraction without requiring external intervention or elevated privileges. The process interception library taps into this self-service capability by observing normal build operations, enabling comprehensive information access while maintaining ease of deployment since no administrative privileges or system call modifications are required.
Data Source
AI summary
Methods, systems, and apparatus, including computer programs encoded on computer storage media, for extracting source code. One of the methods includes receiving, by a newly created process, a request to execute code of an executable file in the newly created process, wherein the request specifies a parameter. The newly created process loads a process interception library. Library initialization code of the process interception library determines whether the parameter should be intercepted. In response to determining that the parameter should be intercepted, the parameter is provided to another process.


