[PATCH] D12790: ubsan: Implement memory permission validation for vtables.

Stephan Bergmann via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 07:19:41 PDT 2015

sberg added a subscriber: sberg.
sberg added a comment.

If this gets re-enabled after r248157 "Revert 'ubsan: Implement memory permission validation for vtables,'" please consider modifying isValidVptr as

     MemoryMappingLayout Layout(/*cache_enabled=*/true);
     uptr Start, End, Prot;
     while (Layout.Next(&Start, &End, 0, 0, 0, &Prot)) {
  +    Prot &= ~MemoryMappingLayout::kProtectionShared;
       if (Start <= ((uptr)Vtable) && ((uptr)Vtable) <= End &&
           (Prot == MemoryMappingLayout::kProtectionRead ||
            Prot == (MemoryMappingLayout::kProtectionRead |

for code like LibreOffice that synthesizes vtables at runtime, and can do so via the double-mmap technique described at http://www.akkadia.org/drepper/selinux-mem.html (to appease SELinux),



More information about the llvm-commits mailing list