https://sourceware.org/bugzilla/show_bug.cgi?id=31225

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Mark Wielaard <mark at klomp dot org> ---
commit cc44ac6740797a23cd0af0cb22bd828d569224b8
Author: Mark Wielaard <m...@klomp.org>
Date:   Thu Feb 1 14:56:18 2024 +0100

    libelf: Treat elf_memory as if using ELF_C_READ_MMAP

    An Elf handle created through elf_memory was treated as if opened with
    ELF_C_READ. Which means libelf believed it had read the memory itself
    and could simply write to it if it wanted (because it wasn't mmaped
    directly on top of a file). This causes issues when that memory was
    actually read-only. Work around this by pretending the memory was
    actually read with ELF_C_READ_MMAP (so directly readable, but not
    writable).

    Add extra tests to elfgetzdata to check using elf_memory with
    read-only memory works as expected.

              * libelf/elf_memory.c (elf_memory): Call
              __libelf_read_mmaped_file with ELF_C_READ_MMAP.
              * tests/elfgetzdata.c (main): Add new "mem" option.
              * tests/run-elfgetzdata.sh: Also run all tests with new
              "mem" option.

    https://sourceware.org/bugzilla/show_bug.cgi?id=31225

    Reported-by: Derek Bruening <bruen...@google.com>
    Signed-off-by: Mark Wielaard <m...@klomp.org>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to