parallaxsecond / parsec

Platform AbstRaction for SECurity service
https://parsec.community/
Apache License 2.0
467 stars 66 forks source link

e2e_tests/stress.rs: Signature Verification fails sporadically with PsaErrorInvalidArgument #738

Open tgonzalezorlandoarm opened 9 months ago

tgonzalezorlandoarm commented 9 months ago

stress tests are sporadically failing:

[ERROR parsec_service::providers::mbed_crypto::asym_sign] Verify status: ; Error: the signature, MAC or hash is incorrect
test per_provider::stress_test::stress_test ... FAILED

failures:

---- per_provider::stress_test::stress_test stdout ----
thread '<unnamed>' panicked at src/stress.rs:236:21:
An invalid signature or a tampering detection should be the only reasons of the verification failing. Status returned: PsaErrorInvalidArgument.
stack backtrace:
   0: rust_begin_unwind
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
   1: core::panicking::panic_fmt
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
   2: e2e_tests::stress::StressTestWorker::execute_request
             at ./src/stress.rs:236:21
   3: e2e_tests::stress::StressTestWorker::run_test
             at ./src/stress.rs:181:13
   4: e2e_tests::stress::StressClient::execute::{{closure}}
             at ./src/stress.rs:90:17
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'per_provider::stress_test::stress_test' panicked at src/stress.rs:101:27:
Test thread panicked: Any { .. }
stack backtrace:
   0: rust_begin_unwind
             at /rustc/cc66ad[4689](https://github.com/tgonzalezorlandoarm/parsec/actions/runs/6510795985/job/17685225654#step:4:4690)55717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
   1: core::panicking::panic_fmt
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
   2: core::result::unwrap_failed
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/result.rs:1652:5
   3: core::result::Result<T,E>::expect
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/result.rs:1034:23
   4: e2e_tests::stress::StressClient::execute
             at ./src/stress.rs:101:13
   5: mod::per_provider::stress_test::stress_test
             at ./tests/per_provider/stress_test.rs:16:5
   6: mod::per_provider::stress_test::stress_test::{{closure}}
             at ./tests/per_provider/stress_test.rs:7:18
   7: core::ops::function::FnOnce::call_once
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/ops/function.rs:250:5
   8: core::ops::function::FnOnce::call_once
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

failures:
    per_provider::stress_test::stress_test

This is happening for MbedCrypto provider, TrustedService Provider and sometimes PKCS11.

This could be either a threading issue or an issue in the providers.

This issue is observed in both CI and locally.

To reproduce, run the tests locally via docker multiple times on https://github.com/parallaxsecond/parsec/tree/1.3.0:

docker run --net=host -v $(pwd):/tmp/parsec -w /tmp/parsec -t ghcr.io/parallaxsecond/parsec-service-test-all /tmp/parsec/ci.sh trusted-service