[openssl/openssl] 5343d5: SSL_poll: fix abort_blocking mishandling in poll_t...

"'Matt Caswell' via openssl-commits" <[email protected]> Wed, 29 Jul 2026 00:35:38 -0700
Newsgroups gmane.comp.encryption.openssl.cvs
Message-ID <openssl/openssl/push/refs/heads/openssl-3.6/[email protected]>
  Branch: refs/heads/openssl-3.6
  Home:   https://github.com/openssl/openssl
  Commit: 5343d5167b2d83773145f5378d722ccf3c7bde8b
      https://github.com/openssl/openssl/commit/5343d5167b2d83773145f5378d7=
22ccf3c7bde8b
  Author: Matt Caswell <[email protected]>
  Date:   2026-07-29 (Wed, 29 Jul 2026)

  Changed paths:
    M ssl/rio/poll_immediate.c

  Log Message:
  -----------
  SSL_poll: fix abort_blocking mishandling in poll_translate()/poll_block()

When SSL_poll() has to block, poll_translate() registers each item's QUIC
connection for cross-thread notification one item at a time. If an item
turns out to already be ready right as it is being registered, translation
sets abort_blocking and is meant to bail out so the caller retries the
readout instead of actually blocking.

Two bugs in that abort path:

- poll_translate() returned immediately on abort_blocking without calling
  postpoll_translation_cleanup() for any earlier items that had already
  had their blocking section entered. Those items' enter/leave calls were
  left unbalanced, leaking into the QUIC reactor's blocking-waiter count.
  Fixed by routing through the existing "out" cleanup label, mirroring
  what the FAIL_ITEM()/error path already does for items 0..i-1.

- poll_block() initializes ok =3D 0 and only ever sets it on the actual
  poll() success path. The abort_blocking branch jumped straight to "out"
  without setting ok, so SSL_poll() reported failure even though nothing
  actually went wrong; the caller's retry loop never got a chance to pick
  up the now-ready item.

Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Sa=C5=A1a Nedv=C4=9Bdick=C3=BD <[email protected]>
Reviewed-by: Paul Yang <[email protected]>
MergeDate: Wed Jul 29 07:20:31 2026
(Merged from https://github.com/openssl/openssl/pull/31743)

(cherry picked from commit d6ca7796bf66f65d0c69cb0c0806ed38ce3f3105)


  Commit: dc425a0ac108029cfaf3f65e6ac1ee8937ff33f8
      https://github.com/openssl/openssl/commit/dc425a0ac108029cfaf3f65e6ac=
1ee8937ff33f8
  Author: Matt Caswell <[email protected]>
  Date:   2026-07-29 (Wed, 29 Jul 2026)

  Changed paths:
    M ssl/rio/poll_builder.h
    M ssl/rio/poll_immediate.c
    M test/radix/quic_tests.c

  Log Message:
  -----------
  test: add regression test for SSL_poll() abort_blocking handling

The race fixed by the previous commit (an item becoming ready in the
window between poll_translate() registering it for cross-thread
notification and the OS-level poll) is normally vanishingly narrow and
not practical to hit by timing alone in a test.

Add ossl_quic_poll_translate_test_step_cb, a test-only instrumentation
hook (always NULL in production use) that poll_translate() calls between
translating consecutive items. This lets a test deterministically make
one item ready while an earlier item's blocking section is still
entered, exercising the abort_blocking path on demand.

Add the poll_abort_blocking RADIX script/test, which uses the hook to
trigger this on two independent QUIC connections (so the second item's
reactor is provably distinct from the first's) and checks that
SSL_poll() reports success and that the first item's blocking-section
entry is correctly balanced afterwards.

Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Sa=C5=A1a Nedv=C4=9Bdick=C3=BD <[email protected]>
Reviewed-by: Paul Yang <[email protected]>
MergeDate: Wed Jul 29 07:20:33 2026
(Merged from https://github.com/openssl/openssl/pull/31743)

(cherry picked from commit 524dd6c010a6c92b532d7febe903c4f8634f22f1)


Compare: https://github.com/openssl/openssl/compare/091c07c30f08...dc425a0a=
c108

To unsubscribe from these emails, change your notification settings at http=
s://github.com/openssl/openssl/settings/notifications

--=20
You received this message because you are subscribed to the Google Groups "=
openssl-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].
To view this discussion visit https://groups.google.com/a/openssl.org/d/msg=
id/openssl-commits/openssl/openssl/push/refs/heads/openssl-3.6/091c07-dc425=
a%40github.com.