Potential trace service improvements
Hello,
While messing around and looking for new protection ideas I came along a couple of weird quarks and issue with the trace service.
- [x] Trace service is unable to trace instructions other than calls even if dnlib’s calculate stack usage method can work with all instructions.~~
- [ ] The return value isn’t very well thought out, if there are multiple stack parameters and multiple different sources of them(eg. branches) it is I,possible to figure which is which.
- [x] The
CalculateStackUsageandUpdateStackmethod could be called with themethod.HasReturnTypefor better accuracy. - [x] Conditional branches aren’t supported properly (maybe?). There is no mention of Cond_Branch flow control here https://github.com/mkaring/ConfuserEx/blob/45b3f025615a55726e62dc6b0e6f814fb577bf55/Confuser.Core/Services/TraceService.cs#L301-L309
If these problems could be resolved I would be grateful.
Thanks in advance!
I've looked more at the trace service and I've realized that it does not really support multiple sources for one argument. Would it be possible to implement such behavior?
Everything is possible :wink: The service likely has to return sets of parameter values that represent all possible values that may be used as parameter.
If you are okay I can make a pull request that addresses points 1 and 3. However, I don't think I know this service well enough for points 2 and 4
You do that. Improving the way the service reports to sources of the parameters for the instruction, may be significantly more difficult. Also that change will require changes to the rest of the obfuscators code.
After reviewing point 4 on my list it turns out that it is actually invalid. I’ve updated the list and now only point 2 remains :)
I guess it's better to use task list for items instead of strikethrough.