Skip to content

Segfault in erw64n_rebuild_gnu_hash #22

@BastianBlokland

Description

@BastianBlokland

Thank you for the awesome tool, I'm facing a segfault when targeting glibc 2.31 on a executable built with clang-18 (and linked with lld).

Starting program: /home/bastian/dev/external/polyfill-glibc/polyfill-glibc volo-polyfill-repro --target-glibc=2.31

Program received signal SIGSEGV, Segmentation fault.
0x00005555555bad66 in erw64n_rebuild_gnu_hash (erw=0x7fffffffd760) at src/erw_nne.h:1810
1810	      buckets[i] = 0;
(gdb) p i
$1 = 932924
(gdb) bt
#0  0x00005555555bad66 in erw64n_rebuild_gnu_hash (erw=0x7fffffffd760) at src/erw_nne.h:1810
#1  0x00005555555bb98a in erw64n_dsyms_flush (erw=0x7fffffffd760) at src/erw_nne.h:1884
#2  0x00005555555c22b3 in erw64n_flush (erw=0x7fffffffd760) at src/erw_nne.h:2574
#3  0x00005555555f9289 in erw_flush (erw=0x7fffffffd760) at src/erw.c:1328
#4  0x000055555556e530 in main (argc=3, argv=0x7fffffffdad8) at src/main.c:972

It seems that old_u32_count in erw_nne.h:1750 is invalid: 4294967198.

Repro:

wget https://bastian.tech/temp/volo-polyfill-repro.gz
gunzip volo-polyfill-repro.gz
./polyfill-glibc volo-polyfill-repro --target-glibc=2.31

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions