THREAD_ALLOC dereferences a null thread while THREAD_FREE falls back to the global allocator
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
include/iocore/eventsystem/ProxyAllocator.h(87~110行目)のTHREAD_ALLOC、SAFE_THREAD_ALLOC、THREAD_FREEマクロから始めます。null threadの場合の動作を比較し、IOBuffer.cc、InkAPI.cc、cripts/unit_tests/main.ccにある呼び出し元を確認します。未登録threadからの割り当てでnullポインターをデリファレンスしなくなり、適切なテストで意図されたfallbackまたは診断がカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
THREAD_ALLOC and THREAD_ALLOC_INIT expand to thread_alloc(::_a, _t->_a, ...) and dereference the thread pointer unconditionally (ProxyAllocator.h#L87-L88). The matching THREAD_FREE checks for a null thread and frees to the global allocator instead (ProxyAllocator.h#L109-L110), and SAFE_THREAD_ALLOC does the same for allocation (ProxyAllocator.h#L89).
Most callers pass this_thread() or this_ethread(), which is null on any OS thread not registered with the event system. Examples include new_MIOBuffer / new_IOBufferBlock (IOBuffer.cc#L171, IOBuffer.cc#L723), TSContCreate() (InkAPI.cc#L3844) and TSVConnCreate() (InkAPI.cc#L6426). Allocating from an unregistered thread crashes, but freeing the same object there works. Setting cmd_disable_pfreelist doesn't help either, because the macro still evaluates _t->_a. The cripts unit test has to register a fake EThread on main for this reason (cripts/unit_tests/main.cc#L41-L45).
Suggested fix: give THREAD_ALLOC the same null fallback as THREAD_FREE (i.e. make it SAFE_THREAD_ALLOC), or turn the null case into an ink_release_assert with a message, so a plugin calling these APIs from its own thread gets a diagnosable error rather than a segfault.
generated with Claude Opus 5.5 by Josiah VanderZee
- 主要言語
- C++
- スター
- 2k
- フォーク
- 903
- 平均マージ
- 4日 4時間
- マージ済み PR(30日)
- 135
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/trafficserver のほかの issue
-
UnixNetVConnection::do_io_write with a null reader leaves the previous reader in the write VIO対応中かも @NginxL が今日担当しました。 オープンBug Good First Issue IOBuffer Network
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/trafficserver#14220 ·
メンテナーはふだん 2 日以内に返信
-
MallocAllocator does not check for allocation failure対応中かも @umrndem が今日担当しました。 オープンBug Core Good First Issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/trafficserver#14218 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
TSContScheduleEveryOnPool and TSContScheduleEveryOnThread accept a zero or negative period対応中かも @rajeetvk が 1 日前に担当しました。 オープンBug Event System Good First Issue TS API
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/trafficserver#14214 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
HostDBContinuation::init memsets a polymorphic Action対応中かも @ANMOLSCRIPT が今日担当しました。 オープンBug Good First Issue HostDB
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/trafficserver#14204 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Bug Core Event System Logging Startup
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/trafficserver#14201 ·
メンテナーはふだん 2 日以内に返信
apache/trafficserver の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 2 日以内に返信
-
bug data-types
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ClickHouse/clickhouse-cpp#645 ·
メンテナーはふだん 1 日以内に返信
-
bug compatibility difficulty:easy prio:normal
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
NatronGitHub/openfx-misc#524 ·
メンテナーはふだん 1 日以内に返信
-
documentation enhancement help wanted P0
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
メンテナーはふだん 1 日以内に返信
-
Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openscad/openscad#7360 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信