[llvm-bugs] [Bug 49723] New: Possible access to freed stack memory in __kmpc_omp_wait_deps

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 25 04:34:18 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49723

            Bug ID: 49723
           Summary: Possible access to freed stack memory in
                    __kmpc_omp_wait_deps
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Runtime Library
          Assignee: unassignedbugs at nondot.org
          Reporter: protze at itc.rwth-aachen.de
                CC: llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210325/168bb01d/attachment.html>


More information about the llvm-bugs mailing list