mratsim / constantine

Constantine: modular, high-performance, zero-dependency cryptography stack for verifiable computation, proof systems and blockchain protocols.
Other
408 stars 43 forks source link

[Fuzz fail] MSM BLS12-381- GCC-only no-ADX assembly fallback #248

Open mratsim opened 1 year ago

mratsim commented 1 year ago

In https://github.com/mratsim/constantine/pull/247

image

test_ec_shortweierstrass_projective_multi_scalar_mul_BLS12_381 xoshiro512** seed: 1688292764

nim c -r --passC:-fstack-protector-strong --passC:-D_FORTIFY_SOURCE=3 --passC:-Wno-stringop-overflow --passL:-Wno-stringop-overflow --passC:-flto=auto --passL:-flto=auto -d:danger --panics:on -d:noSignalHandler --mm:arc -d:useMalloc --verbosity:0 --hints:off --warnings:off --passC:-fno-semantic-interposition --passC:-falign-functions=64 --outdir:build/testsuite --nimcache:nimcache/tests/math_elliptic_curves/t_ec_shortw_prj_g1_msm.nim tests/math_elliptic_curves/t_ec_shortw_prj_g1_msm.nim

mratsim commented 1 year ago

You can crash with both 1688292755 and 1688292764 with no-ADX fallback assembly (assembly but not the ADX optimized one), but only with GCC, Clang works.

and also

nim c -r  --passC:-fstack-protector-strong  --passC:-D_FORTIFY_SOURCE=3  --passC:-Wno-stringop-overflow --passL:-Wno-stringop-overflow  --passC:-flto=auto --passL:-flto=auto  -d:danger  --panics:on -d:noSignalHandler  --mm:arc -d:useMalloc  --verbosity:0 --hints:off --warnings:off  --passC:-fno-semantic-interposition  --passC:-falign-functions=64  --outdir:build tests/math_fields/t_finite_fields_mulsquare.nim

image

As Clang still works, it's probably another #231 LTO corner case

mratsim commented 1 year ago

The t_finite_fields_mulsquare.nim failures seem to be fixed by #246 with remaining failure related to #208.