-
Notifications
You must be signed in to change notification settings - Fork 17
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
Bug: faulty control-flow reconstruction in ML-DSA #507
Comments
Just checking: the reconstruction is semantically correct, right? It's just suboptimal? Could you minimize the bug? |
Yes it is semantically correct, it just fails to reconstruct the original control-flow and I think one of the (large) basic blocks ends up being duplicated. I'll try to minimize the bug, currently filing another one :-) |
const MY_CONST: u8 = 0;
fn deserialize( serialized: &[u8; 1]) {
let previous_true_hints_seen = 0usize;
let mut i = 0;
while i < 1 {
let current_true_hints_seen = serialized[i] as usize;
if (current_true_hints_seen < previous_true_hints_seen)
|| (previous_true_hints_seen > 1)
{
// the true hints seen should be increasing
}
let mut j = previous_true_hints_seen;
while j < 1 {
let x = MY_CONST;
}
}
} @franziskuskiefer and I found another occurrence of this bug (which in turn creates other issues), so this is as small as I could make the repro -- hopefully it helps if you dump the LLBC you'll see that the reference to MY_CONST appears twice in the AST for |
I don't know if this is exactly the same bug, but already this duplicates the const MY_CONST: u8 = 0;
fn deserialize() {
let a = 0;
let b = 0;
let i = 0;
if i < 1 {
if a < b {
// the true hints seen should be increasing
}
let x = MY_CONST;
}
} |
ok nice smaller repro 👍 |
Found while looking at something unrelated for @franziskuskiefer
If I dump the LLBC I receive from Charon while running
cd libcrux/libcrux-ml-dsa && ./boring.sh
on https://github.com/cryspen/libcrux/tree/franziskus/mldsa-c-ci (commit 26c593e) I get the following:Note how the parts between BEGIN and END are repeated. (I snipped a bunch of irrelevant stuff in the middle but it's actually quite a large fragment.)
This is then throwing off my let-binding reconstruction phase that converts declare-then-assign into declare-in-the-right-location.
@sonmarcho I think this is pretty similar to the control-flow reconstruction issue I had on another internal project.
The text was updated successfully, but these errors were encountered: