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

warning(module): unexpected EOF reading cached ZIR when running test-cases multi-threaded #11871

Open
andrewrk opened this issue Jun 15, 2022 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone

Comments

@andrewrk
Copy link
Member

Now that zig build test-cases runs the cases multi-threaded, it exposed a bug. This manifested as a CI failure on 27610b0 which is unrelated to the actual changes.

====== expected this output: =========
␃

======== instead found this: =========
warning(module): unexpected EOF reading cached ZIR for Thread/Condition.zig
␃

======================================
====== expected this output: =========
␃

======== instead found this: =========
warning(module): unexpected EOF reading cached ZIR for math/modf.zig
warning(module): unexpected EOF reading cached ZIR for math/isnormal.zig
␃

======================================
safety/switch on corrupted union value (stage1, native) failed: TestExpectedEqual
safety/unsigned-signed vector cast (stage1, native) failed: TestExpectedEqual
2 tests failed

Let's inspect the pipeline with regards to AstGen and caching and look for any possibility of this error occurring.

@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness. labels Jun 15, 2022
@andrewrk andrewrk added this to the 0.10.0 milestone Jun 15, 2022
andrewrk referenced this issue Jun 15, 2022
ECDSA is the most commonly used signature scheme today, mainly for
historical and conformance reasons. It is a necessary evil for
many standard protocols such as TLS and JWT.

It is tricky to implement securely and has been the root cause of
multiple security disasters, from the Playstation 3 hack to multiple
critical issues in OpenSSL and Java.

This implementation combines lessons learned from the past with
recent recommendations.

In Zig, the NIST curves that ECDSA is almost always instantied with
use formally verified field arithmetic, giving us peace of mind
even on edge cases. And the API rejects neutral elements where it
matters, and unconditionally checks for non-canonical encoding for
scalars and group elements. This automatically eliminates common
vulnerabilities such as https://sk.tl/2LpS695v .

ECDSA's security heavily relies on the security of the random number
generator, which is a concern in some environments.

This implementation mitigates this by computing deterministic
nonces using the conservative scheme from Pornin et al. with the
optional addition of randomness as proposed in Ericsson's
"Deterministic ECDSA and EdDSA Signatures with Additional Randomness"
document. This approach mitigates both the implications of a weak RNG
and the practical implications of fault attacks.

Project Wycheproof is a Google project to test crypto libraries against
known attacks by triggering edge cases. It discovered vulnerabilities
in virtually all major ECDSA implementations.

The entire set of ECDSA-P256-SHA256 test vectors from Project Wycheproof
is included here. Zero defects were found in this implementation.

The public API differs from the Ed25519 one. Instead of raw byte strings
for keys and signatures, we introduce Signature, PublicKey and SecretKey
structures.

The reason is that a raw byte representation would not be optimal.
There are multiple standard representations for keys and signatures,
and decoding/encoding them may not be cheap (field elements have to be
converted from/to the montgomery domain).

So, the intent is to eventually move ed25519 to the same API, which
is not going to introduce any performance regression, but will bring
us a consistent API, that we can also reuse for RSA.
@andrewrk andrewrk modified the milestones: 0.10.0, 0.10.1 Oct 12, 2022
@motiejus
Copy link
Contributor

motiejus commented Oct 30, 2022

I noticed similar "unexpected EOF" (for different files) in #13160 and suspect this may ho away with #13342.

@andrewrk andrewrk modified the milestones: 0.10.1, 0.11.0 Jan 10, 2023
@jacobly0
Copy link
Member

This sure looks a heck of a lot like the bug fixed by #14821.

@andrewrk andrewrk modified the milestones: 0.11.0, 0.11.1 Jul 22, 2023
@andrewrk andrewrk modified the milestones: 0.11.1, 0.12.0, 0.13.0 Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Projects
None yet
Development

No branches or pull requests

3 participants