You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void crash(int* ptr) {
*ptr = 3;
}
int main(){
int* p;
int cond = 1;
p = 0x0;
if (cond)
crash(p);
cond += 2;
return cond - *p;
}
Compiled with: $ clang -g -O0 m.c -o m
In the decompiled MIR, for the presented test case, in the main() frame,
call instruction (corresponding to crash(p)) is the last in it's Basic block.
Since Decompiler marks with crash-start flag, the instruction after call,
it means that crash-start instruction for main() frame is first in it's Basic block.
For this reason, Taint Analysis is skipped for function main() and
any upper frames in similar cases.
The text was updated successfully, but these errors were encountered:
niktesic
changed the title
Upper frame crash-start sinked into next BB
Upper frame crash-start sunk into next BB
Dec 16, 2022
It does not make sense why main() is skipped. Is there an issue in starting analysis at the start of a basic-block? The function main() should be analyzed from call-site( crash()) back to entry point of main.
It does not make sense why main() is skipped. Is there an issue in starting analysis at the start of a basic-block? The function main() should be analyzed from call-site( crash()) back to entry point of main.
The current Taint Analysis implementation expects the following sequence of instructions for any upper frame:
First analyzed instruction for that frame
Call instruction to the lower frame
Crash-start instruction after the call
Whole sequence needs to be in the same Basic Block.
There are two possible solutions that come to my mind:
Add artificial NOP after Call instruction to ensure there is expected sequence
Make TA resilient to such cases, and look for the first analyzed instruction in the previous BB.
For this reason, Taint Analysis is skipped for function main() and
any upper frames in similar cases.
My mistake, the TA would be performed for upper frames, but the corrupted one (without expected instruction sequence) would be skipped.
Test source code:
Compiled with:
$ clang -g -O0 m.c -o m
In the decompiled MIR, for the presented test case, in the
main()
frame,call instruction (corresponding to
crash(p)
) is the last in it's Basic block.Since Decompiler marks with
crash-start
flag, the instruction after call,it means that
crash-start
instruction formain()
frame is first in it's Basic block.For this reason, Taint Analysis is skipped for function
main()
andany upper frames in similar cases.
The text was updated successfully, but these errors were encountered: