Compiler Assembly Modification for Library Initialization Control
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing software libraries and applications lack control over the initialization and de-initialization of their global variables and objects, and proprietary information is exposed due to unscrambled symbols, leading to potential conflicts and security issues.
Innovation Solution
The ASMFIX tool modifies assembly files by rewriting memory management symbols, scrambling symbols to protect proprietary information, and reorganizing global variable declarations and initializer/de-initializer functions to allow the library or application to control their lifecycle and avoid name clashes.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If the operating system controls initialization and de-initialization of global variables, then the system maintains standard startup and shutdown procedures, but the library cannot effectively control or release its own global variables
Solution Approach 1:
An assembly modification tool serves as an intermediary between the compiler and assembler, automatically inserting special assembly code that enables library-controlled initialization and de-initialization while maintaining compatibility with the operating system's standard procedures
Solution Approach 2:
The assembly modification tool performs preliminary actions by pre-inserting control code into assembly files before assembly, setting up the infrastructure for library-controlled global variable management in advance
2Loss of information
If symbols are left unscrambled, then debugging and maintenance are easier, but proprietary information is exposed to inspection
Solution Approach 1:
Different scrambling approaches are applied to different symbols based on their sensitivity - critical proprietary symbols are heavily scrambled while public API symbols remain accessible, creating local variations in symbol protection quality
Solution Approach 2:
The scrambling process transforms symbol names by changing their parameter representation (names, addresses, identifiers) while maintaining their functional relationships, making inspection difficult without the proper decryption key
3Adaptability or versatility
If the same variable or object name is used by multiple libraries, then code reusability is improved, but name conflicts arise when libraries are loaded in the same system
Solution Approach 1:
The symbol namespace is segmented by library, with each library receiving a unique prefix or namespace identifier. This segmentation prevents name conflicts while maintaining internal reusability within each library context
Solution Approach 2:
Symbol names are extended into an additional dimension by adding library-specific identifiers or namespaces, transforming one-dimensional symbol names into multi-dimensional identifiers that resolve conflicts across libraries
4Adaptability or versatility
If standard memory management functions are used, then system compatibility is maintained, but the library cannot implement its own specific memory management functions
Solution Approach 1:
The assembly modification tool acts as an intermediary that automatically inserts custom memory management function calls into the library code, replacing standard system functions with library-specific implementations while maintaining the appearance of standard function usage
Data Source
AI summary
The present invention performs manipulations on the assembly file level. As a compiler outputs an assembly file, the assembly file may be inspected and modified before it is sent to the assembler. One or more of the following modifications may be made to the assembly file: rewrite certain symbols, scramble program symbols, reorganize declarations of global variables so that their layout and default values are known prior to linking, and identify initializer and de-initializer functions in order to make them callable through central initialization and de-initialization functions, respectively.


