]> git.ipfire.org Git - thirdparty/qemu.git/commit
linux-user/elfload: Write corefile elf header in one block
authorRichard Henderson <richard.henderson@linaro.org>
Tue, 27 Feb 2024 16:34:18 +0000 (06:34 -1000)
committerRichard Henderson <richard.henderson@linaro.org>
Thu, 29 Feb 2024 21:03:39 +0000 (11:03 -1000)
commit243c47066253c4236b8792ee158f9971d1c27bf9
treed598a96ec0f65085ed5f466ca566189fb0516f54
parent2410d28dc992082ec3348d6544ef30c1f950c8b9
linux-user/elfload: Write corefile elf header in one block

Fixes a bug in which write_note() wrote namesz_rounded
and datasz_rounded bytes, even though name and data
pointers contain only the unrounded number of bytes.

Instead of many small writes, allocate a block to contain all
of the elf headers and all of the notes.  Copy the data into the
block piecemeal and the write it to the file as a chunk.
This also avoids the need to lseek forward for alignment.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
linux-user/elfload.c