[all-commits] [llvm/llvm-project] ace26b: [Profile] Disable continuous mode when reset to de...

Zequan Wu via All-commits all-commits at lists.llvm.org
Mon Dec 11 07:13:23 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ace26b380f229e4148c12566473eea0a527e40dd
      https://github.com/llvm/llvm-project/commit/ace26b380f229e4148c12566473eea0a527e40dd
  Author: Zequan Wu <zequanwu at google.com>
  Date:   2023-12-11 (Mon, 11 Dec 2023)

  Changed paths:
    M compiler-rt/lib/profile/InstrProfiling.h
    M compiler-rt/lib/profile/InstrProfilingBuffer.c
    M compiler-rt/lib/profile/InstrProfilingFile.c
    A compiler-rt/test/profile/ContinuousSyncMode/reset-default-profile.c

  Log Message:
  -----------
  [Profile] Disable continuous mode when reset to default.profraw due to malformed LLVM_PROFILE_FILE. (#74879)

When LLVM_PROFILE_FILE is set incorrectly (e.g. multiple %c) and it
falls back to use `default.profraw` name, but continuous mode is still
set. This might cause signal bus in the following scenario.

LLVM_PROFILE_FILE is set incorrectly (with "%c%c") for process A and B.
Suppose A starts first and falls back to use `default.profraw` and
mmaped its file content to memory. Later B starts and also falls back to
use `default.profraw`, but it will truncate the file because online
merging is disable when reseting to `default.profraw`. When A tries to
update counter via mmaped memory, signal bus will occur.

This fixes it by disabling continuous mode when reset to
default.profraw.




More information about the All-commits mailing list