Using approximate membership query filters for efficient control flow integrity protection
A method includes fetching, at a program counter value, an instruction of a basic block of code; decoding the instruction; updating a checksum value with a checksum of the instruction; and determining whether a tuple of the program counter value and the checksum value is in an approximate membership query filter (AMQ-filter).
1 . A method, comprising:
fetching, at a program counter value, an instruction of a basic block of code;
decoding the instruction;
updating a checksum value by adding a value of a checksum of the instruction to a current checksum value based on other instructions of the basic block;
determining whether a tuple of the program counter value and the updated checksum value is in an approximate membership query filter (AMQ-filter); and
performing, at a processing circuitry, an operation to address a fault attack based on the tuple not being in the AMQ-filter.
2 . The method of claim 1 , wherein performing the operation comprises:
setting the program counter value to an exception handler address based on the tuple not being in the AMQ-filter.
3 . The method of claim 2 , wherein the determining is performed by transmitting the tuple to the AMQ-filter and receiving a response indicating the tuple is not in the AMQ-filter.
4 . The method of claim 1 , wherein the determining is performed based on the instruction being a last instruction of the basic block.
5 . The method of claim 1 , further comprising:
resetting the current checksum value based on the instruction being a first instruction of the basic block.
6 . The method of claim 1 , further comprising:
resetting an instruction counter based on the instruction being a first instruction of the basic block; and
incrementing the instruction counter, corresponding to the fetching, wherein the determining is performed based on the instruction counter exceeding a predetermined threshold.
7 . The method of claim 1 , further comprising:
executing the instruction based on the tuple being in the AMQ-filter.
8 . An apparatus, comprising:
an approximate membership query filter (AMQ-filter) that stores tuples of program counters and checksums; and
processing circuitry configured to fetch, at a program counter value, an instruction of a basic block of code, decode the instruction, and update a checksum value by adding a value of a checksum of the instruction to a current checksum value based on other instructions of the basic block, wherein the AMQ-filter is configured to determine whether a tuple of the program counter value and the updated checksum value is in the AMQ-filter, and wherein the processing circuitry is configured to perform an operation to address a fault attack based on the tuple not being in the AMQ-filter.
9 . The apparatus of claim 8 , wherein the operation comprises setting the program counter value to an exception handler address based on the tuple not being in the AMQ-filter.
10 . The apparatus of claim 9 , wherein the processing circuitry is configured to transmit the tuple to the AMQ-filter and to receive a response indicating the tuple is not in the AMQ-filter.
11 . The apparatus of claim 8 , wherein the AMQ-filter is configured to determine whether the tuple is in the AMQ-filter based on the instruction being a last instruction of the basic block.
12 . The apparatus of claim 8 , wherein the processing circuitry is configured to reset the current checksum value based on the instruction being a first instruction of the basic block.
13 . The apparatus of claim 8 , wherein the processing circuitry is configured to reset an instruction counter based on the instruction being a first instruction of the basic block, and to increment the instruction counter, corresponding to the processing circuitry fetching the instruction, and the AMQ-filter is configured to determine whether the tuple is in the AMQ-filter, based on the instruction counter exceeding a predetermined threshold.
14 . The apparatus of claim 8 , wherein the processing circuitry is configured to execute the instruction, based on the tuple being in the AMQ-filter.
15 . A non-transitory computer readable medium embodying a set of executable instructions, the set of executable instructions to manipulate at least one processor to:
fetch, at a program counter value, an instruction of a basic block of code;
decode the instruction;
update a checksum value by adding a value of a checksum of the instruction to a current checksum value based on other instructions of the basic block;
determine whether a tuple of the program counter value and the updated checksum value is in an approximate membership query filter (AMQ-filter); and
perform an operation to address a fault attack based on the tuple not being in the AMQ-filter.
16 . The non-transitory computer readable medium of claim 15 , the set of executable instructions to manipulate the at least one processor to:
set the program counter value to an exception handler address based on the tuple not being in the AMQ-filter.
17 . The non-transitory computer readable medium of claim 16 , wherein the determining is performed by transmitting the tuple to the AMQ-filter and receiving a response indicating the tuple is not in the AMQ-filter.
18 . The non-transitory computer readable medium of claim 15 , wherein the determining is performed based on the instruction being a last instruction of the basic block.
19 . The non-transitory computer readable medium of claim 15 , the set of executable instructions to manipulate the at least one processor to:
reset the current checksum value based on the instruction being a first instruction of the basic block.
20 . The non-transitory computer readable medium of claim 15 , the set of executable instructions to manipulate the at least one processor to:
reset an instruction counter based on the instruction being a first instruction of the basic block; and
increment the instruction counter, corresponding to the fetching, wherein the determining is performed based on the instruction counter exceeding a predetermined threshold.