[Bug sanitizer/88400] New: address-sanitizer on the cpu with only one core, may deadlock

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/88400] New: address-sanitizer on the cpu with only one core, may deadlock

kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88400

            Bug ID: 88400
           Summary: address-sanitizer on the cpu with only one core, may
                    deadlock
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: He.Hongjun at zte dot com.cn
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

using address-sanitizer on the cpu with only one core or binding one core,
pthread_create will be deadlock when we create real-time thread.
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/88400] address-sanitizer on the cpu with only one core, may deadlock

kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88400

hhj <He.Hongjun at zte dot com.cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |He.Hongjun at zte dot com.cn

--- Comment #1 from hhj <He.Hongjun at zte dot com.cn> ---
Created attachment 45177
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45177&action=edit
create real-time thread on the cpu with only one core.
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/88400] address-sanitizer on the cpu with only one core, may deadlock

kargl at gcc dot gnu.org
In reply to this post by kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88400

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Please provide a testcase to reproduce the issue.  Also note that GCC 6 is no
longer supported.  This sounds like an issue in the libsanitizer interceptor
to me, the pthread_create interceptor does

    // Wait until the AsanThread object is initialized and the ThreadRegistry
    // entry is in "started" state. One reason for this is that after this
    // interceptor exits, the child thread's stack may be the only thing
holding
    // the |arg| pointer. This may cause LSan to report a leak if leak checking
    // happens at a point when the interceptor has already exited, but the
stack
    // range for the child thread is not yet known.
    while (atomic_load(&param.is_registered, memory_order_acquire) == 0)
      internal_sched_yield();

but sched_yield should allow other threads to do progress.  That might not
work if the current thread is realtime of course.  But isn't that a
user error (or a kernel bug when explicitely yield()ing)?
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/88400] address-sanitizer on the cpu with only one core, may deadlock

kargl at gcc dot gnu.org
In reply to this post by kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88400

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Also this seems like it is an upstream issue too.
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/88400] address-sanitizer on the cpu with only one core, may deadlock

kargl at gcc dot gnu.org
In reply to this post by kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88400

--- Comment #4 from hhj <He.Hongjun at zte dot com.cn> ---
(In reply to Andrew Pinski from comment #3)
> Also this seems like it is an upstream issue too.

This is how we handle it.
When the parent's sched_priority isn't sam as the children's
  1 If the parent's sched_priority is greater than the children's, raising the
children's sched_priority. After register children, restore the children's
sched_priority.
  2 If children's sched_priority is greater than the parent's, raising the
parent's sched_priority. After register children, restore the parent's
sched_priority.