Depsgraph use-after-free after scene switching undo #89196
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#89196
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Linux-5.11.0-7614-generic-x86_64-with-glibc2.32 64 Bits
Graphics card: Radeon Vega Frontier Edition (VEGA10, DRM 3.40.0, 5.11.0-7614-generic, LLVM 11.0.0) AMD 4.6 (Core Profile) Mesa 21.0.0
Blender Version
Broken: version: 3.0.0 Alpha
Short description of error
The
deg_graph_on_visible_update()
triggered by a scene change may access a master collection viaIDNode.id_orig
that was freed.Exact steps for others to reproduce the error
The attached .blend was prepared with the following steps:
T89196_depsgraph_scene_switch_undo_crash.blend
With the attached file:
ASan output: {P2182 lines=14}
Setting a breakpoint in
deg_graph_on_visible_update()
, I see that:IDNode.id_orig
of the iterated ID is indeed freed.IDNode.id_cow
has a name of "GRMaster Collection"So it seems the original ID pointer in the master collection (an "embedded ID") node is not updated when the scene is freed on undo.
Added subscriber: @JulianEisel
Added subscriber: @Sergey
Will have a look in a bit unless someone else does it :)
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @JacquesLucke
I was looking into this a little bit and found that the following (wrong) patch would fix it. Maybe that helps someone.
I am not that much sure it is wrong even. In many usages usages (including the most important one in the even loop) the relations are updated prior to
DEG_graph_on_visible_update()
. Knowing relations are up-to-date does simplify a lot of things, probably without actual slowdown even.Not only from the use-after-free usecase, if the object is removed from DEG and DEG becomes visible, there is no need to tag that ID.
One thing I wanted to try is to convert
DEG_graph_on_visible_update
to the tagging flag. As in, tag depsgraph "please tag IDs as if the DEG became visible, whenever it is convenient for you". Then we can ensure valid access and order of things during DEG evaluation and do as following:This issue was referenced by
956c539e59
Changed status from 'Confirmed' to: 'Resolved'