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

Data Race in x86/x64 pointer to function CPU dispatching #39

Open
Nick-Kooij opened this issue Sep 11, 2022 · 0 comments
Open

Data Race in x86/x64 pointer to function CPU dispatching #39

Nick-Kooij opened this issue Sep 11, 2022 · 0 comments

Comments

@Nick-Kooij
Copy link

There is a data race in blake2-dispatch.c x86/x64 pointer to function CPU dispatching.

Internal calls are made through function pointers to functions that initially point to corresponding dispatch function that detects the CPU features available and updates the corresponding pointer to function.

For example blake2b_init_ptr initially points to blake2b_init_dispatch. The data race is the blake2b_init_ptr pointer update:

int blake2b_init_dispatch( blake2b_state *S, size_t outlen )
{
  /* data race, non-atomic write to blake2b_init_ptr */
  blake2b_init_ptr = blake2b_init_table[get_cpu_features()]; /*
  return blake2b_init_ptr( S, outlen );
}

All *_dispatch functions are likewise affected:

  • blake2b_init_dispatch
  • blake2b_init_key_dispatch
  • blake2b_init_param_dispatch
  • blake2b_update_dispatch
  • blake2b_final_dispatch
  • blake2b_dispatch
  • blake2s_init_dispatch
  • blake2s_init_key_dispatch
  • blake2s_init_param_dispatch
  • blake2s_update_dispatch
  • blake2s_final_dispatch
  • blake2s_dispatch
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

1 participant