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

Dynamic attaching to process #222

Open
catap opened this issue Jul 10, 2017 · 12 comments
Open

Dynamic attaching to process #222

catap opened this issue Jul 10, 2017 · 12 comments

Comments

@catap
Copy link
Contributor

catap commented Jul 10, 2017

Hey,

strace for example can dynamic attach to process and trace it. I think we can do same over ptrace and some magic :)

@catap catap self-assigned this Jul 10, 2017
@ronaldtse
Copy link
Contributor

@catap we're all eager to see magic 👍

@erikbor
Copy link
Contributor

erikbor commented Jul 11, 2017

@catap, please take into account multi platform support for this (e.g.: *BSD's and macOS). Cheers.

@pablo-mendoza
Copy link
Contributor

This would be pretty hard to do with our current approach (shared library). We would need to basically force the dynamic linker to re link everything. I'm thinking it could somehow be done in Linux, not sure about about the other platforms and it we can it would be pretty platform specific code.

@pablo-mendoza
Copy link
Contributor

For linux see man dl_iterate_phdr

@catap
Copy link
Contributor Author

catap commented Jul 12, 2017

@riataman or we can do it over ptrace. I did a littel googling and found this: https://stackoverflow.com/questions/24355344/inject-shared-library-into-a-process

Anyway, I have no idea how it's possible on *BSD. For macOS I have idea try to use dtrace, but I'm not sure.

@drystone
Copy link
Contributor

drystone commented Jul 12, 2017 via email

@pablo-mendoza
Copy link
Contributor

@catap are you taking a crack at this? Otherwise I'd like to give this a go.

@catap catap assigned pablo-mendoza and unassigned catap Jul 14, 2017
@catap
Copy link
Contributor Author

catap commented Jul 14, 2017

@riataman it's yours :)

@erikbor
Copy link
Contributor

erikbor commented Oct 9, 2017

@riataman is this still something you want to work on?

@pablo-mendoza
Copy link
Contributor

Well, I looked at this for a while but never found a solution I was happy with. I made some tests works but those required to use gdb to inject into the running process.

There was another option of manually injecting the so, but that required very platform dependant asm code for each OS/architecture.

I would have been happy if there was a libgdb that I could use, but something like that was abandoned by the gdb developers many moons ago.

Long story short, if someone wants to give this a shoot feel free to do so.

@pablo-mendoza pablo-mendoza removed their assignment Oct 9, 2017
@erikbor
Copy link
Contributor

erikbor commented Oct 11, 2017

@riataman Thanks for the update

@ronaldtse
Copy link
Contributor

@catap would you be able to work your magic on this? 😉

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

5 participants