trailofbits / binary_type_inference

GNU General Public License v3.0
15 stars 2 forks source link

Handle Callsite Specific Extern Argument Constraints #9

Open 2over12 opened 2 years ago

2over12 commented 2 years ago
extern int additional_compute(int val);

void compute(int* ptr) {
    *ptr = additional_compute(*ptr);
}

Ghidra's definition for the stub additional_compute has no arguments. This means the type inference constraint generation does not generate any actual -> formal argument constraints for the call to additional_compute. The decompiler does guess correctly that a single argument is passed to additional compute in compute, so there should be some way to extract these constraints. The high function, however, does not contain info about where the argument is located (top of the stack in the case of x86) which would be required. Back logging this because this only causes missed info if we have a type signature for the extern. If we have a type signature then the parameter will be available in ghidra.