[all-commits] [llvm/llvm-project] b20808: scudo: Limit the number of bytes tested in a reall...

pcc via All-commits all-commits at lists.llvm.org
Wed Nov 27 10:33:11 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b208088a2111aeb805d0984a2ff86b3ce14c725a
      https://github.com/llvm/llvm-project/commit/b208088a2111aeb805d0984a2ff86b3ce14c725a
  Author: Peter Collingbourne <peter at pcc.me.uk>
  Date:   2019-11-27 (Wed, 27 Nov 2019)

  Changed paths:
    M compiler-rt/lib/scudo/standalone/tests/combined_test.cpp

  Log Message:
  -----------
  scudo: Limit the number of bytes tested in a realloc test.

This test was previously effectively doing:
P = malloc(X); write X bytes to P; P = realloc(P, X - Y); P = realloc(P, X)
and expecting that all X bytes stored to P would still be identical after
the final realloc.

This happens to be true for the current scudo implementation of realloc,
but is not guaranteed to be true by the C standard ("Any bytes in the new
object beyond the size of the old object have indeterminate values.").
This implementation detail will change with the new memory tagging support,
which unconditionally zeros newly allocated granules when memory tagging
is enabled. Fix this by limiting the number of bytes that we test to the
minimum size that we realloc the allocation to.

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




More information about the All-commits mailing list