Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add QUIC stateless reset test #23384

Closed
wants to merge 9 commits into from

Conversation

nhorman
Copy link
Contributor

@nhorman nhorman commented Jan 24, 2024

QUIC supports the concept of stateless reset, in which a specially
crafted frame is sent to a client informing it that the QUIC state
information is no longer available, and the connection should be closed
immediately. Test for proper client support here

Checklist
  • tests are added or updated

@nhorman nhorman self-assigned this Jan 24, 2024
QUIC supports the concept of stateless reset, in which a specially
crafted frame is sent to a client informing it that the QUIC state
information is no longer available, and the connection should be closed
immediately.  Test for proper client support here
In writing the quic stateless reset test we found that the quic rx code
wasn't checking for stateless reest conditions, as the SRT frames were
getting discarded due to failed lcdim lookups.  Move the SRT check above
the lcdim lookup in the rx path to ensure we handle SRT properly in the
client.
Copy link
Member

@hlandau hlandau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Just minor nits and one substantive comment and I'll approve.

You'll want to take a look at backporting this test to 3.2 IMO.

test/quic_multistream_test.c Outdated Show resolved Hide resolved
test/quic_multistream_test.c Show resolved Hide resolved
test/quic_multistream_test.c Outdated Show resolved Hide resolved
test/quic_multistream_test.c Outdated Show resolved Hide resolved
test/quic_multistream_test.c Outdated Show resolved Hide resolved
@nhorman nhorman added branch: master Merge to master branch approval: otc review pending This pull request needs review by an OTC member branch: 3.2 Merge to openssl-3.2 labels Jan 24, 2024
test/quic_multistream_test.c Outdated Show resolved Hide resolved
@nhorman
Copy link
Contributor Author

nhorman commented Jan 24, 2024

hmm, it would seem the macos tests are timing out waiting for the connection close condition to be detected. Unfortunately I cant OP_[S|C]WRITE anything to force a socket read, as that fails prior to the expecation of the close detection. OP{C|S]_READ_FAIL looks like it might be promising, but those also timeout detecting a close condition. Thoughts?

@t8m t8m added triaged: bug The issue/pr is/fixes a bug tests: present The PR has suitable tests present labels Jan 25, 2024
@nhorman
Copy link
Contributor Author

nhorman commented Jan 26, 2024

@hlandau, scratch that, found a way around it. The close condition on the client is consistent and suffices to confirm.thw reset.

Side note: there is a thread race that occurs when the inject function is changed during a test, but I chose to avoid it by setting the function at the start of the script, rather than introduce a bunch of new locking

Copy link
Member

@hlandau hlandau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last thing

test/quic_multistream_test.c Outdated Show resolved Hide resolved
@nhorman
Copy link
Contributor Author

nhorman commented Jan 29, 2024

ACQUIRE_S() doesn't work in injector functions as helper_local isn't passed. Will need to find a way around that

@nhorman nhorman requested a review from hlandau January 29, 2024 13:38
@hlandau hlandau added approval: review pending This pull request needs review by a committer and removed approval: otc review pending This pull request needs review by an OTC member labels Jan 29, 2024
@t8m t8m added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels Jan 29, 2024
@nhorman
Copy link
Contributor Author

nhorman commented Jan 29, 2024

Note: tested locally against 3.2 here and the test fails. It appears to be occuring because, during stateless reset injection on 3.2 demux_process_pending_urxe issues a callback to reset_token_cb to determine if the frame is an SR, and, if so, returns -1, whcih goes back up the call stack, causing an error in SSL_inject_net_dgram, resulting in a failed test. The master branch silently discards SR frames in port_default_packet_handler after closing the connection as a side effect. Point being, backporting to 3.2 will take some additional work in the quic code to operate properly

@openssl-machine
Copy link
Collaborator

24 hours has passed since 'approval: done' was set, but as this PR has been updated in that time the label 'approval: ready to merge' is not being automatically set. Please review the updates and set the label manually.

@nhorman nhorman added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels Jan 30, 2024
@nhorman
Copy link
Contributor Author

nhorman commented Jan 30, 2024

setting ready to merge as my last comment blocked openssl-machine from automating it

@mattcaswell
Copy link
Member

Although this is "ready-to-merge" - it seems its not really. At least not to 3.2 since tests would fail if it is merged there. I guess we're blocked on having fixes for the 3.2 issues.

@hlandau
Copy link
Member

hlandau commented Jan 31, 2024

You can merge it to master. 3.2 is a separate issue and PR.

@mattcaswell mattcaswell removed the branch: 3.2 Merge to openssl-3.2 label Jan 31, 2024
@mattcaswell
Copy link
Member

I've removed the 3.2 label for now to prevent an accidental merge there (although I believe the approvals above indicate it can be merged there once 3.2 is fixed)

@nhorman
Copy link
Contributor Author

nhorman commented Jan 31, 2024

merged

openssl-machine pushed a commit that referenced this pull request Jan 31, 2024
QUIC supports the concept of stateless reset, in which a specially
crafted frame is sent to a client informing it that the QUIC state
information is no longer available, and the connection should be closed
immediately.  Test for proper client support here

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #23384)
openssl-machine pushed a commit that referenced this pull request Jan 31, 2024
In writing the quic stateless reset test we found that the quic rx code
wasn't checking for stateless reest conditions, as the SRT frames were
getting discarded due to failed lcdim lookups.  Move the SRT check above
the lcdim lookup in the rx path to ensure we handle SRT properly in the
client.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #23384)
@hlandau
Copy link
Member

hlandau commented Jan 31, 2024

@nhorman IMO create a separate issue for the 3.2 investigation and close this.

@nhorman
Copy link
Contributor Author

nhorman commented Jan 31, 2024

Ack will do

@nhorman nhorman closed this Jan 31, 2024
Sashan pushed a commit to Sashan/openssl that referenced this pull request Feb 12, 2024
QUIC supports the concept of stateless reset, in which a specially
crafted frame is sent to a client informing it that the QUIC state
information is no longer available, and the connection should be closed
immediately.  Test for proper client support here

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#23384)
Sashan pushed a commit to Sashan/openssl that referenced this pull request Feb 12, 2024
In writing the quic stateless reset test we found that the quic rx code
wasn't checking for stateless reest conditions, as the SRT frames were
getting discarded due to failed lcdim lookups.  Move the SRT check above
the lcdim lookup in the rx path to ensure we handle SRT properly in the
client.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#23384)
nhorman added a commit to nhorman/openssl that referenced this pull request Feb 12, 2024
QUIC supports the concept of stateless reset, in which a specially
crafted frame is sent to a client informing it that the QUIC state
information is no longer available, and the connection should be closed
immediately.  Test for proper client support here

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#23384)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: ready to merge The 24 hour grace period has passed, ready to merge branch: master Merge to master branch tests: present The PR has suitable tests present triaged: bug The issue/pr is/fixes a bug
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

QUIC: tests for stateless reset handling on receiving side
5 participants