Crash on launch: AddressSanitizer: SEGV on unknown address #81100

Closed
opened 2020-09-23 18:22:26 +02:00 by Ankit Meel · 7 comments
Member

blender version : b3c6ab5084

Blender configuration: CC=clang CXX=clang++ cmake -DWITH_COMPILER_ASAN=ON -G Ninja -DCMAKE_BUILD_TYPE=Debug ../blender
(If you have ccache:-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache)

clang version 11.0.0 (https://github.com/llvm/llvm-project.git 3cdc85a5d4ff689a43d82532c5957f7868f3e93c)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Users/me/Applications/llvm-project-master/binstall/bin

Short description of error

AddressSanitizer:DEADLYSIGNAL
=================================================================
==62192==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000001 (pc 0x000139aed2a2 bp 0x7ffee39fd1c0 sp 0x7ffee39fccc0 T0)
==62192==The signal is caused by a READ memory access.
==62192==Hint: address points to the zero page.
    - 0 0x139aed2a1 in ccl::NodeType const* ccl::Background::register_type<ccl::Background>() background.cpp
    - 1 0x139aee74c in __cxx_global_var_init background.cpp:31
    - 2 0x139aee7b4 in _GLOBAL__sub_I_background.cpp background.cpp
    - 3 0x184ef1591 in ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (dyld:x86_64+0x18591)
    - 4 0x184ef1797 in ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (dyld:x86_64+0x18797)
    - 5 0x184eecbe9 in ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (dyld:x86_64+0x13be9)
    - 6 0x184eebd72 in ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (dyld:x86_64+0x12d72)
    - 7 0x184eebe04 in ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (dyld:x86_64+0x12e04)
    - 8 0x184edb764 in dyld::initializeMainExecutable() (dyld:x86_64+0x2764)
    - 9 0x184ee0708 in dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) (dyld:x86_64+0x7708)
    - 10 0x184eda502 in dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) (dyld:x86_64+0x1502)
    - 11 0x184eda035 in _dyld_start (dyld:x86_64+0x1035)

==62192==Register values:
rax = 0x00000001793fd880  rbx = 0x00007ffee39fcf60  rcx = 0x0000000000000001  rdx = 0x0000000000000001  
rdi = 0x00007ffee39fca71  rsi = 0x0000000000000000  rbp = 0x00007ffee39fd1c0  rsp = 0x00007ffee39fccc0  
 r8 = 0x00007ffee39fcd00   r9 = 0x0000602000004078  r10 = 0x00001fffdc73f8ff  r11 = 0xffffffffffffff50  
r12 = 0x00007ffee39fcdc0  r13 = 0x00007ffee39fcde0  r14 = 0x00007ffee39fcd80  r15 = 0x00007ffee39fcda0  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV background.cpp in ccl::NodeType const* ccl::Background::register_type<ccl::Background>()
==62192==ABORTING
Abort trap: 6

Seems to be coming from the following macro, CHECK_TYPE(((T *)1)->name, datatype); \

#define SOCKET_DEFINE(name, ui_name, default_value, datatype, TYPE, flags, ...) \
  { \
    static datatype defval = default_value; \
    CHECK_TYPE(((T *)1)->name, datatype); \
    type->register_input(ustring(#name), \
                         ustring(ui_name), \
                         TYPE, \
                         SOCKET_OFFSETOF(T, name), \
                         &defval, \
                         NULL, \
                         NULL, \
                         flags, \
                         ##__VA_ARGS__); \
  }
blender version : b3c6ab5084 Blender configuration: `CC=clang CXX=clang++ cmake -DWITH_COMPILER_ASAN=ON -G Ninja -DCMAKE_BUILD_TYPE=Debug ../blender` (If you have ccache:`-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache`) clang version 11.0.0 (https://github.com/llvm/llvm-project.git 3cdc85a5d4ff689a43d82532c5957f7868f3e93c) Target: x86_64-apple-darwin18.7.0 Thread model: posix InstalledDir: /Users/me/Applications/llvm-project-master/binstall/bin **Short description of error** ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==62192==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000001 (pc 0x000139aed2a2 bp 0x7ffee39fd1c0 sp 0x7ffee39fccc0 T0) ==62192==The signal is caused by a READ memory access. ==62192==Hint: address points to the zero page. - 0 0x139aed2a1 in ccl::NodeType const* ccl::Background::register_type<ccl::Background>() background.cpp - 1 0x139aee74c in __cxx_global_var_init background.cpp:31 - 2 0x139aee7b4 in _GLOBAL__sub_I_background.cpp background.cpp - 3 0x184ef1591 in ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (dyld:x86_64+0x18591) - 4 0x184ef1797 in ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (dyld:x86_64+0x18797) - 5 0x184eecbe9 in ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (dyld:x86_64+0x13be9) - 6 0x184eebd72 in ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (dyld:x86_64+0x12d72) - 7 0x184eebe04 in ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (dyld:x86_64+0x12e04) - 8 0x184edb764 in dyld::initializeMainExecutable() (dyld:x86_64+0x2764) - 9 0x184ee0708 in dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) (dyld:x86_64+0x7708) - 10 0x184eda502 in dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) (dyld:x86_64+0x1502) - 11 0x184eda035 in _dyld_start (dyld:x86_64+0x1035) ==62192==Register values: rax = 0x00000001793fd880 rbx = 0x00007ffee39fcf60 rcx = 0x0000000000000001 rdx = 0x0000000000000001 rdi = 0x00007ffee39fca71 rsi = 0x0000000000000000 rbp = 0x00007ffee39fd1c0 rsp = 0x00007ffee39fccc0 r8 = 0x00007ffee39fcd00 r9 = 0x0000602000004078 r10 = 0x00001fffdc73f8ff r11 = 0xffffffffffffff50 r12 = 0x00007ffee39fcdc0 r13 = 0x00007ffee39fcde0 r14 = 0x00007ffee39fcd80 r15 = 0x00007ffee39fcda0 AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV background.cpp in ccl::NodeType const* ccl::Background::register_type<ccl::Background>() ==62192==ABORTING Abort trap: 6 ``` Seems to be coming from the following macro, `CHECK_TYPE(((T *)1)->name, datatype); \` ``` #define SOCKET_DEFINE(name, ui_name, default_value, datatype, TYPE, flags, ...) \ { \ static datatype defval = default_value; \ CHECK_TYPE(((T *)1)->name, datatype); \ type->register_input(ustring(#name), \ ustring(ui_name), \ TYPE, \ SOCKET_OFFSETOF(T, name), \ &defval, \ NULL, \ NULL, \ flags, \ ##__VA_ARGS__); \ } ```
Author
Member

Added subscriber: @ankitm

Added subscriber: @ankitm
Author
Member
CHECK_TYPE(T::name, datatype);

fixes one point of crash.

The next one comes from

#define SOCKET_OFFSETOF(T, name) (((char *)&(((T *)1)->name)) - (char *)1)

A lot of code depends on struct_offset so it's not a straightforward change I guess.
offsetof gave different offset than the above macro.

I tried removing the dependency on the offset by using a std::map (P1662) but all the RenderGraph tests failed : P1663

Suppressing errors in compiled code is difficult:

  • using blacklist changes compiler flags every time the blacklist file changes, so that forces a rebuild of whole Blender for one piece of code.
  • Or one has to litter the code with __attribute__((no_sanitize("address"))). Would it even work on templates ?
``` CHECK_TYPE(T::name, datatype); ``` fixes one point of crash. The next one comes from ``` #define SOCKET_OFFSETOF(T, name) (((char *)&(((T *)1)->name)) - (char *)1) ``` A lot of code depends on `struct_offset` so it's not a straightforward change I guess. [offsetof](https://en.cppreference.com/w/cpp/types/offsetof) gave different offset than the above macro. I tried removing the dependency on the offset by using a `std::map` ([P1662](https://archive.blender.org/developer/P1662.txt)) but all the RenderGraph tests failed : [P1663](https://archive.blender.org/developer/P1663.txt) Suppressing errors in compiled code is difficult: - using blacklist changes compiler flags every time the blacklist file changes, so that forces a rebuild of whole Blender for one piece of code. - Or one has to litter the code with `__attribute__((no_sanitize("address")))`. Would it even work on templates ?
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Ankit Meel self-assigned this 2020-09-23 23:00:35 +02:00
Ankit Meel removed their assignment 2020-09-28 17:41:18 +02:00
Author
Member

I tried removing the dependency on the offset by using a std::map (P1662) but all the RenderGraph tests failed : P1663

Those tests (and all of the rest in cycles_test) now pass (P1664) with the patch D9042.
Running python tests now.

> I tried removing the dependency on the offset by using a std::map ([P1662](https://archive.blender.org/developer/P1662.txt)) but all the RenderGraph tests failed : [P1663](https://archive.blender.org/developer/P1663.txt) Those tests (and all of the rest in `cycles_test`) now pass ([P1664](https://archive.blender.org/developer/P1664.txt)) with the patch [D9042](https://archive.blender.org/developer/D9042). Running python tests now.

This issue was referenced by blender/cycles@473e28d134

This issue was referenced by blender/cycles@473e28d134fd9913db0a28659dbcdda1e6ea4e9b

This issue was referenced by c1cdde04e2

This issue was referenced by c1cdde04e270598d4a3973d85ac98d30cc86937e
Author
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Ankit Meel self-assigned this 2020-09-29 21:47:09 +02:00
Sign in to join this conversation.
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
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#81100
No description provided.