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

Implement "hw" watchpoints as in Dwarf #224

Open
enovella opened this issue Apr 21, 2020 · 7 comments
Open

Implement "hw" watchpoints as in Dwarf #224

enovella opened this issue Apr 21, 2020 · 7 comments
Milestone

Comments

@enovella
Copy link
Contributor

https://github.com/iGio90/Dwarf/blob/master/dwarf_debugger/lib/core.js#L4839

@trufae
Copy link
Member

trufae commented Apr 22, 2020

are those watchpoints based on hooking getters/setters for the class fields or its like a real hw? any PoC implementation instead of this one that is very tied to the dwarf internals? i think both kind of watchpoints would be interesting to have in r2frida. any hints here @oleavr @mrmacete ?

@trufae
Copy link
Member

trufae commented May 1, 2020

cc @iGio90

@iGio90
Copy link

iGio90 commented May 1, 2020

Well the logic is pretty simple. I think @PinkiePieStyle reworked them to use MemoryAccessMonitor (at least on windows). For what concerne unix, it's a matter of altering the permissions:

  • Memory.protect(address, 1, perm_needed(remove perm for read/write for the needed))
  • analyze the stack trace provided by Process.setExceptionHandler
  • restore correct permissions
  • return true on the exception handler
  • notify the ui

if needed we are also adding an interceptor to the address which attempt to r/w the given watchpoint address and break it to give runtime instrumentation

@oleavr
Copy link
Member

oleavr commented May 2, 2020

@iGio90 Cool! MemoryAccessMonitor is now also supported on the other platforms in recent versions of Frida.

@trufae
Copy link
Member

trufae commented May 2, 2020

Thanks @iGio90 for the explanation :) having such primitive stable in Frida will make implementing that much easily. Hope to get that ready before 4.5. i'll start using milestones in r2frida

@trufae trufae added this to the 4.5.0 milestone May 2, 2020
@trufae trufae modified the milestones: 4.5.0, 5.9.4 Feb 16, 2024
@trufae
Copy link
Member

trufae commented Oct 7, 2024

Ole added sw and hw bps support in frida natively. so we can finally expose this functionality in r2frida without hacks like dwarf did at the time.

@trufae
Copy link
Member

trufae commented Oct 8, 2024

waiting here #630

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

No branches or pull requests

4 participants