[FPM] Bound cumulative FCGI_PARAMS allocation per request
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 領域
- backend, networking, security
調査の方向性
Start in main/fastcgi.c, especially fcgi_read_request() at lines 1110-1132 and fcgi_get_params()/fcgi_hash_set() at lines 295-350. Reproduce with an isolated TCP FPM listener using the described stream of valid parameters without the terminating empty record. Done means an exceeded cumulative parameter bound terminates the request rather than allowing unbounded allocation during parsing.
索引モデルが issue の本文から書いたものです。
説明
Description
The FastCGI request reader has no cumulative limit for FCGI_PARAMS data.
fcgi_read_request() accepts successive non-empty FCGI_PARAMS records until the terminating empty record (main/fastcgi.c:1110-1132). Each record is bounded by FCGI_MAX_LENGTH, but there is no per-request total byte/record budget. For each parameter, fcgi_get_params() calls fcgi_hash_set(), which stores names and values in additional raw-malloc segments/bucket blocks (main/fastcgi.c:295-350). The accumulated hash is cleaned only when the next request starts, not while the current request is still receiving parameters.
A peer able to connect directly to a TCP FPM listener can send many valid, distinct parameter pairs and keep the request open, growing a worker's memory before the PHP script is dispatched. These allocations are not governed by PHP's memory_limit. The default pool template binds to 127.0.0.1:9000; this report therefore applies only when an untrusted peer can reach the FastCGI listener, not to the default loopback-only deployment behind a properly configured web server.
Validation
Reproduced against a locally built FPM from php-src commit 63b0af4a5c400d93510dca7aa998769609fdc26c. With the pool's memory_limit set to 1M, I sent a BEGIN_REQUEST followed by 100,000 distinct, valid name/value pairs in 31 FCGI_PARAMS records (1,800,000 parameter bytes), and withheld the terminating empty FCGI_PARAMS record. The worker remained in request parsing and its RSS grew from about 6,412 KiB to 9,844 KiB. Current master 68292bc476c709ff7ac0632d963af0e379dc4a53 has byte-identical main/fastcgi.c (blob a393283fcb0b8a156796fc7c21f07d2052737f91).
Expected behavior
Enforce a cumulative per-request bound for FastCGI environment parameters (total bytes and/or count) and terminate the request when exceeded. A per-record maximum alone does not bound total allocation.
Reproduction outline
Against an isolated FPM instance with a TCP listener, send a FastCGI BEGIN_REQUEST, then a stream of FCGI_PARAMS records containing valid unique name/value pairs without sending the terminating empty FCGI_PARAMS record. Observe worker RSS while the request remains in parsing.
Related issue
#16042 reports an FPM behavior when environment parameters are split across FastCGI records. This report concerns the separate lack of a cumulative allocation bound for complete, valid parameters.
- 主要言語
- C
- スター
- 40.7k
- フォーク
- 8.3k
- 平均マージ
- 2日 20時間
- マージ済み PR(30日)
- 147
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
php/php-src のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
sapi/fpm/tests/tester.inc can send SIGUSR2 to pid 0, killing run-tests.php対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンBug Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
zend_set_local_var() overwrites existing compiled variable (CV) zval without calling zval_ptr_dtor()対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンBug Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Case-insensitive substr_compare, ksort, krsort are still locale-dependent対応中かも @lazerg が 4 日前に担当しました。 オープンBug Extension: standard Status: Verified
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
php/php-src#24552 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
yunusemreyl/omen-space#337 ·
メンテナーはふだん 1 日以内に返信
-
dependency component: oneMKL module: dpclang
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
intel/torch-xpu-ops#5880 ·
メンテナーはふだん 2 日以内に返信
-
area/ci-build bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
DarkFlippers/qUnleashed#423 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
CVE-2026-111497オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
fink/fink-distributions#1322 ·