Skip to content

bugfix: Shared-dictionary list methods read nodes after releasing the mutex - #2556

Merged
zhuizhuhaomeng merged 1 commit into
masterfrom
codex-security/arp_71b31f5dd93b5438e6a5b4e3cbf1cc2c
Nov 28, 2026
Merged

zhuizhuhaomeng merged 1 commit into
masterfrom
codex-security/arp_71b31f5dd93b5438e6a5b4e3cbf1cc2c

Conversation

@zhuizhuhaomeng

Copy link
Copy Markdown
Contributor

The patch snapshots each shared-list length while the slab mutex still protects its node.

  • Push operations now return the length copied immediately after the protected increment.
  • llen copies the current length before unlocking, so concurrent deletion or slab reuse cannot alter its result.
  • The related pop error path no longer reads shared metadata after releasing the same mutex.
  • Existing return values, errors, LRU updates, and left/right ordering remain unchanged.

Static Verification Checks

  • Push snapshot precedes unlock (Passed) — ngx_http_lua_shdict_push_helper copies the incremented length before unlocking and returns the local snapshot, closing the node-reuse attack path.

  • Llen snapshot precedes unlock (Passed) — ngx_http_lua_shdict_llen snapshots sd->value_len under the mutex and returns the local value, closing the concurrent reuse attack path.

  • Defensive error avoids reuse (Passed) — ngx_http_lua_shdict_pop_helper snapshots invalid length metadata before unlocking, closing the sibling post-unlock dereference path.

  • List behavior remains intact (Passed) — t/145-shdict-list.t asserts sequential push lengths, list queries, and left/right ordering, protecting legitimate list behavior.

  • Finding: acf_eab641d0bb1de3cd732728bac6fa0a70

  • Patch: arp_71b31f5dd93b5438e6a5b4e3cbf1cc2c

  • Base commit: a7733460bc1052e7eedb5240dfbc1cdb98527950

  • Patch SHA-256: 0255b40a73a44aabca9903cc86a7b873a85a7e00218cff493ca3d2b7524d36e3

@zhuizhuhaomeng
zhuizhuhaomeng marked this pull request as ready for review November 28, 2026 06:39
@zhuizhuhaomeng zhuizhuhaomeng changed the title [Codex Security] Shared-dictionary list methods read nodes after releasing the mutex bugfix: Shared-dictionary list methods read nodes after releasing the mutex Nov 28, 2026
@zhuizhuhaomeng
zhuizhuhaomeng merged commit 5079ce7 into master Nov 28, 2026
7 checks passed
@zhuizhuhaomeng
zhuizhuhaomeng deleted the codex-security/arp_71b31f5dd93b5438e6a5b4e3cbf1cc2c branch November 28, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant