https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87140

            Bug ID: 87140
           Summary: Segmentation fault in priority_list_upgrade_task
                    function when execution tasks with priority
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: silvestri at diag dot uniroma1.it
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Created attachment 44622
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44622&action=edit
Program to test BUG FIX

Hello,

in GOMP_taskwait function within task.c at line 1352, the following code leads
to SIGSEV when executing tasks with priority:

struct gomp_task *next_task = priority_queue_next_task (PQ_CHILDREN,
&task->children_queue, PQ_TEAM, &team->task_queue, &child_q);

This is possible because priority_queue_next_task function may return a
non-child task instead of a child task every time both team queue and children
queue return GOMP_TASK_WAITING tasks, and the non-child task has greater
priority value. Since it's impossible to rearrange a non-child task order in
children queue, the segmentation fault occurs in priority_list_upgrade_task
funtion.

The libgomp implementation uses TIED tasks by default and the aforementioned
behaviour leads also to violate TSC2.

The proposed fix is the following:

struct gomp_task *next_task = priority_queue_next_task (PQ_CHILDREN,
&task->children_queue, PQ_IGNORED, NULL, &child_q);

In the attachment a program to test libgomp before and after the proposed fix.

Reply via email to