Skip to content
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

Test_General is broken (allows noise buildup) #2

Closed
TomMD opened this issue Apr 19, 2013 · 2 comments
Closed

Test_General is broken (allows noise buildup) #2

TomMD opened this issue Apr 19, 2013 · 2 comments

Comments

@TomMD
Copy link
Contributor

TomMD commented Apr 19, 2013

When running Test_General.cpp with R=2, or any number of rounds >1, the cipher computations and plaintext computations get different results. This seems to be due to a lack of recryption (noise build up).

The error is "Ctxt::findBaseSet warning: already at lowest level". It wouldn't cause such a trip up, except that the test itself suggests running with more than one round (R=4).

(the title was changed when I realized what was really happening)

@shaih
Copy link
Collaborator

shaih commented Apr 20, 2013

The default setting for the L parameter in Test_General (L=2R) is often too aggressive, especially for small values of R.

For the parameter r=1, setting L=2R+1 or L=2R+2 would probably work most of the time, When using parameter r>1 then maybe L=3R+something or L=4R will be needed. Some example small-R settings that work include the following:

  • Test_General_x R=2 L=5
  • Test_General_x R=3 L=8
  • Test_General_x R=4 L=9
  • Test_General_x R=2 r=2 L=6
  • Test_General_x R=4 r=3 L=14

More generally, for any setting of the other parameters (R, p, r, d, c, k), you will need some trial and error to determine the smallest value of L that works.

@TomMD
Copy link
Contributor Author

TomMD commented May 1, 2013

Shaih - this was just a confusion caused by an invalid help message in the demonstration. It's fixed by my recent pull request so I'll close this ticket.

@TomMD TomMD closed this as completed May 1, 2013
rbharath added a commit to rbharath/hepy that referenced this issue May 21, 2018
Simple Example of a Homomorphic Program
UnionTech-Software added a commit to UnionTech-Software/HElib that referenced this issue Dec 20, 2024
This patch fixes the memory leak in zzX

==47958==ERROR: LeakSanitizer: detected memory leaks
                                                                                                                                       
Direct leak of 176 byte(s) in 1 object(s) allocated from:
    #0 0x794a300b61e7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99                          
    homenc#1 0x5777885d6c36 in helib::getPhimXMod(helib::PAlgebra const&) /home/uos/HElib-2.3.0/HElib-2.3.0/src/zzX.cpp:96

Indirect leak of 49152 byte(s) in 2 object(s) allocated from:
    #0 0x794a300b6357 in operator new[](unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:102                       
    homenc#1 0x794a2fda81c1 in long* NTL::MakeRawArray<long>(long) ../include/NTL/SmartPtr.h:998
    homenc#2 0x794a2fda81c1 in NTL::UniqueArray<long>::SetLength(long) ../include/NTL/SmartPtr.h:1620
    homenc#3 0x794a2fda81c1 in NTL::fftRep::DoSetSize(long, long) /home/uos/HElib-2.3.0/HElib-2.3.0/build/dependencies/Source/ntl_fetched/src/lzz_pX.cpp:1378

Indirect leak of 13888 byte(s) in 1 object(s) allocated from:
    #0 0x794a300b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145                              
    homenc#1 0x577788032e4b in NTL::Vec<NTL::zz_p>::AllocateTo(long) /home/uos/HElib-2.3.0/HElib-2.3.0/build/helib_pack/include/NTL/vector.h:653

Indirect leak of 56 byte(s) in 1 object(s) allocated from:
    #0 0x794a300b64c7 in operator new(unsigned long, std::nothrow_t const&) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:105  
    homenc#1 0x794a2fdac3a4 in NTL::Lazy<NTL::Vec<NTL::zz_p>, NTL::DefaultDeleterPolicy>* NTL::MakeRaw<NTL::Lazy<NTL::Vec<NTL::zz_p>, NTL::DefaultDeleterPolicy>>() ../include/NTL/SmartPtr.h:710
    homenc#2 0x794a2fdac3a4 in void NTL::UniquePtr<NTL::Lazy<NTL::Vec<NTL::zz_p>, NTL::DefaultDeleterPolicy>, NTL::DefaultDeleterPolicy>::make<>() ../include/NTL/SmartPtr.h:1109
    homenc#3 0x794a2fdac3a4 in void NTL::OptionalVal<NTL::Lazy<NTL::Vec<NTL::zz_p>, NTL::DefaultDeleterPolicy> >::make<>() ../include/NTL/SmartPtr.h:1479
    homenc#4 0x794a2fdac3a4 in NTL::build(NTL::zz_pXModulus&, NTL::zz_pX const&) /home/uos/HElib-2.3.0/HElib-2.3.0/build/dependencies/Source/ntl_fetched/src/lzz_pX.cpp:2845

SUMMARY: AddressSanitizer: 63272 byte(s) leaked in 5 allocation(s).
UnionTech-Software added a commit to UnionTech-Software/HElib that referenced this issue Dec 20, 2024
This patch fixes the memory leak in zzX

==47958==ERROR: LeakSanitizer: detected memory leaks
                                                                                                                                       
Direct leak of 176 byte(s) in 1 object(s) allocated from:
    #0 0x794a300b61e7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99                          
    homenc#1 0x5777885d6c36 in helib::getPhimXMod(helib::PAlgebra const&) /home/uos/HElib-2.3.0/HElib-2.3.0/src/zzX.cpp:96

Indirect leak of 49152 byte(s) in 2 object(s) allocated from:
    #0 0x794a300b6357 in operator new[](unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:102                       
    homenc#1 0x794a2fda81c1 in long* NTL::MakeRawArray<long>(long) ../include/NTL/SmartPtr.h:998
    homenc#2 0x794a2fda81c1 in NTL::UniqueArray<long>::SetLength(long) ../include/NTL/SmartPtr.h:1620
    homenc#3 0x794a2fda81c1 in NTL::fftRep::DoSetSize(long, long) /home/uos/HElib-2.3.0/HElib-2.3.0/build/dependencies/Source/ntl_fetched/src/lzz_pX.cpp:1378

Indirect leak of 13888 byte(s) in 1 object(s) allocated from:
    #0 0x794a300b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145                              
    homenc#1 0x577788032e4b in NTL::Vec<NTL::zz_p>::AllocateTo(long) /home/uos/HElib-2.3.0/HElib-2.3.0/build/helib_pack/include/NTL/vector.h:653

Indirect leak of 56 byte(s) in 1 object(s) allocated from:
    #0 0x794a300b64c7 in operator new(unsigned long, std::nothrow_t const&) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:105  
    homenc#1 0x794a2fdac3a4 in NTL::Lazy<NTL::Vec<NTL::zz_p>, NTL::DefaultDeleterPolicy>* NTL::MakeRaw<NTL::Lazy<NTL::Vec<NTL::zz_p>, NTL::DefaultDeleterPolicy>>() ../include/NTL/SmartPtr.h:710
    homenc#2 0x794a2fdac3a4 in void NTL::UniquePtr<NTL::Lazy<NTL::Vec<NTL::zz_p>, NTL::DefaultDeleterPolicy>, NTL::DefaultDeleterPolicy>::make<>() ../include/NTL/SmartPtr.h:1109
    homenc#3 0x794a2fdac3a4 in void NTL::OptionalVal<NTL::Lazy<NTL::Vec<NTL::zz_p>, NTL::DefaultDeleterPolicy> >::make<>() ../include/NTL/SmartPtr.h:1479
    homenc#4 0x794a2fdac3a4 in NTL::build(NTL::zz_pXModulus&, NTL::zz_pX const&) /home/uos/HElib-2.3.0/HElib-2.3.0/build/dependencies/Source/ntl_fetched/src/lzz_pX.cpp:2845

SUMMARY: AddressSanitizer: 63272 byte(s) leaked in 5 allocation(s).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants