encryptogroup / ABY

ABY - A Framework for Efficient Mixed-protocol Secure Two-party Computation
GNU Lesser General Public License v3.0
459 stars 132 forks source link

Segfault while benchmarking with Paillier #120

Open ryandeng1 opened 5 years ago

ryandeng1 commented 5 years ago

When I run the benchmark operation on multiplication with Paillier, the program seg faults. If I change it back to OT to generate the triples, the benchmark runs fine.

The seg fault produces the following output:

mularith generating 2x 0 MTs took 0.000000 mularith generating 2x 0 MTs took 0.000000 generating 2x 0 MTs took 0.000000 Error in `./bin/bench_operations': double free or corruption (fasttop): 0x0000000000d7d770 generating 2x 0 MTs took 0.001000 Error in `./bin/bench_operations': double free or corruption (fasttop): 0x0000000001db41a0 ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f5b09c5b7e5] /lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f5582b3337a] /lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f5b09c6437a] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f5582b3753c] ./bin/bench_operations[0x425d4d] ./bin/bench_operations[0x4279cc] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f5b09c6853c] ./bin/bench_operations[0x425d4d] ./bin/bench_operations[0x4279cc] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xb8c80)[0x7f5583454c80] /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f55837256ba] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xb8c80)[0x7f5b0a585c80] /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f5b0a8566ba] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f5582bba41d] ======= Memory map: ======== /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f5b09ceb41d] ======= Memory map: ======== 00400000-0052b000 r-xp 00000000 103:01 275521 /home/ubuntu/ABY/build/bin/bench_operations 0072a000-0072b000 r--p 0012a000 103:01 275521 /home/ubuntu/ABY/build/bin/bench_operations 0072b000-0072c000 rw-p 0012b000 103:01 275521 /home/ubuntu/ABY/build/bin/bench_operations 0072c000-00734000 rw-p 00000000 00:00 0 01d96000-02776000 rw-p 00000000 00:00 0 [heap] 7f5558000000-7f5558021000 rw-p 00000000 00:00 0 7f5558021000-7f555c000000 ---p 00000000 00:00 0 7f5560000000-7f55604f1000 rw-p 00000000 00:00 0 7f55604f1000-7f5564000000 ---p 00000000 00:00 0 7f5564000000-7f5564021000 rw-p 00000000 00:00 0 7f5564021000-7f5568000000 ---p 00000000 00:00 0 7f5568000000-7f5568023000 rw-p 00000000 00:00 0 7f5568023000-7f556c000000 ---p 00000000 00:00 0 7f556d5fe000-7f556d5ff000 ---p 00000000 00:00 0 7f556d5ff000-7f556ddff000 rw-p 00000000 00:00 0 7f556ddff000-7f556de00000 ---p 00000000 00:00 0 7f556de00000-00400000-0052b000 r-xp 00000000 103:01 275521 /home/ubuntu/ABY/build/bin/bench_operations 0072a000-0072b000 r--p 0012a000 103:01 275521 /home/ubuntu/ABY/build/bin/bench_operations 0072b000-0072c000 rw-p 0012b000 103:01 275521 /home/ubuntu/ABY/build/bin/bench_operations 0072c000-00734000 rw-p 00000000 00:00 0 00cff000-016df000 rw-p 00000000 00:00 0 [heap] 7f5ae0000000-7f5ae0021000 rw-p 00000000 00:00 0 7f5ae0021000-7f5ae4000000 ---p 00000000 00:00 0 7f5ae8000000-7f5ae8021000 rw-p 00000000 00:00 0 7f5ae8021000-7f5aec000000 ---p 00000000 00:00 0 7f5aec000000-7f5aec4f1000 rw-p 00000000 00:00 0 7f5aec4f1000-7f5af0000000 ---p 00000000 00:00 0 7f5af0000000-7f5af0023000 rw-p 00000000 00:00 0 7f5af0023000-7f5af4000000 ---p 00000000 00:00 0 7f5af472f000-7f5af4730000 ---p 00000000 00:00 0 7f5af4730000-7f5af4f30000 rw-p 00000000 00:00 0 7f5af4f30000-7f5af4f31000 ---p 00000000 00:00 0 7f5af4f31000-7f5af5731000 rw-p 00000000 00:00 0 7f5af5731000-7f5af5732000 ---p 00000000 00:00 0 7f5af5732000-7f5af5f32000 rw-p 00000000 00:00 0 7f5af5f32000-7f5af5f33000 ---p 00000000 00:00 0 7f5af5f33000-7f5b079dc000 rw-p 00000000 00:00 0 7f5b079dc000-7f5b079dd000 ---p 00000000 00:00 0 7f5b079dd000-7f5b081dd000 rw-p 00000000 00:00 0 7f5b081dd000-7f5b081de000 ---p 00000000 00:00 0 7f5b081de000-7f5b089de000 rw-p 00000000 00:00 0 7f5b089de000-7f5b089df000 ---p 00000000 00:00 0 7f5b089df000-7f5b091df000 rw-p 00000000 00:00 0 7f5b091df000-7f5b091e0000 ---p 00000000 00:00 0 7f5b091e0000-7f5b099e0000 rw-p 00000000 00:00 0 7f5b099e0000-7f5b099e3000 r-xp 00000000 103:01 1996 /lib/x86_64-linux-gnu/libdl-2.23.so 7f5b099e3000-7f5b09be2000 ---p 00003000 103:01 1996 /lib/x86_64-linux-gnu/libdl-2.23.so 7f5b09be2000-7f5b09be3000 r--p 00002000 103:01 1996 /lib/x86_64-linux-gnu/libdl-2.23.so 7f5b09be3000-7f5b09be4000 rw-p 00003000 103:01 1996 /lib/x86_64-linux-gnu/libdl-2.23.so 7f5b09be4000-7f5b09da4000 r-xp 00000000 103:01 1994 /lib/x86_64-linux-gnu/libc-2.23.so 7f5b09da4000-7f5b09fa4000 ---p 001c0000 103:01 1994 /lib/x86_64-linux-gnu/libc-2.23.so 7f5b09fa4000-7f5b09fa8000 r--p 001c0000 103:01 1994 /lib/x86_64-linux-gnu/libc-2.23.so 7f5b09fa8000-7f5b09faa000 rw-p 001c4000 103:01 1994 /lib/x86_64-linux-gnu/libc-2.23.so 7f5b09faa000-7f5b09fae000 rw-p 00000000 00:00 0 7f5b09fae000-7f5b09fc4000 r-xp 00000000 103:01 1988 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f5b09fc4000-7f5b0a1c3000 ---p 00016000 103:01 1988 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f5b0a1c3000-7f5b0a1c4000 rw-p 00015000 103:01 1988 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f5b0a1c4000-7f5b0a2cc000 r-xp 00000000 103:01 1990 /lib/x86_64-linux-gnu/libm-2.23.so 7f5b0a2cc000-7f5b0a4cb000 ---p 00108000 103:01 1990 /lib/x86_64-linux-gnu/libm-2.23.so 7f5b0a4cb000-7f5b0a4cc000 r--p 00107000 103:01 1990 /lib/x86_64-linux-gnu/libm-2.23.so 7f5b0a4cc000-7f5b0a4cd000 rw-p 00108000 103:01 1990 /lib/x86_64-linux-gnu/libm-2.23.so 7f5b0a4cd000-7f5b0a63f000 r-xp 00000000 103:01 25867 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 7f5b0a63f000-7f5b0a83f000 ---p 00172000 103:01 25867 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 7f5b0a83f000-7f5b0a849000 r--p 00172000 103:01 25867 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 7f5b0a849000-7f5b0a84b000 rw-p 0017c000 103:01 25867 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 7f5b0a84b000-7f5b0a84f000 rw-p 00000000 00:00 0 7f5b0a84f000-7f5b0a867000 r-xp 00000000 103:01 1993 /lib/x86_64-linux-gnu/libpthread-2.23.so 7f5b0a867000-7f5b0aa66000 ---p 00018000 103:01 1993 /lib/x86_64-linux-gnu/libpthread-2.23.so 7f5b0aa66000-7f5b0aa67000 r--p 00017000 103:01 1993 /lib/x86_64-linux-gnu/libpthread-2.23.so 7f5b0aa67000-7f5b0aa68000 rw-p 00018000 103:01 1993 /lib/x86_64-linux-gnu/libpthread-2.23.so 7f5b0aa68000-7f5b0aa6c000 rw-p 00000000 00:00 0 7f5b0aa6c000-7f5b0aaeb000 r-xp 00000000 103:01 25891 /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.0 7f5b0aaeb000-7f5b0acea000 ---p 0007f000 103:01 25891 /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.0 7f5b0acea000-7f5b0aceb000 r--p 0007e000 103:01 25891 /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.0 7f5b0aceb000-7f5b0acec000 rw-p 0007f000 103:01 25891 /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.0 7f5b0acec000-7f5b0af07000 r-xp 00000000 103:01 8029 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 7f5b0af07000-7f5b0b106000 ---p 0021b000 103:01 8029 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 7f5b0b106000-7f5b0b122000 r--p 0021a000 103:01 8029 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 7f5b0b122000-7f5b0b12e000 rw-p 00236000 103:01 8029 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 7f5b0b12e000-7f5b0b131000 rw-p 00000000 00:00 0 7f5b0b131000-7f5b0b136000 r-xp 00000000 103:01 53084 /usr/lib/x86_64-linux-gnu/libgmpxx.so.4.5.0 7f5b0b136000-7f5b0b335000 ---p 00005000 103:01 53084 /usr/lib/x86_64-linux-gnu/libgmpxx.so.4.5.0 7f5b0b335000-7f5b0b336000 r--p 00004000 103:01 53084 /usr/lib/x86_64-linux-gnu/libgmpxx.so.4.5.0 7f5b0b336000-7f5b0b337000 rw-p 00005000 103:01 53084 /usr/lib/x86_64-linux-gnu/libgmpxx.so.4.5.0 7f5b0b337000-7f5b0b35d000 r-xp 00000000 103:01 1992 /lib/x86_64-linux-gnu/ld-2.23.so 7f5b0b549000-7f5b0b551000 rw-p 00000000 00:00 0 7f5b0b55b000-7f5b0b55c000 rw-p 00000000 00:00 0 7f5b0b55c000-7f5b0b55d000 r--p 00025000 103:01 1992 /lib/x86_64-linux-gnu/ld-2.23.so 7f5b0b55d000-7f5b0b55e000 rw-p 00026000 103:01 1992 /lib/x86_64-linux-gnu/ld-2.23.so 7f5b0b55e000-7f5b0b55f000 rw-p 00000000 00:00 0 7ffc8144b000-7ffc8146c000 rw-p 00000000 00:00 0 [stack] 7ffc815ee000-7ffc815f1000 r--p 00000000 00:00 0 [vvar] 7ffc815f1000-7ffc815f3000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] [1] Done ./bin/bench_operations -r 0 -o 25 Aborted (core dumped)

ryandeng1 commented 5 years ago

I narrowed down the issue to the setup phase, particularly line 206 of abysetup.cpp. I'm not sure why this part causes the error? Could it be related to the multi-threading?

dd23 commented 5 years ago

I have found several problems with the Paillier (DJN) and DGK code and I'm currently working on fixing those. I will push the fixes within the next few days.

dd23 commented 5 years ago

This should be fixed with 423565abdcf54583bc14d5932992e459e810ab87. Please have a look at the new code and if this works for you, please close this issue.