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

[Bug] search-pattern doesn't work in gef-remote when connected to qemu-system. #905

Closed
1 of 9 tasks
clubby789 opened this issue Oct 22, 2022 · 0 comments · Fixed by #906
Closed
1 of 9 tasks

[Bug] search-pattern doesn't work in gef-remote when connected to qemu-system. #905

clubby789 opened this issue Oct 22, 2022 · 0 comments · Fixed by #906

Comments

@clubby789
Copy link
Contributor

GEF+GDB version

GEF: rev:a36ffbec735237f80f5ed00505f4e42ac092b571 (Git - clean)
SHA256(/opt/gef/gef.py): 95952d6c698fae3fe5ac0977298f63f4e9e176de5c116702996081a47bde993f
GDB: 12.1
GDB-Python: 3.10

Operating System

Manjaro

Describe the issue you encountered

After connecting to the qemu-system GDB stub (gef-remote --qemu-user --qemu-binary /tmp/vmlinux localhost 1234), using search-pattern pattern gives this output:

[+] Searching 'pattern' in memory
[!] Command 'search-pattern' failed to execute properly, reason: No auxiliary vector found, or failed reading it.

Handling an exception can resolve this issue (under auxiliary_vector)

-            auxv_info = gdb.execute("info auxv", to_string=True)
+            try:
+                auxv_info = gdb.execute("info auxv", to_string=True)
+            except gdb.error:
+                auxv_info = None

In search_pattern_by_address, however, gef iterates over the entire memory map, returning as soon as reading fails. As Qemu reports memory as beginning at 0, the search fails immediately.

pwndbg seems to approach this issue by special-casing a connection to a QEMU kernel instance and using monitor info mem to retrieve the real memory mappings.

Do you read the docs and look at previously closed issues/PRs for similar cases?

Yes

Architecture impacted

  • X86
  • X64
  • ARM
  • ARM64
  • MIPS
  • MIPS64
  • PPC
  • PPC64
  • RISCV

Describe your issue. Without a proper reproduction step-by-step, your issue will be ignored.

Described above

Minimalist test case

No response

Additional context?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant