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

[Backport 2.28]Crash in test suite x509write config full no seedfile #6246

Conversation

superna9999
Copy link
Contributor

Description

Backport of #6109:
Steps to reproduce:

find . -name seedfile -exec rm {} +
scripts/config.py config full
(cd tests && make test_suite_x509write && ./test_suite_x509write)

Observed behaviour: the first few tests fail, then eventually there's a bus error and a core dump is produced. If we just add the seedfile again (dd if=/dev/urandom of=./tests/seedfile bs=64 count=1) everything passes and there is no crash.

Cause:
When USE_PSA_INIT() failed because lack of seedfile, mbedtls_x509write_csr_free()
crashed when called on an unitialized mbedtls_x509write_csr struct.

This moves mbedtls_x509write_csr_init before calling USE_PSA_INIT(),
which could probably fail, and use the same flow in x509_csr_check()
and x509_csr_check_opaque().

Status

READY

Requires Backporting

NO

Migrations

NO

Additional comments

N/A

…s_x509write_csr_free() will crash if uninitialized

When USE_PSA_INIT() failed because lack of seedfile, mbedtls_x509write_csr_free()
crashed when called on an unitialized mbedtls_x509write_csr struct.

This moves mbedtls_x509write_csr_init before calling USE_PSA_INIT(),
which could probably fail, and uses the same flow in x509_csr_check()
and x509_csr_check_opaque().

Signed-off-by: Neil Armstrong <[email protected]>
@superna9999 superna9999 changed the base branch from development to mbedtls-2.28 August 30, 2022 13:59
Copy link
Contributor

@mpg mpg left a comment

Choose a reason for hiding this comment

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

LGTM

@mpg mpg added single-reviewer This PR qualifies for having only one reviewer approved Design and code approved - may be waiting for CI or backports labels Sep 1, 2022
@mpg mpg merged commit 1b36e1b into Mbed-TLS:mbedtls-2.28 Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports bug single-reviewer This PR qualifies for having only one reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants