[PATCH] D35818: [scudo] Check for pvalloc overflow

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 15:04:32 PDT 2017


cryptoad created this revision.
Herald added a subscriber: kubamracek.

Previously we were rounding up the size passed to `pvalloc` to the next
multiple of page size no matter what. There is an overflow possibility that
wasn't accounted for. So now, return null in the event of an overflow. The man
page doesn't seem to indicate the errno to set in this particular situation,
but the glibc unit tests go for ENOMEM (https://code.woboq.org/userspace/glibc/malloc/tst-pvalloc.c.html#54)
so we'll do the same.
Update the aligned allocation funtions tests to check for properly aligned
returned pointers, and the `pvalloc` corner cases.

@alekseyshl: do you want me to do the same in the other Sanitizers?


https://reviews.llvm.org/D35818

Files:
  lib/sanitizer_common/sanitizer_allocator_checks.h
  lib/scudo/scudo_allocator.cpp
  test/scudo/memalign.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35818.107975.patch
Type: text/x-patch
Size: 3580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170724/0ba1384d/attachment.bin>


More information about the llvm-commits mailing list