Commit Graph

62 Commits

Author SHA1 Message Date
David Horstmann
f6f3bcae43 Update file paths for moved files
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-31 15:49:02 +01:00
David Horstmann
3147034457 Mention MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS
Explain this option and the way it relates to the copying macros.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-18 15:59:03 +00:00
David Horstmann
0ea8071bda Remove 'Question' line around testing
This question has been resolved, as we know that we can test
transparently.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-18 15:51:03 +00:00
David Horstmann
4d01066311 Mention metatest.c
Add a note that validation of validation was implemented in metatest.c
and explain briefly what that program is for.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-18 15:02:08 +00:00
David Horstmann
872ee6ece0 Mention MBEDTLS_TEST_MEMORY_CAN_POISON
The configuration of memory poisoning is now performed via
compile-time detection setting MBEDTLS_MEMORY_CAN_POISON. Update
the design to take account of this.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-18 15:00:08 +00:00
David Horstmann
12b35bf3c2 Discuss test wrappers and updating them
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-18 14:48:52 +00:00
David Horstmann
5ea99af0f2 Add discussion of copying conveience macros
Namely LOCAL_INPUT_DECLARE() and friends

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-18 14:12:12 +00:00
David Horstmann
1c3b227065 Abstractify example in design exploration
Since this is just an example, remove specific-sounding references to
mbedtls_psa_core_poison_memory() and replace with more abstract and
generic-sounding memory_poison_hook() and memory_unpoison_hook().

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-18 13:37:59 +00:00
David Horstmann
3f2dcdd142 Rename mbedtls_psa_core_poison_memory()
The actual functions were called mbedtls_test_memory_poison()
and mbedtls_test_memory_unpoison(). Update the design section to
reflect this.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-18 13:32:57 +00:00
David Horstmann
331b2cfb31 Clarify design decision in light of actions
We were successful in adding transparent memory-poisoning testing, so
simplify to the real design decision we made.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-18 13:17:25 +00:00
David Horstmann
24c269fd4a Rewrite section on PSA copy functions
The finally implemented functions were significantly different from the
initial design idea, so update the document accordingly.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-14 18:03:35 +00:00
David Horstmann
f63a52ed63 Remove auto-generation of test wrappers
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-31 14:26:00 +00:00
David Horstmann
413dd07a49 Downgrade auto testing testing to a nice-to-have
Automatic testing of our testing is not essential, as our testing
framework may be manually tested. Having automated tests to test our
tests may be left to future work.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-31 12:20:19 +00:00
David Horstmann
2531dab296 Add auto-generation of test wrappers to design
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-30 18:27:10 +00:00
David Horstmann
15b5beea0c Add note on platform-specific barriers
Describe the approach of platform-specific code and draw a comparison
with the constant-time module.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-30 17:13:54 +00:00
David Horstmann
e045b55c65 Add sections on validation of validation
These cover the fact that we need to test our test framework to make
sure it really detects incorrect accesses.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-30 17:00:16 +00:00
David Horstmann
e88a6f8368 Add portability consideration to careful-access
It's important that we be able to test for target-specific bugs.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-30 15:26:21 +00:00
David Horstmann
d081e52685 Discuss plain-overwriting memory poisoning
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-30 15:22:07 +00:00
David Horstmann
599b087990 Rename and specify config options
* Rename config options to have MBEDTLS_TEST_ prefix
* Clarify that these config options should not exist in mbedtls_config.h

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-25 18:09:17 +01:00
David Horstmann
78bd77f574 Careful-access prototyping to design exploration
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-25 18:04:39 +01:00
David Horstmann
c59913822e Remove references to new-test approach in design
This is already covered in the design exploration and since the other
approach was chose, we do not need to discuss it in the detailed design
section.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-25 15:33:50 +01:00
David Horstmann
2b86df87da De-duplicate section titles
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-25 15:26:27 +01:00
David Horstmann
8e58ccb4f6 Add blank lines before lists
This widens compatibility with different dialects of Markdown.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-25 15:13:29 +01:00
David Horstmann
2711d23976 Fix broken links
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-25 15:07:58 +01:00
David Horstmann
f95767ad56 Clarify use of new tests for careful-access
New tests are needed (rather than existing ones) because the complexity
of setting up careful-access tests would make it difficult to build atop
existing tests.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-24 16:16:36 +01:00
David Horstmann
c7ccbf5157 Add detailed design section for careful access
This consists in outlining the prototyping and evaluation of different
possible testing approaches.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-24 15:43:12 +01:00
David Horstmann
56aa1b3fbb Add exploration section on FVP testing
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-23 21:20:01 +01:00
David Horstmann
09c84ef0cd Add lengths to convenience interface sketch
Add lengths to structs in the convenience functions to allocate and copy
input and output buffers. It seems better to ensure we always store a
buffer with its length.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-23 20:43:03 +01:00
David Horstmann
730dea31cb Rewrite incorrect description of psa_exercise_key
And clarify our potential use of it as a starting point for writing
memory poisoning tests from scratch.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-23 20:35:35 +01:00
David Horstmann
6c51207602 Add notes about configuration of poisoning tests
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-23 20:25:14 +01:00
David Horstmann
8f905c289d Add reference to test hooks in detailed design
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-23 20:08:38 +01:00
David Horstmann
806055edbf Refactor note on preferred poison-test approach
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-23 19:53:30 +01:00
David Horstmann
52df620736 Use ASan for memory poisoning as well as Valgrind
Also add information about ASan from Microsoft docs.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-23 19:49:00 +01:00
David Horstmann
c61ddb2089 Add C language annotation to code block
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-23 19:18:50 +01:00
David Horstmann
cbf068dbee Fix broken reference
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-23 19:03:10 +01:00
David Horstmann
f889e0fa0a Replace vague 'above' with a reference for ease-of-navigation
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-23 19:01:21 +01:00
David Horstmann
ded14a2c02 Add example wrapper function implementation
Give an example wrapper foir psa_aead_update for the transparent testing
option.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-23 18:58:41 +01:00
David Horstmann
16dac00cb9 Add skeleton of detailed design rewrite
In light of choosing Valgrind/ASan over mprotect()-based poisoning,
update the detailed design of copy validation.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-23 18:57:01 +01:00
David Horstmann
be868347f4 Rewrite design exploration of copy validation
Main changes:
* New tests are easier to write than first stated
* Use of existing tests is ledd beneficial
* But using existing tests is a benefit if it can be done transparently

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-20 19:25:11 +01:00
David Horstmann
51fc6cf378 Explore sanitizers for memory poisoning
Consider MSan, ASan and Valgrind as options for implementing memory
poisoning tests. Come to the altered conclusion that Valgrind is the
best option.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-20 18:40:15 +01:00
David Horstmann
17b3716c5a Tweak compiler optimization evaluation section
* Remove references to the platform - this is unlikely to affect whether
copies are optimized.
* Note that the evaluation should test extreme optimisation settings.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-20 18:39:14 +01:00
David Horstmann
4e54abf182 Add section on possible use of Valgrind tracing
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-19 17:59:45 +01:00
David Horstmann
05ca3d9a1b Expand design for validation of careful access
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-19 16:45:37 +01:00
David Horstmann
a72b4ca734 Modify optimize-testing instructions
Mention -flto and whole-program optimization as this is the most
important aspect.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-19 15:22:15 +01:00
David Horstmann
3f7e42a750 Move implementation by module table earlier
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-19 15:14:50 +01:00
David Horstmann
dae0ad439f Add more detail in design of memory poisoning
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-19 15:12:34 +01:00
David Horstmann
0bd87f5959 Change unsigned int to uint8_t
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-19 13:45:21 +01:00
David Horstmann
23661cc232 Detailed design of memory protection strategy
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-18 18:20:33 +01:00
Gilles Peskine
8ebeb9c180 Test for read-read inconsistency with mprotect and ptrace/gdb
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-16 18:37:02 +02:00
Gilles Peskine
87889ebe86 Fix editorial error with semantic consequences
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-16 15:40:02 +02:00