[all-commits] [llvm/llvm-project] 2426cc: Dynamically allocate scudo allocation buffer.

Florian Mayer via All-commits all-commits at lists.llvm.org
Wed Jan 11 16:53:31 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2426cc773a9d4d11a8ef94fc411bfe9acd7eacad
      https://github.com/llvm/llvm-project/commit/2426cc773a9d4d11a8ef94fc411bfe9acd7eacad
  Author: Florian Mayer <fmayer at google.com>
  Date:   2023-01-11 (Wed, 11 Jan 2023)

  Changed paths:
    M compiler-rt/lib/scudo/standalone/combined.h
    M compiler-rt/lib/scudo/standalone/flags.inc
    M compiler-rt/lib/scudo/standalone/fuzz/get_error_info_fuzzer.cpp
    M compiler-rt/lib/scudo/standalone/tests/combined_test.cpp

  Log Message:
  -----------
  Dynamically allocate scudo allocation buffer.

This is so we can increase the buffer size for finding elusive bugs.

Tested by hand with this program

```

int main(int argc, char** argv) {
  if (argc < 2)
    return 1;
  int n = atoi(argv[1]);
  char* x = reinterpret_cast<char*>(malloc(1));
  *((volatile char*)x) = 1;
  free(x);
  for (; n > 0; --n) {
    char* y = reinterpret_cast<char*>(malloc(1024));
    *((volatile char*)y) = 1;
    free(y);
  }
  *x = 2;
  return 0;
}
```

SCUDO_OPTIONS=allocation_ring_buffer_size=30000 ./uaf 1000000
-> no allocation trace
SCUDO_OPTIONS=allocation_ring_buffer_size=30000000 ./uaf 1000000
-> allocation trace

Reviewed By: hctim, eugenis

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




More information about the All-commits mailing list