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
Keccak_(X4_)DispatchInitialize_ptr assignment is thread unsafe due to race condition. Keccak_Dispatch in xkcp_sha3.c and Keccak_X4_Dispatch in xkcp_sha3x4.c.
Example execution:
Thread 0 executes Keccak_X4_Dispatch until and including this line, setting Keccak_X4_Initialize_ptr = &KeccakP1600times4_InitializeAll_avx2;. Pauses here for the rest of this example.
Keccak_(X4_)Dispatch
Initialize_ptr
assignment is thread unsafe due to race condition.Keccak_Dispatch
in xkcp_sha3.c andKeccak_X4_Dispatch
in xkcp_sha3x4.c.Example execution:
Keccak_X4_Initialize_ptr = &KeccakP1600times4_InitializeAll_avx2;
. Pauses here for the rest of this example.gen_matrix()
->shake128x4_inc_init()
->keccak_x4_inc_reset()
->(*Keccak_X4_Initialize_ptr)()
.Keccak_X4_Initialize_ptr
is&KeccakP1600times4_InitializeAll_avx2
, which justmemset
s without issue and returns.gen_matrix()
, next line is to callshake128x4_absorb_once()
->shake128x4_inc_absorb()
, which is a macro forOQS_SHA3_shake128_x4_inc_absorb
and a tail call forkeccak_x4_inc_absorb()
, which tries to call(*Keccak_X4_AddBytes_ptr)()
.Keccak_X4_AddBytes_ptr
is stillNULL
because Thread 0 paused before setting it! Hence, calls 0x0 and segfaults.Made a fix using
pthread_once
in #1549 but not cross-platform, open to other fixesEnvironment:
The text was updated successfully, but these errors were encountered: