Add a way to reserve shmop memory ids and prevent shmop_open (e.g. opcache's region)
Open
Nobody has claimed this yet.
Extension: opcache
Extension: shmop
Extension: sysvshm
Feature
Status: Needs Triage
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
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:
- Add a helper method in
Zend/directory to track ids used during module initialization - 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
- Add an ini setting to disable this protection, in case userland debuggers/visualizers have valid use cases for this
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading ext/opcache/shared_alloc_shm.c at the linked location, then inspect the ext/shmop implementation and the Zend/ directory. Determine how module initialization could track reserved IDs and how shmop_open reports native errors. Done means opcache and other extension regions cannot be accessed accidentally, with the proposed opt-out ini setting considered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- operating-systems, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100