Skip to content

Conversation

@ospfranco
Copy link
Contributor

@ospfranco ospfranco commented Oct 8, 2025

Fixes mlua-rs/mlua#644

After much tweaking around we discovered the source of nondeterminism lies in the way mlua compiles the luau sources. read_dir is nondeterministic in the order of files it returns as it depends on disk IO. This for some reason caused different binary outputs on the final binary compiled by Rust.

You can try this yourself in a Docker image or similar ubuntu machines. Compiling a crate that uses mlua and then getting the sha256 of the final Rust binary. Even though the code and environment is the same, the SHA256 output is different.

For us this caused SGX generating different signatures for the binaries we had produced. Via much tweaking of the compilation process we finally stumbled into the answer.

BTW we only need luau, but this is happening with the lua-src-rs crate as well.

@khvzak
Copy link
Member

khvzak commented Oct 8, 2025

Thank you! Well done figuring this out.

@khvzak khvzak merged commit b6652a9 into mlua-rs:main Oct 8, 2025
11 checks passed
@ospfranco
Copy link
Contributor Author

Thank you for merging @khvzak . Could you please let me know when you do a mlua release with the fix?

@khvzak
Copy link
Member

khvzak commented Oct 8, 2025

I can release this crate ~today. No need to wait for mlua. It’s a subdependency, so you can set a specific version in Cargo.toml and mlua will use it

@ospfranco
Copy link
Contributor Author

yeah, that would be great, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[QUESTION] SGX Runtime Hash

2 participants