https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84428

            Bug ID: 84428
           Summary: ==7122==AddressSanitizer CHECK failed:
                    ../../../sanitizer/asan/asan_interceptors.cc:384
                    "((__interception::real___cxa_throw)) != (0)" (0x0,
                    0x0)
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ezyang at mit dot edu
                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: ---

jenkins@37ecc4612171:~/pytorch$ gcc-7 --version
gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

When I run ASAN on my program, it trips this assert failure:

test_AdaptiveMaxPool1d_indices (__main__.TestNN) ... ==7122==AddressSanitizer
CHECK failed: ../../../../sanitizer/asan/asan_interceptors.cc:384
"((__interception::real___cxa_throw)) != (0)" (0x0, 0x0)
    #0 0x7f7f9a3edbc5  (/usr/lib/gcc/x86_64-linux-gnu/7/libasan.so+0xe4bc5)
    #1 0x7f7f9a40a8f5 in __sanitizer::CheckFailed(char const*, int, char
const*, unsigned long long, unsigned long long)
(/usr/lib/gcc/x86_64-linux-gnu/7/libasan.so+0x1018f5)
    #2 0x7f7f9a340e8c in __interceptor___cxa_throw
(/usr/lib/gcc/x86_64-linux-gnu/7/libasan.so+0x37e8c)
    #3 0x7f7f7b7e48cf in
torch::autograd::SavedVariable::unpack(std::shared_ptr<torch::autograd::Function>)
const torch/csrc/autograd/saved_variable.cpp:50
    #4 0x7f7f7bfeb75f in
torch::autograd::generated::AdaptiveMaxPool2DBackward::apply(std::vector<torch::autograd::Variable,
std::allocator<torch::autograd::Variable> > const&)
torch/csrc/autograd/generated/Functions.cpp:4096
    #5 0x7f7f7b7a5af6 in
torch::autograd::Function::operator()(std::vector<torch::autograd::Variable,
std::allocator<torch::autograd::Variable> >
const&)/var/lib/jenkins/pytorch/torch/csrc/autograd/function.h:93
    #6 0x7f7f7b7a5af6 in call_function torch/csrc/autograd/engine.cpp:235
    #7 0x7f7f7b7a5af6 in
torch::autograd::Engine::evaluate_function(torch::autograd::FunctionTask&)
torch/csrc/autograd/engine.cpp:254
    #8 0x7f7f7b7a93b6 in
torch::autograd::Engine::thread_main(torch::autograd::GraphTask*)
torch/csrc/autograd/engine.cpp:174
    #9 0x7f7f7b79919e in torch::autograd::Engine::thread_init(int)
torch/csrc/autograd/engine.cpp:150
    #10 0x7f7f7b84e505 in
torch::autograd::python::PythonEngine::thread_init(int)
torch/csrc/autograd/python_engine.cpp:34
    #11 0x7f7f7b7b412c in void std::__invoke_impl<void, void
(torch::autograd::Engine::*)(int), torch::autograd::Engine*,
int>(std::__invoke_memfun_deref, void (torch::autograd::Engine::*&&)(int),
torch::autograd::Engine*&&, int&&) /usr/include/c++/7/bits/invoke.h:73
    #12 0x7f7f7b7b412c in std::__invoke_result<void
(torch::autograd::Engine::*)(int), torch::autograd::Engine*, int>::type
std::__invoke<void(torch::autograd::Engine::*)(int), torch::autograd::Engine*,
int>(void (torch::autograd::Engine::*&&)(int), torch::autograd::Engine*&&,
int&&) /usr/include/c++/7/bits/invoke.h:95
    #13 0x7f7f7b7b412c in decltype (__invoke((_S_declval<0ul>)(),
(_S_declval<1ul>)(), (_S_declval<2ul>)()))
std::thread::_Invoker<std::tuple<void (torch::autograd::Engine::*)(int),
torch::autograd::Engine*, int> >::_M_invoke<0ul, 1ul,
2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /usr/include/c++/7/thread:234
    #14 0x7f7f7b7b412c in std::thread::_Invoker<std::tuple<void
(torch::autograd::Engine::*)(int), torch::autograd::Engine*, int>
>::operator()() /usr/include/c++/7/thread:243
    #15 0x7f7f7b7b412c in
std::thread::_State_impl<std::thread::_Invoker<std::tuple<void
(torch::autograd::Engine::*)(int), torch::autograd::Engine*, int> > >::_M_run()
/usr/include/c++/7/thread:186
    #16 0x7f7f919c821e  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x9121e)
    #17 0x7f7f99bb8183 in start_thread
(/lib/x86_64-linux-gnu/libpthread.so.0+0x8183)
    #18 0x7f7f998e503c in clone (/lib/x86_64-linux-gnu/libc.so.6+0xfe03c)

Steps to reproduce:
1. Build this branch of PyTorch with ASAN
https://github.com/pytorch/pytorch/pull/5271 (CFLAGS="-fsanitize=address
-fuse-ld=gold"0
2. Run LD_PRELOAD="/usr/lib/gcc/x86_64-linux-gnu/7/libasan.so" python
test/test_nn.py -v TestNN.test_AdaptiveMaxPool1d_indices

I can try to reduce but I wanted to first see if the error rung a bell

Some notes:
1. The code is legitimately throwing a C++ exception
2. The code in question is dynamically loaded by Python (thus the LD_PRELOAD)

Reply via email to