You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the argument to the -b flag is set to 25 or higher, it works without any problems.
Compiling with CFLAGS=-g and calling the crashing process with valgrind indicates memory errors in the hashElement and test_phasing_circuit functions:
bin/psi_phasing.exe -r 0 -n 100 -b 24 & valgrind bin/psi_phasing.exe -r 1 -n 100 -b 24
[1] 19652
==19653== Memcheck, a memory error detector
==19653== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==19653== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==19653== Command: bin/psi_phasing.exe -r 1 -n 100 -b 24
==19653==
==19653== Warning: set address range perms: large range [0x903a040, 0x1a2e2840) (defined)
==19653== Thread 10:
==19653== Invalid write of size 4
==19653== at 0x4192E0: hashElement (hashing_util.h:182)
==19653== by 0x4192E0: insert_element (simple_hashing.cpp:129)
==19653== by 0x4192E0: gen_entries(void*) (simple_hashing.cpp:119)
==19653== by 0x52D82E6: start_thread (in /usr/lib/libpthread-2.25.so)
==19653== by 0x677A54E: clone (in /usr/lib/libc-2.25.so)
==19653== Address 0x1cebfbc0 is 0 bytes inside a block of size 3 alloc'd
==19653== at 0x4C2CF35: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19653== by 0x4191F7: gen_entries(void*) (simple_hashing.cpp:114)
==19653== by 0x52D82E6: start_thread (in /usr/lib/libpthread-2.25.so)
==19653== by 0x677A54E: clone (in /usr/lib/libc-2.25.so)
==19653==
==19653== Invalid write of size 4
==19653== at 0x419F6D: hashElement (hashing_util.h:182)
==19653== by 0x419F6D: gen_cuckoo_entry (cuckoo.cpp:189)
==19653== by 0x419F6D: gen_cuckoo_entries(void*) (cuckoo.cpp:174)
==19653== by 0x52D82E6: start_thread (in /usr/lib/libpthread-2.25.so)
==19653== by 0x677A54E: clone (in /usr/lib/libc-2.25.so)
==19653== Address 0x1d2b0080 is 0 bytes inside a block of size 3 alloc'd
==19653== at 0x4C2CF35: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19653== by 0x419ED2: gen_cuckoo_entry (cuckoo.cpp:187)
==19653== by 0x419ED2: gen_cuckoo_entries(void*) (cuckoo.cpp:174)
==19653== by 0x52D82E6: start_thread (in /usr/lib/libpthread-2.25.so)
==19653== by 0x677A54E: clone (in /usr/lib/libc-2.25.so)
==19653==
==19653== Thread 1:
==19653== Invalid read of size 4
==19653== at 0x4183DC: test_phasing_circuit(e_role, char*, unsigned short, SECURITYLEVELS, unsigned int, unsigned int, unsigned int, double, unsigned int, e_mt_gen_alg, e_sharing, int, unsigned int, unsigned int) (phasing_circuit.cpp:126)
==19653== by 0x405AD1: main (psi_phasing.cpp:110)
==19653== Address 0x1d2e0434 is 0 bytes after a block of size 36 alloc'd
==19653== at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19653== by 0x41A564: cuckoo_hashing(unsigned char*, unsigned int, unsigned int, unsigned int, unsigned int*, unsigned int*, unsigned int*, unsigned int, unsigned char**, unsigned int, unsigned int**, unsigned int, prf_state_ctx*) (cuckoo.cpp:128)
==19653== by 0x417604: ClientHashingRoutine(unsigned char*, unsigned int, unsigned int, unsigned int, unsigned char**, unsigned int*, unsigned int*, unsigned char**, unsigned int, unsigned int**, unsigned int, crypto*, unsigned int) (phasing_circuit.cpp:364)
==19653== by 0x418110: test_phasing_circuit(e_role, char*, unsigned short, SECURITYLEVELS, unsigned int, unsigned int, unsigned int, double, unsigned int, e_mt_gen_alg, e_sharing, int, unsigned int, unsigned int) (phasing_circuit.cpp:83)
==19653== by 0x405AD1: main (psi_phasing.cpp:110)
==19653==
psi_phasing.exe: common/phasing_circuit.cpp:187: int32_t test_phasing_circuit(e_role, char*, uint16_t, seclvl, uint32_t, uint32_t, uint32_t, double, uint32_t, e_mt_gen_alg, e_sharing, int, uint32_t, uint32_t): Assertion `circ_inter_ctr == ver_inter_ctr' failed.
==19653==
==19653== Process terminating with default action of signal 6 (SIGABRT): dumping core
==19653== at 0x66C1A10: raise (in /usr/lib/libc-2.25.so)
==19653== by 0x66C3139: abort (in /usr/lib/libc-2.25.so)
==19653== by 0x66BA606: __assert_fail_base (in /usr/lib/libc-2.25.so)
==19653== by 0x66BA6B1: __assert_fail (in /usr/lib/libc-2.25.so)
==19653== by 0x418CEC: test_phasing_circuit(e_role, char*, unsigned short, SECURITYLEVELS, unsigned int, unsigned int, unsigned int, double, unsigned int, e_mt_gen_alg, e_sharing, int, unsigned int, unsigned int) (phasing_circuit.cpp:187)
==19653== by 0x405AD1: main (psi_phasing.cpp:110)
==19653==
==19653== HEAP SUMMARY:
==19653== in use at exit: 289,114,248 bytes in 5,558 blocks
==19653== total heap usage: 44,972 allocs, 39,414 frees, 314,858,330 bytes allocated
==19653==
==19653== LEAK SUMMARY:
==19653== definitely lost: 35,264 bytes in 323 blocks
==19653== indirectly lost: 3,576 bytes in 322 blocks
==19653== possibly lost: 2,304 bytes in 8 blocks
==19653== still reachable: 289,073,104 bytes in 4,905 blocks
==19653== suppressed: 0 bytes in 0 blocks
==19653== Rerun with --leak-check=full to see details of leaked memory
==19653==
==19653== For counts of detected and suppressed errors, rerun with: -v
==19653== ERROR SUMMARY: 203 errors from 3 contexts (suppressed: 0 from 0)
[2] 19653 abort (core dumped) valgrind bin/psi_phasing.exe -r 1 -n 100 -b 24
The last error is probably caused by the stash elements being read in 32-bit words, while they are only allocated using the number of bytes actually needed in cuckoo.cpp:128.
Reading and writing hashed elements byte-wise might fix this, however, I haven't managed to find all the places that would need to be changed.
The text was updated successfully, but these errors were encountered:
The example
psi_phasing.exe
crashes when used with bit-lengths that can be represented in less than 4 bytes. For example, callinggives the following error:
If the argument to the
-b
flag is set to 25 or higher, it works without any problems.Compiling with
CFLAGS=-g
and calling the crashing process with valgrind indicates memory errors in thehashElement
andtest_phasing_circuit
functions:The last error is probably caused by the stash elements being read in 32-bit words, while they are only allocated using the number of bytes actually needed in
cuckoo.cpp:128
.Reading and writing hashed elements byte-wise might fix this, however, I haven't managed to find all the places that would need to be changed.
The text was updated successfully, but these errors were encountered: