hwasan: Align n_namesz and n_descsz to 4 when reading notes.

There is no requirement for the producer of a note to include the note
alignment in these fields. As a result we can end up missing the HWASAN note
if one of the other notes in the binary has the alignment missing.

Differential Revision: https://reviews.llvm.org/D66692

llvm-svn: 369826
diff --git a/compiler-rt/lib/hwasan/hwasan.cpp b/compiler-rt/lib/hwasan/hwasan.cpp
index 999b511..3a5b879 100644
--- a/compiler-rt/lib/hwasan/hwasan.cpp
+++ b/compiler-rt/lib/hwasan/hwasan.cpp
@@ -276,10 +276,10 @@
     while (note < nend) {
       auto *nhdr = reinterpret_cast<const ElfW(Nhdr) *>(note);
       const char *name = note + sizeof(ElfW(Nhdr));
-      const char *desc = name + nhdr->n_namesz;
+      const char *desc = name + RoundUpTo(nhdr->n_namesz, 4);
       if (nhdr->n_type != NT_LLVM_HWASAN_GLOBALS ||
           internal_strcmp(name, "LLVM") != 0) {
-        note = desc + nhdr->n_descsz;
+        note = desc + RoundUpTo(nhdr->n_descsz, 4);
         continue;
       }