[all-commits] [llvm/llvm-project] 514503: [BOLT][AArch64][Android] Only the dumping thread c...

YongKang Zhu via All-commits all-commits at lists.llvm.org
Fri Sep 11 13:43:25 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 51450333e1fd156fcdb20b61d7c70ed96461812b
      https://github.com/llvm/llvm-project/commit/51450333e1fd156fcdb20b61d7c70ed96461812b
  Author: YongKang Zhu <yongzhu at fb.com>
  Date:   2026-09-11 (Fri, 11 Sep 2026)

  Changed paths:
    M bolt/runtime/common.h
    M bolt/runtime/instr.cpp
    M bolt/runtime/sys_aarch64.h

  Log Message:
  -----------
  [BOLT][AArch64][Android] Only the dumping thread can longjmp (#222719)

`__bolt_instr_recovery_active` is a process global flag and the reader
in `boltHandleFatalAndRecover()` runs on any thread. When a dump is in
flight, another thread that fails `assert()` or exhausts `GlobalAlloc`
in `instrumentIndirectCall()` could see the flag set, longjmp with the
dumping thread's buffer and restore the dump thread's sp/fp/lr. This
is wrong since the thread would then run on the dumping thread's stack
and later release a mutex that it does not own or hold.

`GlobalWriteProfileMutex` already serializes the writers, so one buffer
would be sufficient; only the reader side needs to know who owns the
buffer. Replace the flag with `__bolt_instr_recovery_tid` holding the
owner's thread ID, and longjmp only when it matches `__gettid()`. Other
threads will fall through to just record the failure and return.

Added a `__gettid()` syscall wrapper, for aarch64 only.

Assited-by: opus



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list