test_suite_memory_buffer_alloc says "FATAL: verification of first header failed" but passes #309

Closed
opened 2019-10-31 08:06:37 -05:00 by gilles-peskine-arm · 2 comments
gilles-peskine-arm commented 2019-10-31 08:06:37 -05:00 (Migrated from github.com)

Description

Steps to reproduce:

scripts/config.pl set MBEDTLS_MEMORY_BUFFER_ALLOC_C
scripts/config.pl set MBEDTLS_MEMORY_DEBUG
scripts/config.pl set MBEDTLS_PLATFORM_MEMORY
make lib tests
tests/test_suite_memory_buffer_alloc

Output (at least on Ubuntu 16.04 x86_64):

Memory buffer alloc self test ..................................... PASS
Memory buffer alloc - free in middle, alloc at end ................ PASS
Memory buffer alloc - free in middle, realloc ..................... PASS
Memory buffer alloc - free in middle, merge, realloc .............. PASS
Memory buffer alloc - free at end, merge, realloc ................. PASS
Memory buffer alloc - Out of Memory test .......................... PASS
Memory buffer small buffer ........................................ FATAL: verification of first header failed
PASS
Memory buffer underalloc .......................................... PASS

----------------------------------------------------------------------------

PASSED (8 / 8 tests (0 skipped))

There are two bugs here:

  1. FATAL: verification of first header failed indicates memory corruption (unless the bug is in the test code).
  2. If a tests reveals a FATAL error, the test must not come up as PASSED.

I'm filing these bugs together because they may have the same root cause. If you fix one without fixing the other, please file an issue for the remaining bug.

Issue request type

[ ] Question
[ ] Enhancement
[x] Bug
### Description Steps to reproduce: ``` scripts/config.pl set MBEDTLS_MEMORY_BUFFER_ALLOC_C scripts/config.pl set MBEDTLS_MEMORY_DEBUG scripts/config.pl set MBEDTLS_PLATFORM_MEMORY make lib tests tests/test_suite_memory_buffer_alloc ``` Output (at least on Ubuntu 16.04 x86_64): ``` Memory buffer alloc self test ..................................... PASS Memory buffer alloc - free in middle, alloc at end ................ PASS Memory buffer alloc - free in middle, realloc ..................... PASS Memory buffer alloc - free in middle, merge, realloc .............. PASS Memory buffer alloc - free at end, merge, realloc ................. PASS Memory buffer alloc - Out of Memory test .......................... PASS Memory buffer small buffer ........................................ FATAL: verification of first header failed PASS Memory buffer underalloc .......................................... PASS ---------------------------------------------------------------------------- PASSED (8 / 8 tests (0 skipped)) ``` There are two bugs here: 1. `FATAL: verification of first header failed` indicates memory corruption (unless the bug is in the test code). 2. If a tests reveals a FATAL error, the test must not come up as PASSED. I'm filing these bugs together because they may have the same root cause. If you fix one without fixing the other, please file an issue for the remaining bug. ### Issue request type [ ] Question [ ] Enhancement [x] Bug
ciarmcom commented 2019-10-31 08:17:45 -05:00 (Migrated from github.com)

Internal Jira reference: https://jira.arm.com/browse/IOTCRYPT-966

*Internal Jira reference: https://jira.arm.com/browse/IOTCRYPT-966*
gilles-peskine-arm commented 2019-10-31 09:13:14 -05:00 (Migrated from github.com)

This turned out to be a false positive: the "FATAL …" message is expected and the reason that triggers it is what makes the test pass. See https://github.com/ARMmbed/mbed-crypto/pull/310

This turned out to be a false positive: the "FATAL …" message is expected and the reason that triggers it is what makes the test pass. See https://github.com/ARMmbed/mbed-crypto/pull/310
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-ARMmbed/mbed-crypto#309
No description provided.