[all-commits] [llvm/llvm-project] 718411: Fix `asan/TestCases/Darwin/scrible.cpp` to work on...

Dan Liew via All-commits all-commits at lists.llvm.org
Wed Sep 8 09:53:27 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 71841146b6222ef7eea06b9facd94d0e0c29c62b
      https://github.com/llvm/llvm-project/commit/71841146b6222ef7eea06b9facd94d0e0c29c62b
  Author: Dan Liew <dliew at apple.com>
  Date:   2021-09-08 (Wed, 08 Sep 2021)

  Changed paths:
    M compiler-rt/test/asan/TestCases/Darwin/scribble.cpp

  Log Message:
  -----------
  Fix `asan/TestCases/Darwin/scrible.cpp` to work on platforms where `long` is not 64-bits.

Previously the test was failing on platforms where `long` was less than
64-bits wide (e.g. older WatchOS simulators and arm64_32) because the
`padding` field was too small.

The test currently relies on the `my_object->isa` being scribbled or
left unmodified after `my_object` is freed. However, this was not the
case because the `isa` pointer intersected with
`ChunkHeader::free_context_id`.  `free_context_id` starts at the
beginning of user memory but it only initialized once the memory is
freed. This caused the `isa` pointer to change after it was freed
leading to the test crashing.

To fix this the `padding` field has been made explicitly 64-bits wide
(same size as `ChunkHeader::free_context_id`).

rdar://75806757

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




More information about the All-commits mailing list