<feed xmlns='http://www.w3.org/2005/Atom'>
<title>platform_external_elfutils/src/readelf.c, branch brillo-m7-dev</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>Trust AC_SYS_LARGEFILE to provide large file support</title>
<updated>2015-10-09T17:10:37+00:00</updated>
<author>
<name>Josh Stone</name>
<email>jistone@redhat.com</email>
</author>
<published>2015-10-09T17:10:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=3425454a10d307fae891fb667cf7969e945cde79'/>
<id>3425454a10d307fae891fb667cf7969e945cde79</id>
<content type='text'>
AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS in config.h if needed for
LFS, and this automatically maps things like open to open64.  But quite
a few places used explicit 64-bit names, which won't work on platforms
like FreeBSD where off_t is always 64-bit and there are no foo64 names.
It's better to just trust that AC_SYS_LARGEFILE is doing it correctly.

But we can verify this too, as some file could easily forget to include
config.h.  The new tests/run-lfs-symbols.sh checks all build targets
against lfs-symbols (taken from lintian) to make sure everything was
implicitly mapped to 64-bit variants when _FILE_OFFSET_BITS is set.

Signed-off-by: Josh Stone &lt;jistone@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS in config.h if needed for
LFS, and this automatically maps things like open to open64.  But quite
a few places used explicit 64-bit names, which won't work on platforms
like FreeBSD where off_t is always 64-bit and there are no foo64 names.
It's better to just trust that AC_SYS_LARGEFILE is doing it correctly.

But we can verify this too, as some file could easily forget to include
config.h.  The new tests/run-lfs-symbols.sh checks all build targets
against lfs-symbols (taken from lintian) to make sure everything was
implicitly mapped to 64-bit variants when _FILE_OFFSET_BITS is set.

Signed-off-by: Josh Stone &lt;jistone@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Do without union of variable length arrays.</title>
<updated>2015-10-07T20:44:41+00:00</updated>
<author>
<name>Chih-Hung Hsieh</name>
<email>chh@google.com</email>
</author>
<published>2015-10-06T22:53:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=7eff36d5daa6ebca5e6399638a7643af105ae5b0'/>
<id>7eff36d5daa6ebca5e6399638a7643af105ae5b0</id>
<content type='text'>
Prepare to compile with clang.

A union like
  { T32 a32[n]; T64 a64[n]; } u;
is expanded to
  size_t nbytes = n * MAX(sizeof(T32), sizeof(T64));
  void *data = malloc(nbytes);
  T32 (*a32)[n] = data;
  T64 (*a64)[n] = data;

Signed-off-by: Chih-Hung Hsieh &lt;chh@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Prepare to compile with clang.

A union like
  { T32 a32[n]; T64 a64[n]; } u;
is expanded to
  size_t nbytes = n * MAX(sizeof(T32), sizeof(T64));
  void *data = malloc(nbytes);
  T32 (*a32)[n] = data;
  T64 (*a64)[n] = data;

Signed-off-by: Chih-Hung Hsieh &lt;chh@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Initialize variable before use.</title>
<updated>2015-09-10T12:02:24+00:00</updated>
<author>
<name>Chih-Hung Hsieh</name>
<email>chh@google.com</email>
</author>
<published>2015-09-09T20:59:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=fc0a0f303bf31194c9cef9bb6a766cec9d7794fb'/>
<id>fc0a0f303bf31194c9cef9bb6a766cec9d7794fb</id>
<content type='text'>
Some compiler does not know that error function never returns.

Signed-off-by: Chih-Hung Hsieh &lt;chh@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some compiler does not know that error function never returns.

Signed-off-by: Chih-Hung Hsieh &lt;chh@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace printf %Z length modifier with %z.</title>
<updated>2015-09-07T13:04:22+00:00</updated>
<author>
<name>Chih-Hung Hsieh</name>
<email>chh@google.com</email>
</author>
<published>2015-09-04T17:13:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=2ec957327cdfae6cee592a52958a9c937ea4b13c'/>
<id>2ec957327cdfae6cee592a52958a9c937ea4b13c</id>
<content type='text'>
%Z is a GNU extension predating the ISO C99 %z modifier supported by
libc5 and no longer recommended.

Signed-off-by: Chih-Hung Hsieh &lt;chh@google.com&gt;
Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
%Z is a GNU extension predating the ISO C99 %z modifier supported by
libc5 and no longer recommended.

Signed-off-by: Chih-Hung Hsieh &lt;chh@google.com&gt;
Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>readelf: handle_core_item large right shift triggers undefined behaviour.</title>
<updated>2015-09-03T08:50:58+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mjw@redhat.com</email>
</author>
<published>2015-09-03T08:50:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=b00a4fa78779ff0f304fa6cb34d49622679c86d4'/>
<id>b00a4fa78779ff0f304fa6cb34d49622679c86d4</id>
<content type='text'>
The problem is this:

  int n = ffs (w);
  w &gt;&gt;= n;

The intent is to shift away up to (and including) the first least
significant bit in w. But w is an unsigned int, so 32 bits. And the
least significant bit could be bit 32 (ffs counts from 1). Unfortunately
a right shift equal to (or larger than) the length in bits of the left
hand operand is undefined behaviour. We expect w to be zero afterwards.
Which would terminate the while loop in the function. But since it is
undefined behaviour anything can happen. In this case, what will actually
happen is that w is unchanged, causing an infinite loop...

gcc -fsanitize=undefined will catch and warn about this when w = 0x80000000

https://bugzilla.redhat.com/show_bug.cgi?id=1259259

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The problem is this:

  int n = ffs (w);
  w &gt;&gt;= n;

The intent is to shift away up to (and including) the first least
significant bit in w. But w is an unsigned int, so 32 bits. And the
least significant bit could be bit 32 (ffs counts from 1). Unfortunately
a right shift equal to (or larger than) the length in bits of the left
hand operand is undefined behaviour. We expect w to be zero afterwards.
Which would terminate the while loop in the function. But since it is
undefined behaviour anything can happen. In this case, what will actually
happen is that w is unchanged, causing an infinite loop...

gcc -fsanitize=undefined will catch and warn about this when w = 0x80000000

https://bugzilla.redhat.com/show_bug.cgi?id=1259259

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>readelf: Make sure phdr2_mem lifetime/scope equals phdr2 pointer.</title>
<updated>2015-06-19T11:10:22+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mjw@redhat.com</email>
</author>
<published>2015-06-18T18:24:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=222cd82a154bc1805fa1631e8fa0269482d5be27'/>
<id>222cd82a154bc1805fa1631e8fa0269482d5be27</id>
<content type='text'>
We dont' want GCC to dispose or reuse phdr2_mem stack memory while phdr2
is pointing to it.

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We dont' want GCC to dispose or reuse phdr2_mem stack memory while phdr2
is pointing to it.

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>readelf: Don't leak memory on failure path in handle_gnu_hash.</title>
<updated>2015-06-19T11:08:43+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mjw@redhat.com</email>
</author>
<published>2015-06-18T08:57:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=90a7bd23b1f4ffcace0721634f97ce34553c2288'/>
<id>90a7bd23b1f4ffcace0721634f97ce34553c2288</id>
<content type='text'>
Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>readelf: Fix cie_offset calculation comparison on 32bit.</title>
<updated>2015-04-28T12:14:09+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mjw@redhat.com</email>
</author>
<published>2015-04-22T10:47:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=32d5b6f61a90b3c0c777b73eee973d6816a21294'/>
<id>32d5b6f61a90b3c0c777b73eee973d6816a21294</id>
<content type='text'>
gcc -fsanitize=undefined pointed out that on 32bit systems the calculation
to match the cie_offset to the cie_id could be undefined because a cie_id
could be an unsigned 64bit value while ptrdiff_t is only 32bits. Correct
the calculation to use 64bit values.

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
gcc -fsanitize=undefined pointed out that on 32bit systems the calculation
to match the cie_offset to the cie_id could be undefined because a cie_id
could be an unsigned 64bit value while ptrdiff_t is only 32bits. Correct
the calculation to use 64bit values.

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>readelf: Check all offsets used in print_gdb_index_section against d_size.</title>
<updated>2015-04-28T11:57:29+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mjw@redhat.com</email>
</author>
<published>2015-04-22T09:44:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=f333a1c240d4236d6215c00dd5d88d79893cc350'/>
<id>f333a1c240d4236d6215c00dd5d88d79893cc350</id>
<content type='text'>
https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c29

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c29

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>readelf: Always try to print some debug section information.</title>
<updated>2015-04-28T11:55:35+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mjw@redhat.com</email>
</author>
<published>2015-04-17T20:24:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=9b5f79511717cc26233dd06dd8dab148498db307'/>
<id>9b5f79511717cc26233dd06dd8dab148498db307</id>
<content type='text'>
Even if we cannot create a proper Dwarf dbg we can still print the
information of various debug sections. All all debug print section
functions already check first they can access the appropriate data.

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Even if we cannot create a proper Dwarf dbg we can still print the
information of various debug sections. All all debug print section
functions already check first they can access the appropriate data.

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