[all-commits] [llvm/llvm-project] a9d5f8: [scudo][standalone] Fix a race in the secondary re...

Kostya Kortchinsky via All-commits all-commits at lists.llvm.org
Wed Feb 5 11:03:06 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a9d5f8989d83dee1ed01b7f8eaaab89ad190116a
      https://github.com/llvm/llvm-project/commit/a9d5f8989d83dee1ed01b7f8eaaab89ad190116a
  Author: Kostya Kortchinsky <kostyak at google.com>
  Date:   2020-02-05 (Wed, 05 Feb 2020)

  Changed paths:
    M compiler-rt/lib/scudo/standalone/secondary.h
    M compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp

  Log Message:
  -----------
  [scudo][standalone] Fix a race in the secondary release

Summary:
I tried to move the `madvise` calls outside of one of the secondary
mutexes, but this backfired. There is situation when a low release
interval is set combined with secondary pressure that leads to a race:
a thread can get a block from the cache, while another thread is
`madvise`'ing that block, resulting in a null header.

I changed the secondary race test so that this situation would be
triggered, and moved the release into the cache mutex scope.

Reviewers: cferris, pcc, eugenis, hctim, morehouse

Subscribers: jfb, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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




More information about the All-commits mailing list