Skip to content

[OpenMP] Fixup bugs found during fuzz testing #143455

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jpeyton52
Copy link
Contributor

A lot of these only trip when using sanitizers with the library.

  • Insert forgotten free()s
  • Change (-1) << amount to 0xffffffffu as left shifting a negative is UB
  • Fixup integer parser to return INT_MAX when parsing huge string of digits. e.g., 452523423423423423 returns INT_MAX
  • Fixup range parsing for affinity mask so integer overflow does not occur
  • Don't assert when branch bits are 0, instead warn user that is invalid and use the default value.
  • Fixup kmp_set_defaults() so the C version only uses null terminated strings and the Fortran version uses the string + size version.
  • Make sure the KMP_ALIGN_ALLOC is power of two, otherwise use CACHE_LINE.
  • Disallow ability to set KMP_TASKING=1 (task barrier) this doesn't work and hasn't worked for a long time.
  • Limit KMP_HOT_TEAMS_MAX_LEVEL to 1024, an array is allocated based on this value.
  • Remove integer values for OMP_PROC_BIND. The specification only allows strings and CSV of strings.
  • Fix setting KMP_AFFINITY=disabled + OMP_DISPLAY_AFFINITY=TRUE

A lot of these only trip when using sanitizers with the library.

* Insert forgotten free()s
* Change (-1) << amount to 0xffffffffu as left shifting a negative is UB
* Fixup integer parser to return INT_MAX when parsing huge string of
  digits. e.g., 452523423423423423 returns INT_MAX.
* Fixup range parsing for affinity mask so integer overflow does not
  occur
* Don't assert when branch bits are 0, instead warn user that is invalid
  and use the default value.
* Fixup kmp_set_defaults() so the C version only uses null terminated
  strings and the Fortran version uses the string + size version.
* Make sure the KMP_ALIGN_ALLOC is power of two, otherwise use
  CACHE_LINE.
* Disallow ability to set KMP_TASKING=1 (task barrier) this doesn't work and
  hasn't worked for a long time.
* Limit KMP_HOT_TEAMS_MAX_LEVEL to 1024, an array is allocated based on
  this value.
* Remove integer values for OMP_PROC_BIND. The specification only allows
  strings and CSV of strings.
* Fix setting KMP_AFFINITY=disabled + OMP_DISPLAY_AFFINITY=TRUE
@jpeyton52 jpeyton52 requested a review from TerryLWilmarth June 9, 2025 22:59
@llvmbot llvmbot added the openmp:libomp OpenMP host runtime label Jun 9, 2025
Copy link

github-actions bot commented Jun 9, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openmp:libomp OpenMP host runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants