UBSan: several runtime errors at launch. #81340
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
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#81340
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: Darwin-18.7.0-x86_64-i386-64bit 64 Bits
Graphics card: Intel(R) HD Graphics 6000 Intel Inc. 4.1 INTEL-12.10.12
Blender Version
Broken: version: 2.91.0 Alpha, branch: ubsan (modified), commit date: 2020-09-29 19:46, hash:
c1cdde04e2
Worked: None. At least one file dates back to
0de103c1cd
Short description of error
A lot of warnings show up at launch with ASan (/UBSan) enabled. Sometimes, that even stops Blender from launching, even 6-7 times in a row if I have a bad day.
There are several more to come in tests, but these (and #81100) affect startup.
#define MEMNEXT(x) ((MemHead *)(((char *)x) - ((char *)&(((MemHead *)0)->next))))
olddata += len;
.#define BHEADN_FROM_BHEAD(bh) ((BHeadN *)POINTER_OFFSET(bh, -offsetof(BHeadN, bhead)))
static_cast<_enum_type>(~static_cast<int>(a));
~
operator creates values outside the enum's underlying type.(IDRecalcFlag)(1 << bitscan_forward_clear_i(¤t_flag));
withcurrent_flag
negativeconst GLvoid *pointer = (const GLubyte *)0 + offset + v_first * stride;
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @ankitm
Added subscriber: @ideasman42
Note that I don't think we want to consider all of these bugs to fix, at least not at the moment as making changes needs to be done carefully. If this is only to quiet UBSan and doesn't lead to solving any underlying errors in the code it isn't so valuable to focus on.
D9063 for example is harmless, D9064 on the other hand looks like it's causing unintended run-time behavior.
It's possible that in the future we manage to suppress all UBSan warnings (as we do with compiler warnings - Linux/GCC at least).
But for now I don't consider many of these issues worth worrying about.
Suggest to first focus on issues of this report that lead to incorrect behavior, and are likely to lead to bugs in the future.
This issue was referenced by
63c906e0a7
Changed status from 'Confirmed' to: 'Resolved'
This issue was referenced by
a31a87f894
Changed status from 'Resolved' to: 'Confirmed'
Added subscriber: @Sergey
@Sergey This report is now reduced to
IDRecalcFlag
related warnings. If it's not a bug, we can close it.Is it signess issue? Will
1u << bitscan_forward_clear_i(...)
+ makingcurrent_flag
unsigned resolve the error?output of
std::bitset<32>(tag)
is the same in master, and with the changes you mentioned.Is my understanding correct, that the error happens because cast attempts to convert int-value to
IDRecalcFlag
and the value does not exist in any of the enumerator items?What is the value passed to the "bogous" call of
graph_id_tag_update()
? Do you have stack-trace? Preferably with exact argument and values used in the code (to be able to see if some "bogous" value is hardcoded or is a result of some calculation).Hope you're fine with such remote debugging thing. I just don't currently have a way to repro the sanitization myself, so need so extra pointers to do deduction based on reading the code :)
yes
Oh I forgot to print that in the output in my last comment.
I had added some info in D9064 . I'll get the stack-trace and values while you give that a read.
yeah totally!
To get more insight, set a conditional breakpoint here that fires if flag < 0.
id_orig->name
is "SCScene" (never touched this code, so don't know what else to mention)id_orig->recalc
and thus flag is -8392829In the next step, we go to
Soon,
int current_flag = flag;
is reached, and flag is (-8392829)10, 0b11111111011111111110111110000011The output of print statements in the while loop [1]:
Next time onwards, flag is 8195, 8194, or 8192
[1]
ID_RECALC_ALL
and some bits cleared explicitly.Can you try to replace
ID_RECALC_ALL = ~(0)
withID_RECALC_ALL = ((1 << 25) - 1)
?That fixes it.
Ok, good!
After spending some time trying to make it less fragile solution, it seems to be most reliable to remove
ID_RECALC_ALL
. It is only couple of places where it requiers some brain cells, the rest seems to be straightforward. I'll start moving towards that direction.Added subscriber: @oweissbarth
Added subscriber: @brecht
Changed status from 'Confirmed' to: 'Resolved'
With D15602: Fix undefined behavior in dependency graph tagging I believe everything mentioned in this task was solved.