php / php/php-src

Add a way to reserve shmop memory ids and prevent shmop_open (e.g. opcache's region)

オープン
#9,951 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Extension: opcache Extension: shmop Extension: sysvshm Feature Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

https://github.com/php/php-src/blob/5a5037f223c887d09e3131b2124cd7ff5a50cca9/ext/opcache/shared_alloc_shm.c#L112

Related to https://github.com/php/php-src/issues/9944

Prevent accidentally or intentionally reading or writing to shared memory regions which would be used by opcache, or other extensions such as APCu

A possible approach:

  1. Add a helper method in Zend/ directory to track ids used during module initialization
  2. Make the ext/shmop extension check if those ids were already used and treat it like a native error code for https://php.net/shmop_open
  3. Add an ini setting to disable this protection, in case userland debuggers/visualizers have valid use cases for this

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まずリンク先の ext/opcache/shared_alloc_shm.c を読み、次に ext/shmop の実装と Zend/ ディレクトリを調べます。モジュールの初期化で予約済みの ID を追跡する方法と、shmop_open がネイティブエラーを報告する方法を確認します。opcache および他の拡張機能の領域に誤ってアクセスできないこと、そして提案されている opt-out の ini 設定が考慮されていることが完了条件です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, php
領域
operating-systems, security
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。