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

Fix vmmap coredump test #1391

Merged
merged 2 commits into from
Nov 22, 2022
Merged

Fix vmmap coredump test #1391

merged 2 commits into from
Nov 22, 2022

Conversation

disconnect3d
Copy link
Member

@disconnect3d disconnect3d commented Nov 22, 2022

This commits/PR fixes two issues and test them.

  1. It changes the reads in get_ehdr to partial reads so that inability
    to read the vmmap.start address there will not crash Pwndbg with
    gdb.error but instead we will simply return None as expected from
    this function. This crash could happen on Debian 10 (GDB 8.2.1) and
    Ubuntu 18.04 (not sure which GDB) when you did:
  • gdb ./binary-that-crashes
  • run
  • generate-core-file /tmp/core
  • file - to unload the binary
  • core-file /tmp/core - to load the generated core

At this point I think we may have preserved the old vmmap info and use
it in get_ehdr maybe, which then crashed? I am not sure, but this fix
here works.

To test this behavior properly I also added the unload_file
parametrization to the
test_command_vmmap_on_coredump_on_crash_simple_binary test.

  1. We fix the vmmap coredump test case when the info proc mappings returns nothing on core
    dumps on old GDBs. In such case we are missing the vmmap info about
    the binary mapping, so now we properly remove it in the test.

This commit fixes two issues and test them.

1. It changes the reads in `get_ehdr` to partial reads so that inability
   to read the `vmmap.start` address there will not crash Pwndbg with
`gdb.error` but instead we will simply return `None` as expected from
this function. This crash could happen on Debian 10 (GDB 8.2.1) and
Ubuntu 18.04 (not sure which GDB) when you did:
- gdb ./binary-that-crashes
- `run`
- `generate-core-file /tmp/core`
- `file` - to unload the binary
- `core-file /tmp/core` - to load the generated core

At this point I think we may have preserved the old vmmap info and use
it in `get_ehdr` maybe, which then crashed? I am not sure, but this fix
here works.

To test this behavior properly I also added the `unload_file`
parametrization to the
`test_command_vmmap_on_coredump_on_crash_simple_binary` test.

2. We fix the vmmap coredump test case when the `info proc mappings` returns nothing on core
   dumps on old GDBs. In such case we are missing the vmmap info about
the binary mapping, so now we properly remove it in the test.
@disconnect3d disconnect3d merged commit c6ab8dc into dev Nov 22, 2022
@disconnect3d disconnect3d deleted the fix-vmmap-coredump-test branch November 22, 2022 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant