-
Notifications
You must be signed in to change notification settings - Fork 30k
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
V8 in Node.js 12.18.2 optimizes incorrectly a function on ppc64el #34666
Comments
@miladfarca can you take a look at this please? |
Seems like the issue was introduced after updating to V8 6.9: will need to check the details. |
This patch should fix the problem, will need to backport it to node 12: |
What are the branches we like to backport this to, |
@miladfarca Don't bother with v13.x-staging as Node.js 13 is End-of-Life. v12.x-staging, v14.x-staging and master would be the branches to target (sounds like the bug doesn't apply to 10.x). FYI @nodejs/platform-ppc |
the fixes landed |
This report summarizes my findings from https://bugs.launchpad.net/ubuntu/+source/nodejs/+bug/1887144.
When upgrading from Node.js 10.19 to 12.18 in Ubuntu, some tests in node-sha.js and related packages started failing consistently on ppc64el. All other architectures are fine. This was reported separately in node-sha.js: browserify/sha.js#66.
It turns out V8 optimizes a function in the sha0 and sha1 implementations in node-sha.js incorrectly, leading to unexpected results. The function that is being incorrectly optimized is
ft(…)
(https://github.com/crypto-browserify/sha.js/blob/master/sha1.js#L51):That function is called multiple times when incrementally updating a hash, and I am seeing it eventually start using the other code path (s ≠ 0 and s ≠ 2) when s === 2.
I confirmed that the problem comes from incorrect optimizations by two different methods:
--no-opt
flag makes the tests consistently passeval('')
in the body offt(…)
to prevent optimization makes the tests consistently passWhat steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
100% reproducible on ppc64el, doesn't occur on other architectures (x86, x86_64, armhf, arm64, s390x).
What is the expected behavior?
That test should reliably pass.
What do you see instead?
The test reliably fails:
The text was updated successfully, but these errors were encountered: