[PATCH] D66692: hwasan: Align n_namesz and n_descsz to 4 when reading notes.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 16:32:22 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL369826: hwasan: Align n_namesz and n_descsz to 4 when reading notes. (authored by pcc, committed by ).
Herald added a subscriber: delcypher.

Changed prior to commit:
  https://reviews.llvm.org/D66692?vs=216979&id=216981#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66692/new/

https://reviews.llvm.org/D66692

Files:
  compiler-rt/trunk/lib/hwasan/hwasan.cpp


Index: compiler-rt/trunk/lib/hwasan/hwasan.cpp
===================================================================
--- compiler-rt/trunk/lib/hwasan/hwasan.cpp
+++ compiler-rt/trunk/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;
       }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66692.216981.patch
Type: text/x-patch
Size: 705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190823/64d0dcb5/attachment.bin>


More information about the llvm-commits mailing list