GPU Kernel Out-of-Bound Access Prevention via Automated Boundary Checks
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current GPU programming techniques struggle to effectively detect and prevent out-of-bound array accesses, which are common sources of errors and security vulnerabilities, especially due to their complexity and the limited effectiveness of existing detection methods.
Innovation Solution
An automated method is introduced that modifies GPU kernel source code to include array size parameters and boundary checks, transforming the code into LLVM Intermediate Representation to transparently provide array sizes at runtime, preventing out-of-bound access through a polyglot virtual machine.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If static program analysis is used to detect out-of-bound accesses, then detection capability is provided, but the detection is limited and cannot modify code to offer protection
Solution Approach 1:
The system performs preliminary actions by automatically modifying GPU kernel source code to include boundary checks before execution. The compilation process inserts runtime checks that verify array indices against declared sizes, preventing out-of-bound accesses before they can cause errors or security vulnerabilities.
Solution Approach 2:
The invention introduces an intermediary compilation process that acts as a mediator between static analysis and runtime execution. This intermediary automatically transforms source code by adding boundary checking logic, bridging the gap between detection capability and actual protection without requiring manual intervention.
2Object-affected harmful factors
If sandboxed environment is used to mitigate out-of-bound accesses, then security effects are reduced, but out-of-bound accesses still occur and can provide wrong results
Solution Approach 1:
The system applies preliminary anti-action by proactively preventing out-of-bound accesses through automatically inserted boundary checks in the compiled code. Rather than merely containing the effects of such accesses in a sandbox, the system actively blocks them before they can occur, ensuring both security and execution correctness.
3Measurement precision
If manual prevention and fixing of out-of-bound accesses is required, then detection capability is provided, but automation is not offered and user burden increases
Solution Approach 1:
The invention enables self-service by making the compilation process automatically modify GPU kernel source code to include boundary checks. The system serves itself by autonomously analyzing code, identifying potential out-of-bound accesses, and inserting appropriate protection logic without requiring manual intervention from developers.
Solution Approach 2:
The system performs preliminary actions by automatically modifying GPU kernel source code to include boundary checks before execution. The compilation process inserts runtime checks that verify array indices against declared sizes, preventing out-of-bound accesses before they can cause errors or security vulnerabilities.
4Device complexity
If existing code is not modified to include boundary checks, then code simplicity is maintained, but out-of-bound accesses cannot be prevented
Solution Approach 1:
The system performs preliminary actions by automatically modifying GPU kernel source code to include boundary checks before execution. The compilation process inserts runtime checks that verify array indices against declared sizes, preventing out-of-bound accesses before they can cause errors or security vulnerabilities.
Solution Approach 2:
The invention introduces an intermediary compilation process that acts as a mediator between source code and executable code. This intermediary automatically transforms source code by adding boundary checking logic, providing protection without requiring changes to the original program logic or increasing apparent code complexity for the user.
Data Source
AI summary
Techniques are provided for an automated method of adding out-of-bound access prevention in GPU kernels executed in a managed environment. In an embodiment, a system of computers compiles a GPU kernel code function that includes one or more array references that are memory address dependent. The system of computers compiles the kernel code function by generating a rewritten GPU kernel code module that includes, within the function signature of the rewritten GPU kernel code module, a respective array size parameter for each array reference of the one or more array references included in the GPU kernel code function. The system of computers further compiles the kernel code function by adding bounding protection instructions to the one or more potential out-of-bound access instructions in the rewritten GPU kernel code module. The potential out-of-bound access instructions comprise instructions that reference each respective array size parameter of the one or more array references. Afterwards, the rewritten GPU kernel code module is loaded in a virtual machine. Loading the rewritten GPU kernel code module in the virtual machine comprises modifying a host application to automatically transmit, from the host application, one or more input array size values. The one or more input array size values is referenced by the one or more potential out-of-bound-access instructions.


