I have a bit of a strange situation. Google internally uses clang+tcmalloc by default for all its builds, and in v1.1.4 I've encountered a few crashes that occur whenever an OpenFHE exception is thrown, with a trace like this:
I've found it's easy to reproduce the exception being thrown by, say, using a prime plaintext modulus that does not satisfy the correct divisibility condition m divides (q-1). See the patch below for an example:
diff --git a/src/pke/examples/simple-integers-bgvrns.cpp b/src/pke/examples/simple-integers-bgvrns.cpp
index aaeed9c..d3fd960 100644
--- a/src/pke/examples/simple-integers-bgvrns.cpp
+++ b/src/pke/examples/simple-integers-bgvrns.cpp
@@ -41,7 +41,7 @@ int main() {
// Sample Program: Step 1 - Set CryptoContext
CCParams<CryptoContextBGVRNS> parameters;
parameters.SetMultiplicativeDepth(2);
- parameters.SetPlaintextModulus(65537);
+ parameters.SetPlaintextModulus(131101); // a prime with bad divisibility
CryptoContext<DCRTPoly> cryptoContext = GenCryptoContext(parameters);
// Enable features that you wish to use
But I am not able to reproduce the actual trace in the CMake build. My attempt (v1.1.4 94fd76a1d965cfde13f2a540d78ce64146fc2700):
Apply the patch above
Configure with tcmalloc enabled
mkdir build && cd build
cmake .. -DWITH_TCM=ON -DBUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Debug
make tcm
make -j 25
Run bin/examples/pke/simple-integers-bgvrns
As with last time, I suspect the issue is in differing compiler flags. A few stand out: -fsized-deallocation, -fno-exceptions
I have a bit of a strange situation. Google internally uses clang+tcmalloc by default for all its builds, and in v1.1.4 I've encountered a few crashes that occur whenever an OpenFHE exception is thrown, with a trace like this:
The error comes from here: https://github.com/google/tcmalloc/blob/7d59e25cd84cdce95f137b79466dd4c4d56e6ff2/tcmalloc/tcmalloc.cc#L765
I've found it's easy to reproduce the exception being thrown by, say, using a prime plaintext modulus that does not satisfy the correct divisibility condition
m divides (q-1)
. See the patch below for an example:But I am not able to reproduce the actual trace in the CMake build. My attempt (v1.1.4 94fd76a1d965cfde13f2a540d78ce64146fc2700):
bin/examples/pke/simple-integers-bgvrns
As with last time, I suspect the issue is in differing compiler flags. A few stand out:
-fsized-deallocation
,-fno-exceptions
Here is the complete list
How would I test these compiler flags in the CMake config to see if I can reproduce this? Any idea what could be the root cause here?