You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/07/06 00:43:49 UTC

mesos git commit: Updated elfio-3.1.patch to fix alignment bug properly.

Repository: mesos
Updated Branches:
  refs/heads/master 0f9bf5aef -> 89cfa6e23


Updated elfio-3.1.patch to fix alignment bug properly.

The previous patch incorrectly fixed the alignment of an ELF note to 4
bytes (even for 64 bit ELF files). This happened to be OK for our
specific case of parsing '.note.ABI-tag' sections. However, the
alignment for notes in a 64 bit ELF section should be 8-byte aligned
(as the original code attempts to do). The problem with the original
code, however, is that it performs the alignment only on the name
string inside the note, rather than the entire note object itself.
This commit fixes this alignment issue.

Review: https://reviews.apache.org/r/49658/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/89cfa6e2
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/89cfa6e2
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/89cfa6e2

Branch: refs/heads/master
Commit: 89cfa6e237dbc718000f823a2cd6c6f02cdd193d
Parents: 0f9bf5a
Author: Kevin Klues <kl...@gmail.com>
Authored: Tue Jul 5 17:42:52 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Tue Jul 5 17:43:21 2016 -0700

----------------------------------------------------------------------
 3rdparty/elfio-3.1.patch | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/89cfa6e2/3rdparty/elfio-3.1.patch
----------------------------------------------------------------------
diff --git a/3rdparty/elfio-3.1.patch b/3rdparty/elfio-3.1.patch
index f8c20e9..3d85394 100644
--- a/3rdparty/elfio-3.1.patch
+++ b/3rdparty/elfio-3.1.patch
@@ -1,7 +1,8 @@
+Binary files elfio-3.1/elfio/.elfio_note.hpp.swp and elfio-3.1-repo/elfio/.elfio_note.hpp.swp differ
 diff -ruN elfio-3.1/elfio/elfio_note.hpp elfio-3.1-repo/elfio/elfio_note.hpp
 --- elfio-3.1/elfio/elfio_note.hpp	2016-04-23 07:58:34.000000000 -0700
-+++ elfio-3.1-repo/elfio/elfio_note.hpp	2016-07-02 10:32:59.165999433 -0700
-@@ -66,15 +66,12 @@
++++ elfio-3.1-repo/elfio/elfio_note.hpp	2016-07-05 14:05:12.524951042 -0700
+@@ -66,7 +66,7 @@
               namesz + descSize > max_name_size ) {
              return false;
          }
@@ -10,12 +11,16 @@ diff -ruN elfio-3.1/elfio/elfio_note.hpp elfio-3.1-repo/elfio/elfio_note.hpp
          if ( 0 == descSize ) {
              desc = 0;
          }
-         else {
--            int align = sizeof( Elf_Xword );
--            if ( elf_file.get_class() == ELFCLASS32 ) {
--                align = sizeof( Elf_Word );
--            }
-+            int align = sizeof( Elf_Word );
-             desc = const_cast<char*> ( pData + 3*sizeof( Elf_Word ) +
-                                        ( ( namesz + align - 1 ) / align ) * align );
+@@ -75,8 +75,10 @@
+             if ( elf_file.get_class() == ELFCLASS32 ) {
+                 align = sizeof( Elf_Word );
+             }
+-            desc = const_cast<char*> ( pData + 3*sizeof( Elf_Word ) +
+-                                       ( ( namesz + align - 1 ) / align ) * align );
++
++            size_t offset = ( ( 3*sizeof( Elf_Word ) + namesz + align - 1 ) / align ) * align;
++
++            desc = const_cast<char*> (pData + offset);
          }
+ 
+         return true;