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

Pi with 1 M digits not equal 3563018237 NE 2188794840 #2462

Closed
XGlobetrotter opened this Issue Nov 27, 2016 · 7 comments

Comments

Projects
None yet
3 participants
@XGlobetrotter

Qubes OS version (e.g., R3.1): QR32

Affected TemplateVMs (e.g., fedora-23, if applicable):

The test was done with a Standalone Machine, because of the Mathematica activation policy it is not possible to run it inside a AppVM.

uname -a

Linux localhost 4.4.14-11.pvops.qubes.x86_64 #1 SMP Tue Jul 19 01:14:58 UTC 2016 x86_64 GNU/Linux

user@localhost:~$ free -m
total used free shared buffers cached
Mem: 7179 1078 6101 10 28 421
-/+ buffers/cache: 628 6551
Swap: 1023 0 1023


Expected behavior: Deterministic calculation of mathematical truth on any kind of system and especially Qubes.

Pi Black Box Testing:
Mathematica:

N[Pi,10^n]
Hash[%,"Adler32"]

or (in one line)
Hash[N[Pi, 10^6], "Adler32"]

  1. Calculate the digits of Pi up to 10^n.
  2. Calculate a hash
  3. Do this on different machines and you should find always the same hashes.

Actual behavior:

3563018237 NE 2188794840

AMD Qubes R32:
n = 6
hash = 3563018237

Intel Win8
n = 6
hash = 2188794840

NE not equal
3563018237 NE 2188794840

Conclusion: One hash can be only the right one, because math is 100% deterministic.
Computer should be also deterministic, but it is sometimes hard to test them for 100%.

Here is a strong indicator, that at least one system, is not working correct.

Working-hypothesis: The hypervisor has some memory issues, which pop up here with long-integer-calculations.

Will it work for some n?
Yes, e.g. for 3:
680648812

(Let's assume that here all is right, in theory there might be some hash collision took place. There is an option to use other more long hashes, but this seems not bring us to another conclusion, that the calculations don't fit at all systems)

Steps to reproduce the behavior:

  1. Calculate Pi with 1 Million digits
    2 Repeat this on different platforms (e.g. Windows versus Qubes versus native Debian)
  2. compare the result (e.g. with a common hash)

General notes:

Mathematica might be a useful tool, to check this out, but there are also many other math-libs or computer algebra programs (sage, maple), but the mathematical output is deterministic by definition and must be correct, otherwise there is some bug around.

Security Considerations: If the mathematical calculations will not lead to a deterministic result, cryptography functions can be affected because they are based on mathematical correct operations.


Related issues: Potential XEN MEM

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Nov 27, 2016

Member

Interesting.

Will it work for some n?
Yes, e.g. for 3:
680648812

Does this mean that you have confirmed that the hashes do match when pi is computed to only three digits?

Member

andrewdavidwong commented Nov 27, 2016

Interesting.

Will it work for some n?
Yes, e.g. for 3:
680648812

Does this mean that you have confirmed that the hashes do match when pi is computed to only three digits?

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Nov 27, 2016

Member

Does this mean that you have confirmed that the hashes do match when pi is computed to only three digits?

(This is helpful to rule out other possibilities, e.g., problems with the way hashing is being done.)

Member

andrewdavidwong commented Nov 27, 2016

Does this mean that you have confirmed that the hashes do match when pi is computed to only three digits?

(This is helpful to rule out other possibilities, e.g., problems with the way hashing is being done.)

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@XGlobetrotter

This comment has been minimized.

Show comment
Hide comment
@XGlobetrotter

XGlobetrotter Dec 5, 2016

No n = 3 means 10^3 = 1000 digits.

No n = 3 means 10^3 = 1000 digits.

@XGlobetrotter

This comment has been minimized.

Show comment
Hide comment
@XGlobetrotter

XGlobetrotter Dec 5, 2016

Last 3 digits N[Pi,10^6]
Qubes: 149
Windows: 021
149 NE 021
Something is running not well.

Last 3 digits N[Pi,10^6]
Qubes: 149
Windows: 021
149 NE 021
Something is running not well.

@XGlobetrotter

This comment has been minimized.

Show comment
Hide comment
@XGlobetrotter

XGlobetrotter Dec 5, 2016

What will be a good reference for checking the Pi calculation?

Perhaps:
http://www.numberworld.org/digits/Pi/#Download

What will be a good reference for checking the Pi calculation?

Perhaps:
http://www.numberworld.org/digits/Pi/#Download

@marmarta

This comment has been minimized.

Show comment
Hide comment
@marmarta

marmarta Jul 13, 2018

I think this is a Mathematica-Xen/large calculations error, not Qubes error (judging from the discussion linked).

I think this is a Mathematica-Xen/large calculations error, not Qubes error (judging from the discussion linked).

@marmarta marmarta closed this Jul 13, 2018

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