US 11,704,404 B2
Method for control-flow integrity protection, apparatus, device and storage medium
Dan Meng, Beijing (CN); Liwei Chen, Beijing (CN); Jinfeng Li, Beijing (CN); Cairui She, Beijing (CN); and Gang Shi, Beijing (CN)
Assigned to Institute of Informational Engineering, CAC, Beijing (CN)
Filed by Institute of Information Engineering, CAS, Beijing (CN)
Filed on Jun. 28, 2021, as Appl. No. 17/361,270.
Prior Publication US 2021/0406017 A1, Dec. 30, 2021
Int. Cl. G06F 21/52 (2013.01); G06F 9/30 (2018.01)
CPC G06F 21/52 (2013.01) [G06F 9/3005 (2013.01); G06F 9/30181 (2013.01)] 11 Claims
OG exemplary drawing
 
1. A method for control-flow integrity protection, comprising:
changing preset bits of all legal target addresses of a current indirect branch instruction in a control flow of a program to be protected, to make the preset bits of any legal target address of the current indirect branch instruction be same as the preset bits of other legal target addresses of the current indirect branch instruction; and
rewriting preset bits of a current target address of the current indirect branch instruction to be same as a label of the current indirect branch instruction, so that a current indirect branch cannot jump to the legal target addresses and the program to be protected terminates, when the current target address is tampered with; wherein the label is the changed preset bits of the legal target addresses of the current indirect branch instruction, and
wherein the changing preset bits of all legal target addresses of a current indirect branch instruction in a control flow of a program to be protected, to make the preset bits of any legal target address of the current indirect branch instruction be same as the preset bits of other legal target addresses of the current indirect branch instruction, comprises:
performing a null instruction fitting operation on each of the legal target addresses, so that the preset bits of each of the legal target addresses increase, until the preset bits of each of the legal target addresses are equal to the label of the current indirect branch instruction, wherein the label of the current indirect branch instruction is preset at random, and the label of the current indirect branch instruction is different from labels of other indirect branch instructions in the program to be protected.