HomeFreeBSD

Fix a double free of libelf data buffers in the USDT link code.

Description

Fix a double free of libelf data buffers in the USDT link code.

libdtrace needs to append to the input object files' string and symbol
tables. Currently it does so by allocating a larger buffer, copying the
existing sections into them, and swapping pointers in the libelf data
descriptors. However, it also frees those buffers when its processing is
complete, which leads to a double free since the elftoolchain libelf
owns them and also frees them in elf_end(3). Instead, free the buffers
originally allocated by libelf.

MFC after: 2 weeks

Details

Provenance
markjAuthored on
Parents
rS313262: Use PC-relative relocations for USDT probe sites on i386 and amd64.
Branches
Unknown
Tags
Unknown