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

Introduce GDB interface #218

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

giulianobelinassi
Copy link
Collaborator

Libpulp requires the ulp tool in order to load and apply livepatches, using the ptrace mechanism for that. This introduces a series of issues while debugging the application, such as unable to livepatch an application lauched under gdb, and unable to livepatch programs being analyzed under valgrind's memcheck.

This PR introduces a gdb interface to it. To build it, configure libpulp with:

configure --enable-gdb-interface

and livepatches can be applied by called the functions:

  • gdb_ulp_apply("<path-to-livepatch>")
  • gdb_ulp_revert("<path-to-livepatch>")

Such functions can also be called from the program itself by calling dlsym(NULL, "gdb_ulp_apply") to get the pointer to the function and then calling it.

This small ELF parser contains just the bare minimum functions so we
can load ELF sections without the use of any external library.  This
module also doesn't allocate dynamic memory.

Signed-off-by: Giuliano Belinassi <[email protected]>
Livepatch load works but it doesn't modify the addresses because there
is nothing to interpret the insn_queue.

Signed-off-by: Giuliano Belinassi <[email protected]>
This commit adds a insnq_interp in libpulp side as a way to trigger a
livepatch without the `ulp` tool.  This is useful for debugging libpulp
as for example to use it in valgrind, since we can't run it under
addrsan.

Signed-off-by: Giuliano Belinassi <[email protected]>
The gdb interface should be used for debugging libpulp, so applications
may not want this exposed.

To enable it, build with
```
configure --enable-gdb-interface
```

Signed-off-by: Giuliano Belinassi <[email protected]>
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

Successfully merging this pull request may close these issues.

1 participant