mbedtls icon indicating copy to clipboard operation
mbedtls copied to clipboard

Crash in test suite x509write config full no seedfile

Open superna9999 opened this issue 3 years ago • 4 comments

Description

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().

Resolves #6100

Gatekeeping note: I (mpg) think this should be backported to 2.28, but does not deserve a ChangeLog entry, as the bug is only in test code.

Status

READY

Requires Backporting

NO

Migrations

NO

Additional comments

N/A

Todos

  • [ ] Tests

Steps to test or reproduce

test_suite_x509write must not crash without a seedfile

superna9999 avatar Jul 20 '22 13:07 superna9999

Aw, this now has a conflict and will need to be rebased when you come back.

mpg avatar Jul 28 '22 09:07 mpg

Note: I think this should be backported to 2.28, but does not deserve a ChangeLog entry, as the bug is only in test code.

mpg avatar Jul 28 '22 10:07 mpg

This one needs to be rebased.

mprse avatar Aug 01 '22 14:08 mprse

Rebased on development to fix merge conflict

superna9999 avatar Aug 08 '22 11:08 superna9999

@superna9999 Please create a backport to 2.28 so that we can merge this.

mpg avatar Aug 30 '22 10:08 mpg