<feed xmlns='http://www.w3.org/2005/Atom'>
<title>platform_external_elfutils/libelf/elf32_updatefile.c, branch android10-release</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/'/>
<entry>
<title>libelf: There is just one ELF version.</title>
<updated>2019-02-28T21:41:14+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2019-02-03T18:05:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=b9d1678951e13e934759a643040da752573f765f'/>
<id>b9d1678951e13e934759a643040da752573f765f</id>
<content type='text'>
Remove (partially defined out) code and data structures dealing with
multiple ELF versions. There hasn't been a new ELF version in the
last 20 years. Simplify the code a bit by just assuming there will
only be one version (EV_CURRENT == 1).

Simplifies elf_version, gets rid of __libelf_version_initialized.
Removes one (or more) array (version) dimension from various tables
and accessor functions (__elf_xfctstom, shtype_map, __libelf_data_type,
__libelf_type_aligns and __libelf_type_sizes).

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;`
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove (partially defined out) code and data structures dealing with
multiple ELF versions. There hasn't been a new ELF version in the
last 20 years. Simplify the code a bit by just assuming there will
only be one version (EV_CURRENT == 1).

Simplifies elf_version, gets rid of __libelf_version_initialized.
Removes one (or more) array (version) dimension from various tables
and accessor functions (__elf_xfctstom, shtype_map, __libelf_data_type,
__libelf_type_aligns and __libelf_type_sizes).

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;`
</pre>
</div>
</content>
</entry>
<entry>
<title>libelf: Get alignment correct when calling conversion functions.</title>
<updated>2018-11-21T11:30:12+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2018-11-17T23:21:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=5f9fab9efb042d803fcd2546f29613493f55d666'/>
<id>5f9fab9efb042d803fcd2546f29613493f55d666</id>
<content type='text'>
When writing out data that needs to be converted we have to make sure
the conversion function is called on correctly aligned buffers. When
using mmap this might mean we have to convert into a temporarily buffer
if the user wants to write out the section at a location that is not
correctly aligned for the section type.

Older gas would generate misaligned ELF notes for the .version
directive. When copying over such notes using mmap from files with
a different endianness using mmap we would get the alignment of the
conversion destination wrong.

The new testcase would fail with configure --enable-sanitize-undefined
on little endian systems. The GCC undefinited sanitizer caught a similar
issue with testfile1 on big endian systems.

gelf_xlate.h:47:1: runtime error: member access within misaligned address
0x7f8145d770d5 for type 'struct Elf32_Nhdr', which requires 4 byte alignment

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When writing out data that needs to be converted we have to make sure
the conversion function is called on correctly aligned buffers. When
using mmap this might mean we have to convert into a temporarily buffer
if the user wants to write out the section at a location that is not
correctly aligned for the section type.

Older gas would generate misaligned ELF notes for the .version
directive. When copying over such notes using mmap from files with
a different endianness using mmap we would get the alignment of the
conversion destination wrong.

The new testcase would fail with configure --enable-sanitize-undefined
on little endian systems. The GCC undefinited sanitizer caught a similar
issue with testfile1 on big endian systems.

gelf_xlate.h:47:1: runtime error: member access within misaligned address
0x7f8145d770d5 for type 'struct Elf32_Nhdr', which requires 4 byte alignment

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libelf: Fix shnum and section zero handling.</title>
<updated>2018-09-13T12:30:30+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2018-09-12T21:38:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=34534cc1740b198b8999dcf97222940a130905ce'/>
<id>34534cc1740b198b8999dcf97222940a130905ce</id>
<content type='text'>
For ELF files with more than SHN_LOWRESERVE sections we always need
section zero to store the section number (it doesn't just fit in the
Ehdr e_shnum field). Make sure to create it if it doesn't exist yet
in elf_getscn. Also fix handling on shnum in updatefile for the mmap
case (we already got this correct for the non-mmap case).

This adds a new test run-copymany-sections.sh which is like
run-copyadd-sections.sh but tries to add two times 65535 sections.
It makes sure libelf can copy the whole file and elfcmp checks they
are the same. It doesn't use mmap for addsections since that doesn't
work yet. ELF_C_RDWR_MMAP needs mremap which will fail since it needs
too much space and the original mmap cannot move.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For ELF files with more than SHN_LOWRESERVE sections we always need
section zero to store the section number (it doesn't just fit in the
Ehdr e_shnum field). Make sure to create it if it doesn't exist yet
in elf_getscn. Also fix handling on shnum in updatefile for the mmap
case (we already got this correct for the non-mmap case).

This adds a new test run-copymany-sections.sh which is like
run-copyadd-sections.sh but tries to add two times 65535 sections.
It makes sure libelf can copy the whole file and elfcmp checks they
are the same. It doesn't use mmap for addsections since that doesn't
work yet. ELF_C_RDWR_MMAP needs mremap which will fail since it needs
too much space and the original mmap cannot move.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libelf: Fix some issues with ELF_C_RDWR_MMAP.</title>
<updated>2018-09-13T12:25:22+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2018-08-12T13:35:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=fb0457f4671e7e0f8331453348005ed6beab275e'/>
<id>fb0457f4671e7e0f8331453348005ed6beab275e</id>
<content type='text'>
When ELF_C_RDWR_MMAP is used libelf might have to write overlapping memory
when moving the section data or headers. Make sure to use memmove, not
memcpy. Also the size of the underlying file might have to change. That
means we will have to also extend the mmap region with mremap. Since we
are using direct pointers into the mmapped area we cannot move the mmap,
only extend it. This might still fail if there is not enough free memory
available to extend the mmap region.

Two new test programs have been added. elfcopy which copies a whole elf
file (using either ELF_C_WRITE or ELF_C_WRITE_MMAP). And addsections which
adds new sections to an existing ELF file (using either ELF_C_RDWR or
ELF_C_RDWR_MMAP). The newly added test will fail under valgrind without
the fixes.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When ELF_C_RDWR_MMAP is used libelf might have to write overlapping memory
when moving the section data or headers. Make sure to use memmove, not
memcpy. Also the size of the underlying file might have to change. That
means we will have to also extend the mmap region with mremap. Since we
are using direct pointers into the mmapped area we cannot move the mmap,
only extend it. This might still fail if there is not enough free memory
available to extend the mmap region.

Two new test programs have been added. elfcopy which copies a whole elf
file (using either ELF_C_WRITE or ELF_C_WRITE_MMAP). And addsections which
adds new sections to an existing ELF file (using either ELF_C_RDWR or
ELF_C_RDWR_MMAP). The newly added test will fail under valgrind without
the fixes.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libelf: Always update last_offset in updatefile and updatemmap.</title>
<updated>2017-04-03T22:03:27+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2017-03-27T15:01:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=a3bf8f0852d0f66911dcf879c5a1fcff3cb4cb46'/>
<id>a3bf8f0852d0f66911dcf879c5a1fcff3cb4cb46</id>
<content type='text'>
When ELF section data was used, but not updated or marked as dirty and
there also existed non-dirty sections and some padding was needed between
the sections (possibly because of alignment) then elf_update might write
"fill" over some of the existing data. This happened because in that case
the last_position was not updated correctly.

Includes a new testcase fillfile that fails before this patch by showing
fill instead of the expected data in some section data. It succeeds with
this patch.

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

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When ELF section data was used, but not updated or marked as dirty and
there also existed non-dirty sections and some padding was needed between
the sections (possibly because of alignment) then elf_update might write
"fill" over some of the existing data. This happened because in that case
the last_position was not updated correctly.

Includes a new testcase fillfile that fails before this patch by showing
fill instead of the expected data in some section data. It succeeds with
this patch.

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

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lib: Provide MAX and MIN in system.h</title>
<updated>2016-10-12T13:43:14+00:00</updated>
<author>
<name>Akihiko Odaki</name>
<email>akihiko.odaki.4i@stu.hosei.ac.jp</email>
</author>
<published>2016-10-11T14:06:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=60b2bf1b08c621492410b24e469b2bdf58d167d5'/>
<id>60b2bf1b08c621492410b24e469b2bdf58d167d5</id>
<content type='text'>
This change also creates a new header file libeu.h to provide the
prototypes for the function of libeu. That hides the definition of function
crc32, which can conflict with zlib, from libelf. It also prevents mistakes
to refer those functions from a component which doesn't link with libeu,
such as libelf.

Signed-off-by: Akihiko Odaki &lt;akihiko.odaki.4i@stu.hosei.ac.jp&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change also creates a new header file libeu.h to provide the
prototypes for the function of libeu. That hides the definition of function
crc32, which can conflict with zlib, from libelf. It also prevents mistakes
to refer those functions from a component which doesn't link with libeu,
such as libelf.

Signed-off-by: Akihiko Odaki &lt;akihiko.odaki.4i@stu.hosei.ac.jp&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libelf: Don't leak memory when out of memory in updatemmap.</title>
<updated>2016-02-22T11:14:44+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mjw@redhat.com</email>
</author>
<published>2016-02-13T18:51:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=7249c8e4b5ad7b5dfea0d8bf2a9ca05469575822'/>
<id>7249c8e4b5ad7b5dfea0d8bf2a9ca05469575822</id>
<content type='text'>
We forgot to free scns when returning ELF_E_NOMEM.

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We forgot to free scns when returning ELF_E_NOMEM.

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Move nested functions in libelf.</title>
<updated>2015-10-22T20:43:42+00:00</updated>
<author>
<name>Chih-Hung Hsieh</name>
<email>chh@google.com</email>
</author>
<published>2015-10-14T02:06:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=239d859169543c21fcb43e27d4a81a9948a2b42d'/>
<id>239d859169543c21fcb43e27d4a81a9948a2b42d</id>
<content type='text'>
* Move nested functions to file scope
  in libelf/elf_begin.c and elf32_updatefile.c
  to compile with clang.

Signed-off-by: Chih-Hung Hsieh &lt;chh@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Move nested functions to file scope
  in libelf/elf_begin.c and elf32_updatefile.c
  to compile with clang.

Signed-off-by: Chih-Hung Hsieh &lt;chh@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libelf: Don't leak memory on failure paths in elf_updatefile.</title>
<updated>2015-06-19T11:08:00+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mjw@redhat.com</email>
</author>
<published>2015-06-18T08:50:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=3c57452a45b9ab3ce9fa7994c42eda677483cb46'/>
<id>3c57452a45b9ab3ce9fa7994c42eda677483cb46</id>
<content type='text'>
When something goes wrong during the update make sure to always free any
temporary allocated memory (shdr_data and/or scns).

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When something goes wrong during the update make sure to always free any
temporary allocated memory (shdr_data and/or scns).

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libelf: Don't call mempcpy with possible NULL d_buf.</title>
<updated>2015-06-05T12:44:59+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mjw@redhat.com</email>
</author>
<published>2015-05-30T21:43:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=b4ad3c4b81c57b36d9837dc81523cfa7950f30a7'/>
<id>b4ad3c4b81c57b36d9837dc81523cfa7950f30a7</id>
<content type='text'>
When d_size is zero d_buf might be NULL. last_position doesn't need to be
updated in that case.

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When d_size is zero d_buf might be NULL. last_position doesn't need to be
updated in that case.

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
