Skip to content

[Bug] Heap command does not work on 32bit ARM architecture #1202

@dziegel

Description

@dziegel

GEF+GDB version

GEF 2025.01
SHA256(/opt/pf/data/home/papgft/gef.py): 1b15645a74bd71170093754d0322f4666cb30a73bc95b78daea7c654e1053487
GDB: 13.1
GDB-Python: 3.11

Operating System

Custom debian bookworm, libc 2.36

Describe the issue you encountered

I am debugging a heap issue on a custom debian based linux on an embedded system using a 32 bit ARMv7 processor. GEF does not correctly parse the main arena, because it assumes padding fields to be present which are actually not.

Specifically, the field "("UNUSED_c", ctypes.c_uint32), # padding to align to 0x10" in function "malloc_state_t()" is not present in my 32 bit architecture. Removing this line makes GEF work as expected.

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

No

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.

Start GEF on a 32 bit ARM architecture and issue "heap arenas" command.

Current output on my system (next pointer is invalid):
Arena(base=0xb66157a4, top=0x543b98, last_remainder=0x543af8, next=0x0, mem=421888, mempeak=3059171121)

Output after removing line "("UNUSED_c", ctypes.c_uint32), # padding to align to 0x10" (next pointer is valid now):
Arena(base=0xb66157a4, top=0x571288, last_remainder=0x543b98, next=0xb5a00018, mem=421888, mempeak=421888)
Arena(base=0xb5a00018, top=0xb5a53b40, last_remainder=0xb5a19db0, next=0xb5900018, mem=344064, mempeak=344064)
Arena(base=0xb5900018, top=0xb59c19f8, last_remainder=0xb59ae3c8, next=0xb5b00018, mem=868352, mempeak=868352)
Arena(base=0xb5b00018, top=0xb5b0f298, last_remainder=0xb5b015c0, next=0xb66157a4, mem=135168, mempeak=135168)

Minimalist test case

No response

Additional context?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions