Skip to content

Fix process creations serializing on the configuration lock - #5728

Open
Anankke wants to merge 1 commit into
sandboxie-plus:masterfrom
Anankke:fix/force-data-skip-template-sections
Open

Anankke wants to merge 1 commit into
sandboxie-plus:masterfrom
Anankke:fix/force-data-skip-template-sections

Conversation

@Anankke

@Anankke Anankke commented Nov 18, 2026

Copy link
Copy Markdown

Process_CreateForceData runs for every process started on the host and walks every config section, Templates.ini included. Conf_IsBoxEnabled pins the config for each one and Conf_AdjustUseCount takes Conf_Lock exclusively, so with 448 sections that is about 900 exclusive acquires per process. Threads creating processes at the same time queue on it.

On a machine starting about 80 processes per second a small native exe took 213 ms to start, 9 ms with Templates.ini cut down to 30 sections. In a wait trace 27956 of 27976 ERESOURCE waits were under PspCallProcessNotifyRoutines in SbieDrv.

Template sections are last in the list and have no Enabled setting, so skipping them drops nothing from the force list. Conf_Read still reads the use count under the exclusive lock before it swaps the config, so a shared acquire is enough in Conf_AdjustUseCount.

Process_CreateForceData runs for every process created on the host and enumerated every configuration section, including all Templates.ini sections. Each one pinned the configuration through Conf_IsBoxEnabled, and Conf_AdjustUseCount took Conf_Lock exclusively, so concurrent process creations queued on the lock.

Template sections are skipped in the scan: they sit at the end of the section list and carry no Enabled setting, so they never became force boxes.

Conf_AdjustUseCount takes the lock shared. The count is changed with interlocked operations and Conf_Read still reads it under the exclusive lock before swapping the configuration.
@offhub offhub added SbieDrv Collection of SbieDrv.sys issues Type: Performance Performance issues labels Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

SbieDrv Collection of SbieDrv.sys issues Type: Performance Performance issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants