Repository navigation
h3: fully fix dirty-list use-after-free (unlink conn on free) (#62) - #63
Merged
Merged
Conversation
http3_connection_free did not remove the connection from the listener's dirty list before efree, so a conn freed while still marked dirty dangled there and the next flush_dirty walked into freed memory. The arm_timer NULL guard (#61) only catches the post-OPENSSL_cleanse manifestation (ngtcp2_conn == NULL); it does not help if the freed slot is reallocated to a live conn first. Add http3_listener_unmark_flush() (singly-linked unlink from dirty_head) and call it in http3_connection_free before teardown. The arm_timer guard stays as defense-in-depth. phpt 25/25; 8x sustained c=64 crash-stress clean (0 errored, no crash).
Contributor
CoverageTotal lines: 80.86% → 80.58% (-0.28 pp)
❌ Regression in touched files (> 1.0 pp drop)
Add |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the
arm_timerNULL-guard from #61 — turns the mitigation into a complete fix.Problem
http3_connection_freedid not unlink the connection from the listener's dirty list (dirty_head/conn->dirty_next/conn->in_dirty) beforeefree. A conn freed while still marked dirty dangles on the list; the nexthttp3_listener_flush_dirtywalks into freed memory. Thearm_timerguard only catches the post-OPENSSL_cleansecase (ngtcp2_conn == NULL) — not a reallocation of the slot to a live conn.Fix
http3_listener_unmark_flush(l, conn)— singly-linked unlink fromdirty_head, clearsin_dirty/dirty_next.http3_connection_freebefore teardown.arm_timerNULL guard kept as defense-in-depth.Verification
tests/phpt/server/h3/).Closes #62