-
-
Notifications
You must be signed in to change notification settings - Fork 617
Allowing GDB to call functions in guest kernel #19
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
Comments
Can you also make:
and link to them from this issue? If something needs to be patched here, I will definitely accept it to make this awesome functionality work. I'd rather have the QEMU part upstreamed first though if we need to patch QEMU. |
Can you confirm you have the same bug? |
Yes, I reproduce what you said. Some symbols are weirdly not visible to E.g.: if I break on
even though
|
I spun up a thread on qemu-devel. You can't call printk remotely, because the kernel doesn't have a malloc. Unless you add one, like: void *malloc(unsigned long long sz){ return kmalloc(sz, GFP_KERNEL); } I put this in printk.c and printk started working when called. Not obviously necessary. |
Hmm, I also noticed that the same error message:
happens when I try to end many functions with:
|
Found the bug, it’s in the gdb stub. Basically it doesn’t know how big a
register is and pukes. I have a cheap fix where I just tell it to send 8,
but I’d like to fix this right.
…On Sun, Apr 15, 2018 at 2:41 AM Ciro Santilli 包子露宪 六四事件 法轮功 < ***@***.***> wrote:
Hmm, I also noticed that the same error message:
Could not fetch register "orig_rax"; remote failure reply 'E14'
happens when I try to end many functions with:
fin
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#19 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACAl5ivZkU3qYp9yfQ3ER-S0_a-vIY5Gks5toxXigaJpZM4SC8yy>
.
|
Unclear if this bug is everyone, or just me, but.
To get around E14 errors when you try to call into the guest kernel, you have to modify qemu's gdbstub.c such that if gdb_read_register returns 0, you force it to 4 or 8 (usually 8).
To actually execute code, you must disable NX with noexec=off and noexec32=off.
You don't get access to all functions, but you get more than you get from a kernel module. Some goop with -rdynamic, -E, and objcopy -w -G* should fix this.
The text was updated successfully, but these errors were encountered: