heap uaf in _lsprof via enable()
オープン
まだ誰も着手していません。
extension-modules
topic-profiling
type-bug
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
import _lsprof
prof = _lsprof.Profiler()
def _timer():
try:
prof.enable()
except Exception:
pass
return 0
prof.__init__(timer=_timer)
prof.enable()
def foo():
return 1
foo()
prof.disable()
ASAN output (truncated:
==ERROR: AddressSanitizer: heap-use-after-free ... READ of size 8
#0 ptrace_enter_call Modules/_lsprof.c:383
#1 _lsprof_Profiler__ccall_callback_impl Modules/_lsprof.c:733
freed by thread T0 here:
#1 flush_unmatched Modules/_lsprof.c:873
#2 _lsprof_Profiler_disable_impl Modules/_lsprof.c:930
previously allocated by thread T0 here:
#1 ptrace_enter_call Modules/_lsprof.c:388
SUMMARY: AddressSanitizer: heap-use-after-free Modules/_lsprof.c:383 in ptrace_enter_call
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-157648
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ASAN 下で Python スニペットを使って報告を再現し、ptrace_enter_call と _lsprof_Profiler__ccall_callback_impl パスから始めて Modules/_lsprof.c を調査します。flush_unmatched と _lsprof_Profiler_disable_impl を読み、確保と解放のシーケンスを追跡します。プロファイラーの有効化/無効化中に、再現プログラムが heap-use-after-free を報告しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, python
- 領域
- performance, tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100