-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Support injecting into containers in linux #18
Comments
Hi, I think this sounds really useful. I think there may also need to be a change to the A couple of ideas came to mind already but neither are too satisfying:
Or it could double check
|
Hmmm how about just always using |
Ahh, you mean I was thinking over this some more this morning and I think I've perhaps come up with a clearer API for pyinjector def inject(pid: int, library_path: AnyStr, uninject: bool = False,
process_root: AnyStr = "") -> int:
... which would be called, in those examples, like so injector.inject(b'/path/to/lib.so', process_root=b'/proc/123/root') This has the advantage that it extends generally to any kind of chroot jail and that pyinjector doesn't have to bake in any knowledge about Linux's |
In hypno I just meant that it's possible to always look for a tempdir in the target process' fs using In pyinjector, I like your suggestion, but I think that it'd also be useful to always check for existence of the shared library in the target process' fs (again using |
Can check if the target process has a different
/proc/<pid>/task/<pid>/ns/mnt
. If it does, create the shared library in/proc/pid/root
instead in the current filesystem. Python's tempfile module doesn't support searching for a tempdir in a different filesystem, and it caches it for the whole process once it's found. So maybe we can create a subprocess, nsenter the target filesystem, and then continue normally. Alternatively, just copy the logic intempfile
or assume that/tmp
is writable.The text was updated successfully, but these errors were encountered: