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

Launch QEMU with sysroot if specified #1241

Merged
merged 3 commits into from
Dec 9, 2019
Merged

Conversation

gsingh93
Copy link
Contributor

@gsingh93 gsingh93 commented Dec 27, 2018

When launching an ARM binary with QEMU using gdb.debug, we need to specify the -L flag to tell QEMU where the sysroot is. Otherwise it will use the default system root instead of the one we specified.

I tested this with the following code before and after this change:

#!/usr/bin/env python2

from pwn import *

context(arch='arm')
p = gdb.debug('./nightmare', sysroot='./')
p.interactive()

Afterwards, I could see that the loaded libraries in vmmap were from the correct sysroot.

@zachriggle
Copy link
Member

@gsingh93 can you double-check that my change (should be cosmetic only) still works for your use-case?

@gsingh93
Copy link
Contributor Author

gsingh93 commented Feb 18, 2019

@zachriggle no, qemu_user is missing from the qemu_args array on line 432. We also need to add add this flag along with the -g flag, which was why in my commit I'm appending the original arguments (containing the -g flag) after I added the -L flag.

@gsingh93
Copy link
Contributor Author

ping @zachriggle

pwnlib/gdb.py Outdated
args = [qemu_user, '-g', str(qemu_port)] + args
qemu_args = [qemu_user, '-g', str(qemu_port)]
if sysroot:
qemu_args = ['-L', sysroot]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we discard the previous QEMU args this way?

@Arusekk Arusekk merged commit f6fe196 into Gallopsled:dev Dec 9, 2019
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.

3 participants