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

Possible access to freed stack memory in __kmpc_omp_wait_deps #49067

Closed
jprotze opened this issue Mar 25, 2021 · 5 comments
Closed

Possible access to freed stack memory in __kmpc_omp_wait_deps #49067

jprotze opened this issue Mar 25, 2021 · 5 comments
Labels
bugzilla Issues migrated from bugzilla openmp

Comments

@jprotze
Copy link
Collaborator

jprotze commented Mar 25, 2021

Bugzilla Link 49723
Resolution FIXED
Resolved on Oct 11, 2021 20:29
Version unspecified
OS Linux
Blocks #51489
CC @AndreyChurbanov,@jpeyton52,@modiking,@jprotze
Fixed by commit(s) 8e29b4b 2792379

Extended Description

As reported in https://reviews.llvm.org/D96893, the test
openmp/runtime/test/ompt/tasks/task_if0-depend.c leads to an assertion, when the runtime is built in debug mode (the test triggers a KMP_DEBUG_ASSERT).

Adding KMP_ASSERT(node.dn.nrefs==1); at the end of the __kmpc_omp_wait_deps function reveals, that some depnodes still have references to the depnode representing the task if0 dependency node. These depnodes will try to release the stack-allocated depnode object, after it was destroyed by returning from __kmpc_omp_wait_deps.

It might be necessary to replace the stack allocation by heap allocation.

@AndreyChurbanov
Copy link
Collaborator

Better fix would be to not put stack-allocated node into dep hash, so that no references remained once the dependency is satisfied. Once this is barrier-like action, the node is not needed after the __kmpc_omp_wait_deps call.

@AndreyChurbanov
Copy link
Collaborator

Should be fixed by commit 8e29b4b.

@jprotze
Copy link
Collaborator Author

jprotze commented Aug 4, 2021

Thanks for fixing this issue!

I suggest that we backport this patch into release/13

@tstellar
Copy link
Collaborator

tstellar commented Aug 5, 2021

Merged: 2792379

@tstellar
Copy link
Collaborator

mentioned in issue #51489

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla openmp
Projects
None yet
Development

No branches or pull requests

3 participants