lxc / lxc

LXC - Linux Containers
https://linuxcontainers.org/lxc
Other
4.67k stars 1.12k forks source link

lxc-test-share-ns seems to get stuck under ASan #3798

Open evverx opened 3 years ago

evverx commented 3 years ago

It's probably an ASan bug but I'll leave it here so that I can refer to it in commit messages. The test gets stuck waiting for a thread that waits for a futex:

$ pgrep -a lxc
755173 /home/vagrant/lxc/src/tests/.libs/lxc-test-share-ns
755497 [lxc monitor] /var/lib/lxc owning-ns
755584 /home/vagrant/lxc/src/tests/.libs/lxc-test-share-ns
758077 [lxc monitor] /var/lib/lxc share-ns-3

$ sudo strace -p 758077
strace: Process 758077 attached
futex(0x6400000021c0, FUTEX_WAIT_PRIVATE, 2, NULL^Cstrace: Process 758077 detached
 <detached ...>

$ sudo gdb -p 758077
...
(gdb) bt
#0  0x0000563508b023d0 in __sanitizer::BlockingMutex::Lock() ()
#1  0x0000563508a7c420 in __sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::LocalAddressSpaceView> >::GetFromAllocator(__sanitizer::AllocatorStats*, unsigned long, unsigned int*, unsigned long)
    ()
#2  0x0000563508a7c323 in __sanitizer::SizeClassAllocator64LocalCache<__sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::LocalAddressSpaceView> > >::Refill(__sanitizer::SizeClassAllocator64LocalCache<__sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::LocalAddressSpaceView> > >::PerClass*, __sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::LocalAddressSpaceView> >*, unsigned long) ()
#3  0x0000563508a7bf9f in __sanitizer::CombinedAllocator<__sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::LocalAddressSpaceView> >, __sanitizer::LargeMmapAllocatorPtrArrayDynamic>::Allocate(__sanitizer::SizeClassAllocator64LocalCache<__sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::LocalAddressSpaceView> > >*, unsigned long, unsigned long) ()
#4  0x0000563508a776d4 in __asan::Allocator::Allocate(unsigned long, unsigned long, __sanitizer::BufferedStackTrace*, __asan::AllocType, bool) ()
#5  0x0000563508a77444 in __asan::asan_malloc(unsigned long, __sanitizer::BufferedStackTrace*) ()
#6  0x0000563508aefacc in malloc ()
#7  0x00007f7d55837099 in __alloc_dir (statp=0x7f7d502f9ca0, flags=0, close_fd=true, fd=6) at ../sysdeps/posix/opendir.c:118
#8  opendir_tail (fd=6) at ../sysdeps/posix/opendir.c:69
#9  __opendir (name=<optimized out>) at ../sysdeps/posix/opendir.c:92
#10 0x0000563508aa3de1 in opendir ()
#11 0x00007f7d554397b4 in lxc_check_inherited (conf=0x627000049900, closeall=true, fds_to_ignore=0x6180000801b8, len_fds=3) at start.c:234
#12 0x00007f7d553ac832 in inherit_fds (handler=0x618000080080, closeall=true) at ./start.h:173
#13 0x00007f7d553a98f0 in do_lxcapi_start (c=0x61600003ff80, useinit=0, argv=0x7f7d502fa8c0) at lxccontainer.c:1017
#14 0x00007f7d5539a823 in lxcapi_startl (c=0x61600003ff80, useinit=0) at lxccontainer.c:1175
#15 0x0000563508b1ba5d in ns_sharing_wrapper (data=0x622000000724) at share_ns.c:117
#16 0x00007f7d55acc609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#17 0x00007f7d55878293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
evverx commented 3 years ago

It's probably the same as https://gcc.gnu.org/bugzilla//show_bug.cgi?id=96332

evverx commented 3 years ago

Judging by https://github.com/lxc/lxc/runs/2409697561?check_suite_focus=true, lxc-test-concurrent tends to get stuck under ASan as well. I'll try to figure out what's going on there.