cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
78 stars 26 forks source link

segfaults related to brial #733

Open strogdon opened 1 year ago

strogdon commented 1 year ago

I see these on vanilla as well where system brial is used. I could not find an issue on sagemath github.

sage -t --random-seed=83057325440012093370419712562589552544 /usr/lib/python3.10/site-packages/sage/rings/polynomial/pbori/gbcore.py  # Killed due to abort
sage -t --random-seed=83057325440012093370419712562589552544 /usr/lib/python3.10/site-packages/sage/rings/polynomial/pbori/cnf.py  # Killed due to abort
sage -t --random-seed=83057325440012093370419712562589552544 /usr/lib/python3.10/site-packages/sage/rings/polynomial/pbori/nf.py  # Killed due to abort
sage -t --random-seed=83057325440012093370419712562589552544 /usr/lib/python3.10/site-packages/sage/rings/polynomial/pbori/fglm.py  # Killed due to abort
sage -t --random-seed=83057325440012093370419712562589552544 /usr/lib/python3.10/site-packages/sage/rings/polynomial/pbori/pbori.pyx  # Killed due to segmentation fault

as well as

sage -t --random-seed=223045934334796405747806681685610901110 /usr/lib/python3.10/site-packages/sage/crypto/mq/sr.py  # Killed due to abort
sage -t --random-seed=165888455350020047902968072583912511654 /usr/lib/python3.10/site-packages/sage/rings/polynomial/multi_polynomial_sequence.py  # Killed due to abort
kiwifb commented 1 year ago

That's new to me. Do you have any backtrace?

strogdon commented 1 year ago

This is what seems to be the important stuff for pbori.pyx.

Stack backtrace
---------------
No symbol table info available.
#1  0x00007f2678378824 in ?? () from /usr/lib/python3.10/site-packages/cysignals/signals.cpython-310-x86_64-linux-gnu.so
No symbol table info available.
#2  0x00007f26783790e6 in ?? () from /usr/lib/python3.10/site-packages/cysignals/signals.cpython-310-x86_64-linux-gnu.so
No symbol table info available.
#3  0x00007f267837b510 in ?? () from /usr/lib/python3.10/site-packages/cysignals/signals.cpython-310-x86_64-linux-gnu.so
No symbol table info available.
#4  <signal handler called> 
No symbol table info available.
#5  0x00007f26196ec5b6 in polybori::groebner::linalg_step_modified(std::vector<polybori::BoolePolynomial, std::allocator<polybori::BoolePolynomial> >&, polybori::BooleSet, polybori::BooleSet, bool, bool, char const*) () from /usr/lib64/libbrial_groebner.so.3
No symbol table info available.
#6  0x00007f26196d67e6 in polybori::groebner::GroebnerStrategy::faugereStepDense(std::vector<polybori::BoolePolynomial, std::allocator<polybori::BoolePolynomial> > const&) () from /usr/lib64/libbrial_groebner.so.3
No symbol table info available.
#7  0x00007f2619b0cea7 in ?? () from /usr/lib/python3.10/site-packages/sage/rings/polynomial/pbori/pbori.cpython-310-x86_64-linux-gnu.so
No symbol table info available.
#8  0x00007f26796b575d in ?? () from /usr/lib64/libpython3.10.so.1.0
No symbol table info available.
#9  0x00007f267962ba76 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.10.so.1.0
No symbol table info available.
#10 0x00007f26797415d4 in ?? () from /usr/lib64/libpython3.10.so.1.0
No symbol table info available.

and

Cython backtrace
----------------
#0  0x00007f26794b6b20 in wait4 ()
#1  0x0000000000000000 in ?? () 
#2  0x0000000000000000 in ?? ()
#3  0x0000000000000000 in ?? () 
#4  0x0000000000000000 in ?? ()
#5  0x0000000000000000 in polybori::groebner::linalg_step_modified(std::vector<polybori::BoolePolynomial, std::allocator<polybori::BoolePolynomial> >&, polybori::BooleSet, polybori::BooleSet, bool, bool, char const*) ()
#6  0x0000000000000000 in polybori::groebner::GroebnerStrategy::faugereStepDense(std::vector<polybori::BoolePolynomial, std::allocator<polybori::BoolePolynomial> > const&) ()
#7  0x0000000000000000 in ?? ()
#8  0x0000000000000000 in ?? ()
#9  0x00007f26796225d0 in _PyEval_EvalFrameDefault ()
#10 0x0000000000000000 in ?? ()
strogdon commented 1 year ago

This is the failure

Tests run before process (pid=20146) failed:
sage: P.<a,b,c,d,e> = PolynomialRing(GF(2), 5, order='lex') ## line 78 ##
sage: I1 = ideal([a*b + c*d + 1, a*c*e + d*e, a*b*e + c*e, b*c + c*d*e + 1]) ## line 79 ##
sage: for f in I1.groebner_basis():
  f ## line 80 ##
a + c^2*d + c + d^2*e 
b*c + d^3*e^2 + d^3*e + d^2*e^2 + d*e + e + 1
b*e + d*e^2 + d*e + e 
c*e + d^3*e^2 + d^3*e + d^2*e^2 + d*e
d^4*e^2 + d^4*e + d^3*e + d^2*e^2 + d^2*e + d*e + e
sage: J = I1 + sage.rings.ideal.FieldIdeal(P) ## line 95 ##
sage: for f in J.groebner_basis():
  f ## line 96 ##
a + d + 1
b + 1
c + 1
d^2 + d
e
sage: Q = P.quotient( sage.rings.ideal.FieldIdeal(P) ) ## line 116 ##
sage: I2 = ideal([Q(f) for f in I1.gens()]) ## line 117 ##
sage: for f in I2.groebner_basis():
    f ## line 118 ##
abar + dbar + 1
bbar + 1
cbar + 1
ebar
sage: B.<a,b,c,d,e> = BooleanPolynomialRing(5, order='lex') ## line 127 ##
sage: I2 = ideal([B(f) for f in I1.gens()]) ## line 128 ##
sage: for f in I2.groebner_basis():
  f ## line 129 ##
------------------------------------------------------------------------
/usr/lib/python3.10/site-packages/cysignals/signals.cpython-310-x86_64-linux-gnu.so(+0x7ffb)[0x7f2678378ffb]
/usr/lib/python3.10/site-packages/cysignals/signals.cpython-310-x86_64-linux-gnu.so(+0x80a9)[0x7f26783790a9]
/usr/lib/python3.10/site-packages/cysignals/signals.cpython-310-x86_64-linux-gnu.so(+0xa510)[0x7f267837b510]
/lib64/libc.so.6(+0x37c10)[0x7f2679420c10]
/usr/lib64/libbrial_groebner.so.3(_ZN8polybori8groebner20linalg_step_modifiedERSt6vectorINS_15BoolePolynomialESaIS2_EENS_8BooleSetES6_bbPKc+0x1136)[0x7f26196ec5b6]
/usr/lib64/libbrial_groebner.so.3(_ZN8polybori8groebner16GroebnerStrategy16faugereStepDenseERKSt6vectorINS_15BoolePolynomialESaIS3_EE+0x186)[0x7f26196d67e6]
/usr/lib/python3.10/site-packages/sage/rings/polynomial/pbori/pbori.cpython-310-x86_64-linux-gnu.so(+0x9fea7)[0x7f2619b0cea7]
/usr/lib64/libpython3.10.so.1.0(+0xf875d)[0x7f26796b575d]
/usr/lib64/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x94a6)[0x7f267962ba76]
/usr/lib64/libpython3.10.so.1.0(+0x1845d4)[0x7f26797415d4]
strogdon commented 1 year ago

This is gcc-related. My system brial was built with gcc-11. I'm now using gcc-12. I rebuilt brial with gcc-12 and there are no segfaults. I didn't think this was supposed to happen?

kiwifb commented 1 year ago

No, not really. There could be a mismatch between c++ standard implementation between gcc-11 and gcc-12 but sage itself default to the c++11 standard. It may be that sage and brial need to be build with the same compiler at the moment. Very strange.