Hi all,
I try to use libelf for modify Linux kernel modules (for
instrumentation purposes).
When only some bytes in ELF sections' data are changed, everything
works.
When new data blocks are appended to some sections, everything works
provided that previous blocks has been read (using elf_getdata()).
Otherwise previouse section's content are zeroed or even entire
section disappears.
When try to append new section to the file, either error about
insufficient memory occures at update (elf_update()) stage, or no error
generated, but section is not added.
Attached simple program demonstrates another behaviour, when section
with garbage in its header is added. Valgrind shows that library calls
pwrite() with buffer contained some unaddressable bytes.
I even try to manually mark different ELF elements as dirty (using
elf_flag*()), but nothing is changed.
Does the example is wrong? Or library contains errors in implementation?
--
With regards,
Andrey Tsyvarev mailto:tsyvarev@ispras.ru
Attachments:
- test.c
(application/octet-stream — 2.1 KB)
Show replies by date