Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asan should instrument calls via pointer #75

Closed
ramosian-glider opened this issue Aug 31, 2015 · 4 comments
Closed

asan should instrument calls via pointer #75

ramosian-glider opened this issue Aug 31, 2015 · 4 comments

Comments

@ramosian-glider
Copy link
Member

Originally reported on Google Code with ID 75

Like here: 

void caller(void (*callback)(int), int input) {
  callback(input);
}

Reported by konstantin.s.serebryany on 2012-05-29 14:58:46

@ramosian-glider
Copy link
Member Author

On second thought I don't see a good test case where this would be interesting. 
Closing until we find such test. 

Reported by konstantin.s.serebryany on 2012-05-30 10:55:29

  • Status changed: WontFix

@ramosian-glider
Copy link
Member Author

This would be really useful if we want to do native execution of statically instrumented
code in a hybrid tool.

If the LLVM instrumented code is not running in the code cache, then DR (or any other
DBI framework) will not be able to detect indirect calls across module boundaries.

For x86, I was thinking this should be something like this.  Instead of a standard
indirect call:
call reg/mem

Do:
mov rax, reg/mem
call indirect_call_trampoline
...
indirect_call_trampoline:
jmp %rax

Then DR can patch indirect_call_trampoline when it is present, and performance shouldn't
suffer much when it isn't.

If you did this at the LLVM level, you'd want to find some way to make the arguments
match the callee perfectly, so the trampoline is optimized to a jmp without any parameter
marshaling.  It might be possible to do this with a custom calling convention.  Query
the CC used, find a clobbered register not used for params, create a new CC with that
reg as the first param, and pass the function pointer in it.

Reported by rnk@google.com on 2012-05-30 12:54:56

@ramosian-glider
Copy link
Member Author

That's another story. Agree, this might be helpful. 
In the original report I meant that we need to check if callback points to addressable
memory, but then realized that I can't imagine a test where this would be useful. 

Reported by konstantin.s.serebryany on 2012-05-30 13:04:15

@ramosian-glider
Copy link
Member Author

Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:12:59

  • Labels added: ProjectAddressSanitizer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant