IP Library › Granted Patent US 12,242,833
Granted Patent B2
US 12,242,833 · App. 17/929,522 · Granted Mar 4, 2025

Randomized compiler optimization selection for improved computer security

Inventor: Michael Ian Ferguson (Pine Mountain Club, CA)
Assignee: CALIFORNIA INSTITUTE OF TECHNOLOGY
G06F8/447G06F8/4441G06F11/3696
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,242,833
App. No.
17/929,522
Granted
Mar 4, 2025
Kind
B2
Abstract

A method and system provide the ability to compile computer source code. The source code is pre-processed to generate pure source code that includes definitions required for interpretation. The pure source code is formalized in a compiler, into assembly language that is processor specific. The formalization includes determining a set of two or more optimization routines, randomly selecting a selected optimization routine from the set of two or more optimization routines, and applying the selected optimization routine to each segment of the pure source code in a serialized manner. An executable binary file is then output and executed based on the formalized pure source code.

Claims (67)

1. A computer-implemented method for compiling computer code, comprising:

(a) obtaining source code;

(b) pre-processing the source code to generate pure source code, wherein the pure source code comprises definitions required for interpretation of the source code;

(c) formalizing, in a compiler, the pure source code into assembly language that is processor specific, wherein the formalizing comprises:

(i) determining a set of two or more optimization routines;

(ii) randomly selecting multiple selected optimization routines from the set of two or more optimization routines, wherein the random selection improves resistance to software subversion; and

(iii) applying the multiple selected optimization routines to each segment of the pure source code; and

(d) outputting an executable binary file based on the formalized pure source code, wherein the executable binary file has an improved resistance to software subversion.

2. The computer-implemented method of claim 1 , wherein the randomly selecting comprises:

determining a cost for each of the two or more optimization routines in the set;

determining a subset of two or more optimization routines from the set of the two or more optimization routines, wherein the subset comprises optimization routines whose costs are within a predefined threshold; and

randomly selecting the multiple selected optimization routines from the subset.

3. The computer-implemented method of claim 2 , wherein the random selection is based on a variance of all of the costs.

4. The computer-implemented method of claim 1 , wherein the formalizing further comprises:

determining that the multiple selected optimization routines allocate memory;

scaling up the memory allocation by a predefined percentage; and

creating an implementation for the multiple selected optimization routines with the scaled up memory allocation.

5. The computer-implemented method of claim 1 , wherein the formalizing further comprises:

determining that the compiling is performed in a multi-processor shared-memory computer wherein multiple processors share a memory cache;

arbitrarily invalidating cache lines in the memory cache.

6. The computer-implemented method of claim 1 , wherein:

the pre-processing further comprises defining a pre-processor directive that directs different code blocks of the pure source code to be written into different memory blocks;

the compiling further comprises debugging the source code based on the different memory blocks.

7. The computer-implemented method of claim 1 , wherein the formalizing further comprises:

specifying, via a binary code, an on/off behavior of each of the two or more optimization routines.

8. The computer-implemented method of claim 7 , wherein the binary code is set forth in a global variable with each bit of the global variable corresponding to one of the optimization routines.

9. The computer-implemented method of claim 8 , further comprising:

providing the global variable to a hypervisor;

the hypervisor modifying, via the global variable, an operational parameter of the computer code.

10. The computer-implemented method of claim 9 , further comprising:

the hypervisor observing when the computer code is calling a same piece of memory at a frequency that is suboptimal for a given architecture and does not map to a proper application of the two or more optimization routines;

wherein the hypervisor modifies the global variable resulting in a different application of the two or more optimization routines.

11. A computer-implemented system for compiling computer code, comprising:

(a) a computer having a memory;

(b) a processor executing on the computer; and

(c) the memory storing a set of instructions, wherein the set of instructions, when executed by the processor cause the processor to perform operations comprising:

(i) obtaining source code;

(ii) pre-processing the source code to generate pure source code, wherein the pure source code comprises definitions required for interpretation of the source code;

(iii) formalizing, in a compiler, the pure source code into assembly language that is processor specific, wherein the formalizing comprises:

(A) determining a set of two or more optimization routines;

(B) randomly selecting multiple selected optimization routines from the set of two or more optimization routines, wherein the random selection improves resistance to software subversion; and

(C) applying the multiple selected optimization routines to each segment of the pure source code; and

(iv) outputting an executable binary file based on the formalized pure source code, wherein the executable binary file has an improved resistance to software subversion.

12. The computer-implemented system of claim 11 , wherein the randomly selecting comprises:

determining a cost for each of the two or more optimization routines in the set;

determining a subset of two or more optimization routines from the set of the two or more optimization routines, wherein the subset comprises optimization routines whose costs are within a predefined threshold; and

randomly selecting the multiple selected optimization routines from the subset.

13. The computer-implemented system of claim 12 , wherein the random selection is based on a variance of all of the costs.

14. The computer-implemented system of claim 11 , wherein the formalizing further comprises:

determining that the multiple selected optimization routines allocates memory;

scaling up the memory allocation by a predefined percentage; and

creating an implementation for the multiple selected optimization routines with the scaled up memory allocation.

15. The computer-implemented system of claim 11 , wherein the formalizing further comprises:

determining that the compiling is performed in a multi-processor shared-memory computer wherein multiple processors share a memory cache;

arbitrarily invalidating cache lines in the memory cache.

16. The computer-implemented system of claim 11 , wherein:

the pre-processing further comprises defining a pre-processor directive that directs different code blocks of the pure source code to be written into different memory blocks;

the compiling further comprises debugging the source code based on the different memory blocks.

17. The computer-implemented system of claim 11 , wherein the formalizing further comprises:

specifying, via a binary code, an on/off behavior of each of the two or more optimization routines.

18. The computer-implemented system of claim 17 , wherein the binary code is set forth in a global variable with each bit of the global variable corresponding to one of the optimization routines.

19. The computer-implemented system of claim 18 , wherein the operations further comprise:

providing the global variable to a hypervisor;

the hypervisor modifying, via the global variable, an operational parameter of the computer code.

20. The computer-implemented system of claim 19 , wherein the operations further comprise:

the hypervisor observing when the computer code is calling a same piece of memory at a frequency that is suboptimal for a given architecture and does not map to a proper application of the two or more optimization routines;

wherein the hypervisor modifies the global variable resulting in a different application of the two or more optimization routines.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 2, 2022
From: FERGUSON, MICHAEL I.
To: CALIFORNIA INSTITUTE OF TECHNOLOGY
Reel/Frame 060983/0585 →
Continuity (3)
Provisional Application 63243877 · Sep 14, 2021
Provisional Application 63240269 · Sep 2, 2021
Related Publication 20230079426A1 · Mar 16, 2023
References Cited (9)
US 20060200796A1 · Ota · 2006 [cited by examiner]
US 20080215508A1 · Hanneman · 2008 [cited by examiner]
US 20140149969A1 · Brower · 2014 [cited by examiner]
US 20170249252A1 · Elias · 2017 [cited by examiner]
DE 0806725A2 · 1997 [cited by examiner]
NPL_EP 0806725 A2_PDF_Version with Paragraph Numbers (Year: 1997). [cited by examiner]
[GNU C Compiler Internals] GNU C Compiler Internals, 13 pages, Apr. 10, 2016, https://web.archive.org/web/20160410185222/https://www.redhat.com/magazine/002dec04/features/gcc/. [cited by applicant]
Merrill, “Generic and Gimple: A New Tree Representation for Entire Functions”. GCC Developers Summit 2003, pp. 171-180. [cited by applicant]
Option Summary (Using the GNU Complier Collection (GCC)). 2022, 28 pages, https://gcc.gnu.org/onlinedocs/gcc/OptionSummary.html. [cited by applicant]