Skip to content

[Bug] Glibc 2.43 removed fastbins #1225

Description

@gtsiam

GEF+GDB version

GEF: (Standalone)
Blob Hash(/usr/share/gef/gef.py): a7cc3c15a0003d975607cc753acef64729fc6344
SHA256(/usr/share/gef/gef.py): 5fe69efbff0471f48a8539a139f1433d7dd9bbc7d28625b30fc8a6665cf59743
GDB: 17.1
GDB-Python: 3.14

Operating System

Arch Linux

Describe the issue you encountered

Glibc has removed fastbins.

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.

Load a basic program that calls malloc a couple of times, and break in gdb right after. Running heap arenas at that point shows garbage because the malloc_state memory layout has changed (doesn't match with p main_arena).

Minimalist test case

// gcc -o malloc malloc.c
#include <stdlib.h>

int main() {
  char *a = malloc(128);
  char *b = malloc(128);
  char *c = malloc(128);

  free(a);
  free(b);
  free(c);

  return 0;
}

Additional context?

Notice top/last_remainder don't match:

gef➤  heap arenas
Arena(base=0x7ffff7e13ac0, top=0x7ffff7e13b08, last_remainder=0x7ffff7e13b18, next=0x0, mem=1, mempeak=2)
gef➤  p main_arena
$1 = {
  mutex = 0x0,
  flags = 0x0,
  top = 0x5555555591b0,
  last_remainder = 0x0,
  bins = {0x7ffff7e13ac8 <main_arena+8>, 0x7ffff7e13ac8 <main_arena+8>, 0x7ffff7e13ad8 <main_arena+24>, 0x7ffff7e13ad8 <main_arena+24>, 0x7ffff7e13ae8 <main_arena+40>,
    0x7ffff7e13ae8 <main_arena+40>, 0x7ffff7e13af8 <main_arena+56>, 0x7ffff7e13af8 <main_arena+56>, 0x7ffff7e13b08 <main_arena+72>, 0x7ffff7e13b08 <main_arena+72>,
    0x7ffff7e13b18 <main_arena+88>, 0x7ffff7e13b18 <main_arena+88>, 0x7ffff7e13b28 <main_arena+104>, 0x7ffff7e13b28 <main_arena+104>, 0x7ffff7e13b38 <main_arena+120>,
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions