The alignment in some of the aligned_alloc calls is incorrect. For example, on the following line:
|
bucket_empty_status = (bool*)(aligned_alloc(64, num_threads * num_buckets * sizeof(bool))); |
The first argument is alignment = 64 and num_buckets = 16. So when we're not using multi-threading, the second argument is size = 1 * 16 * 1 = 16. This error can only be triggered if ASAN is enabled.
=================================================================
==666590==ERROR: AddressSanitizer: invalid alignment requested in aligned_alloc: 64, alignment must be a power of two and the requested size 0x20 must be a multiple of alignment (thread T0)
#0 0x561277be50d2 in __interceptor_aligned_alloc (/mnt/user-data/suyash/projects/barretenberg/cpp/build/bin/examples_tests+0xe40d2) (BuildId: 9b00bdd4e2e236c81e9abacc0232acbc5968721e)
#1 0x56127842cdcb in barretenberg::scalar_multiplication::pippenger_runtime_state::pippenger_runtime_state(unsigned long) (/mnt/user-data/suyash/projects/barretenberg/cpp/build/bin/examples_tests+0x92bdcb) (BuildId: 9b00bdd4e2e236c81e9abacc0232acbc5968721e)
==666590==HINT: if you don't care about these errors you may set allocator_may_return_null=1
SUMMARY: AddressSanitizer: invalid-aligned-alloc-alignment (/mnt/user-data/suyash/projects/barretenberg/cpp/build/bin/examples_tests+0xe40d2) (BuildId: 9b00bdd4e2e236c81e9abacc0232acbc5968721e) in __interceptor_aligned_alloc
==666590==ABORTING
We should check if such issues also occur elsewhere in the code and make sure we don't have any memory related problems in barretenberg.
The alignment in some of the
aligned_alloccalls is incorrect. For example, on the following line:barretenberg/cpp/src/barretenberg/ecc/curves/bn254/scalar_multiplication/runtime_states.cpp
Line 39 in 6ef5df5
The first argument is
alignment = 64andnum_buckets = 16. So when we're not using multi-threading, the second argument issize = 1 * 16 * 1 = 16. This error can only be triggered if ASAN is enabled.We should check if such issues also occur elsewhere in the code and make sure we don't have any memory related problems in barretenberg.