Bug#1064320: libeigen3-dev: linking objects compiled with different flags may cause crashes

Dima Kogan dkogan at debian.org
Mon Feb 19 22:34:59 GMT 2024


Package: libeigen3-dev
Version: 3.4.0-4
Severity: normal
X-Debbugs-Cc: none, Dima Kogan <dkogan at debian.org>

Hello. I'm making this report to track the report in this mailing list
thread:

  https://www.mail-archive.com/debian-science@lists.debian.org/msg13666.html

In short: there's a known issue in Eigen that can create crashing
binaries when using a very reasonable workflow. A description of the
issue and minimized reproducer are here:

  https://www.mail-archive.com/debian-science@lists.debian.org/msg13710.html

I propose to patch this in Debian and/or talk to Eigen upstream to
eliminate the cause of the crash. A proposed patch appears here:

  https://www.mail-archive.com/debian-science@lists.debian.org/msg13857.html

In my view, a questionable design choice in C++ allows the user to
create crashing code, and Eigen expoloits this design choice to make
this crashing possible.

We cannot fix C++, but we can fix Eigen. The issue is that a templated
function defined in a header generates a (weak symbol) copy of this
function in EACH compile unit, and the linker then picks an arbitrary
copy from the many compile units it is given. It is thus imperative that
each copy is compatible with every other copy. Eigen breaks this
requirement by using the preprocessor to select incompatible behaviors
that might crash when linked together. The proposed patch eliminates
this preprocessor-based variability.



More information about the debian-science-maintainers mailing list