-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Arc::drop has a (potentially) dangling shared ref #55005
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-mediumMedium priorityMedium priorityT-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.WG-embeddedWorking group: Embedded systemsWorking group: Embedded systems
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-mediumMedium priorityMedium priorityT-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.WG-embeddedWorking group: Embedded systemsWorking group: Embedded systems
Type
Fields
Give feedbackNo fields configured for issues without a type.
Discovered by @Amanieu on IRLO. Quoting their report:
Arc::dropcontains this code:Once the current thread (Thread A) has decremented the reference count, Thread B could come in and free the
ArcInner.The problem becomes apparent when you look at the implementation of
fetch_sub:Note the point marked HERE: at this point we have released our claim to the
Arc(as in, decremented the count), which means that Thread B might have freed theArcInner. However the&selfstill points to the strong reference count in theArcInner-- so&selfdangles.Other instances of this: