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

refactor: enforce stuffer return check #4399

Merged
merged 9 commits into from
Mar 1, 2024
Merged

Conversation

jmayclin
Copy link
Contributor

@jmayclin jmayclin commented Feb 1, 2024

Resolved issues:

Resolves #4391

Description of changes:

s2n-tls has strict standard for checking the results of functions, but we rely on contributors remembering to check all of these values. This PR adds "must use" attributes to emit warnings when these conventions are not followed, and also fixes all of those warning that currently exist in our codebase.

Call-outs:

Ideally we'd switch to S2N_RESULT, but that is a much larger effort. This PR instead aims for incremental progress.

We can't force MUST_USE attributed on methods that are used for DEFER_CLEANUP.

Testing:

I added -Werror flags and then fixed thing until it compiled. This will be validated by the validator and asan builds that run with stricted checks.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the s2n-core team label Feb 1, 2024
- add no-unused-result to fuzz makefile

There are many cases in our s2n-fuzz tests where we deliberately do not
assert on the success of certain operations because it is expect in
happy path fuzzing that they will fail. Rather than manully casting
everything to avoid these warnings, we disable this error for fuzz
tests.
@jmayclin jmayclin marked this pull request as ready for review February 5, 2024 20:25
@jmayclin jmayclin changed the title enforce stuffer return check refactor: enforce stuffer return check Feb 6, 2024
@jmayclin jmayclin requested review from goatgoose and lrstewart March 1, 2024 18:29
stuffer/s2n_stuffer_pem.c Outdated Show resolved Hide resolved
tests/testlib/s2n_connection_test_utils.c Show resolved Hide resolved
- manually add stuffer wipe assertion
@jmayclin jmayclin requested a review from lrstewart March 1, 2024 19:17
jmayclin added 2 commits March 1, 2024 20:13
- return EIO in case of error
We set s2n_errno, no the actual system errno. And when we're mocking out
the system functionality we have to deal with both.
jmayclin and others added 2 commits March 1, 2024 14:26
@jmayclin jmayclin enabled auto-merge (squash) March 1, 2024 23:31
@jmayclin jmayclin merged commit 025f3b2 into aws:main Mar 1, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enforce result checking for s2n_stuffer methods
3 participants