mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-25 00:48:36 -07:00
Fixes this tsan crash, easy to reproduce with any large enough program:
$ tests/unit/test-qht
1..2
ThreadSanitizer: CHECK failed: sanitizer_deadlock_detector.h:67 "((n_all_locks_)) < (((sizeof(all_locks_with_contexts_)/sizeof((all_locks_with_contexts_)[0]))))" (0x40, 0x40) (tid=1821568)
#0 __tsan::CheckUnwind() ../../../../src/libsanitizer/tsan/tsan_rtl.cpp:353 (libtsan.so.2+0x90034)
#1 __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_termination.cpp:86 (libtsan.so.2+0xca555)
#2 __sanitizer::DeadlockDetectorTLS<__sanitizer::TwoLevelBitVector<1ul, __sanitizer::BasicBitVector<unsigned long> > >::addLock(unsigned long, unsigned long, unsigned int) ../../../../src/libsanitizer/sanitizer_common/sanitizer_deadlock_detector.h:67 (libtsan.so.2+0xb3616)
#3 __sanitizer::DeadlockDetectorTLS<__sanitizer::TwoLevelBitVector<1ul, __sanitizer::BasicBitVector<unsigned long> > >::addLock(unsigned long, unsigned long, unsigned int) ../../../../src/libsanitizer/sanitizer_common/sanitizer_deadlock_detector.h:59 (libtsan.so.2+0xb3616)
#4 __sanitizer::DeadlockDetector<__sanitizer::TwoLevelBitVector<1ul, __sanitizer::BasicBitVector<unsigned long> > >::onLockAfter(__sanitizer::DeadlockDetectorTLS<__sanitizer::TwoLevelBitVector<1ul, __sanitizer::BasicBitVector<unsigned long> > >*, unsigned long, unsigned int) ../../../../src/libsanitizer/sanitizer_common/sanitizer_deadlock_detector.h:216 (libtsan.so.2+0xb3616)
#5 __sanitizer::DD::MutexAfterLock(__sanitizer::DDCallback*, __sanitizer::DDMutex*, bool, bool) ../../../../src/libsanitizer/sanitizer_common/sanitizer_deadlock_detector1.cpp:169 (libtsan.so.2+0xb3616)
#6 __tsan::MutexPostLock(__tsan::ThreadState*, unsigned long, unsigned long, unsigned int, int) ../../../../src/libsanitizer/tsan/tsan_rtl_mutex.cpp:200 (libtsan.so.2+0xa3382)
#7 __tsan_mutex_post_lock ../../../../src/libsanitizer/tsan/tsan_interface_ann.cpp:384 (libtsan.so.2+0x76bc3)
#8 qemu_spin_lock /home/cota/src/qemu/include/qemu/thread.h:259 (test-qht+0x44a97)
#9 qht_map_lock_buckets ../util/qht.c:253 (test-qht+0x44a97)
#10 do_qht_iter ../util/qht.c:809 (test-qht+0x45f33)
#11 qht_iter ../util/qht.c:821 (test-qht+0x45f33)
#12 iter_check ../tests/unit/test-qht.c:121 (test-qht+0xe473)
#13 qht_do_test ../tests/unit/test-qht.c:202 (test-qht+0xe473)
#14 qht_test ../tests/unit/test-qht.c:240 (test-qht+0xe7c1)
#15 test_default ../tests/unit/test-qht.c:246 (test-qht+0xe828)
#16 <null> <null> (libglib-2.0.so.0+0x7daed)
#17 <null> <null> (libglib-2.0.so.0+0x7d80a)
#18 <null> <null> (libglib-2.0.so.0+0x7d80a)
#19 g_test_run_suite <null> (libglib-2.0.so.0+0x7dfe9)
#20 g_test_run <null> (libglib-2.0.so.0+0x7e055)
#21 main ../tests/unit/test-qht.c:259 (test-qht+0xd2c6)
#22 __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 (libc.so.6+0x29d8f)
#23 __libc_start_main_impl ../csu/libc-start.c:392 (libc.so.6+0x29e3f)
#24 _start <null> (test-qht+0xdb44)
Signed-off-by: Emilio Cota <cota@braap.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230111151628.320011-5-cota@braap.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230124180127.1881110-30-alex.bennee@linaro.org>
|
||
|---|---|---|
| .. | ||
| aio-posix.c | ||
| aio-posix.h | ||
| aio-wait.c | ||
| aio-win32.c | ||
| aiocb.c | ||
| async-teardown.c | ||
| async.c | ||
| atomic64.c | ||
| base64.c | ||
| bitmap.c | ||
| bitops.c | ||
| block-helpers.c | ||
| block-helpers.h | ||
| buffer.c | ||
| bufferiszero.c | ||
| cacheflush.c | ||
| compatfd.c | ||
| coroutine-sigaltstack.c | ||
| coroutine-ucontext.c | ||
| coroutine-win32.c | ||
| crc-ccitt.c | ||
| crc32c.c | ||
| cutils.c | ||
| dbus.c | ||
| drm.c | ||
| envlist.c | ||
| error-report.c | ||
| error.c | ||
| event_notifier-posix.c | ||
| event_notifier-win32.c | ||
| fdmon-epoll.c | ||
| fdmon-io_uring.c | ||
| fdmon-poll.c | ||
| fifo8.c | ||
| filemonitor-inotify.c | ||
| filemonitor-stub.c | ||
| getauxval.c | ||
| guest-random.c | ||
| hbitmap.c | ||
| hexdump.c | ||
| host-utils.c | ||
| id.c | ||
| int128.c | ||
| interval-tree.c | ||
| iov.c | ||
| iova-tree.c | ||
| keyval.c | ||
| lockcnt.c | ||
| log.c | ||
| main-loop.c | ||
| memalign.c | ||
| memfd.c | ||
| meson.build | ||
| mmap-alloc.c | ||
| module.c | ||
| notify.c | ||
| nvdimm-utils.c | ||
| osdep.c | ||
| oslib-posix.c | ||
| oslib-win32.c | ||
| path.c | ||
| qdist.c | ||
| qemu-co-shared-resource.c | ||
| qemu-co-timeout.c | ||
| qemu-config.c | ||
| qemu-coroutine-io.c | ||
| qemu-coroutine-lock.c | ||
| qemu-coroutine-sleep.c | ||
| qemu-coroutine.c | ||
| qemu-option.c | ||
| qemu-print.c | ||
| qemu-progress.c | ||
| qemu-sockets.c | ||
| qemu-thread-common.h | ||
| qemu-thread-posix.c | ||
| qemu-thread-win32.c | ||
| qemu-timer-common.c | ||
| qemu-timer.c | ||
| qht.c | ||
| qsp.c | ||
| range.c | ||
| rcu.c | ||
| readline.c | ||
| selfmap.c | ||
| stats64.c | ||
| sys_membarrier.c | ||
| systemd.c | ||
| thread-context.c | ||
| thread-pool.c | ||
| throttle.c | ||
| timed-average.c | ||
| trace-events | ||
| trace.h | ||
| transactions.c | ||
| unicode.c | ||
| uri.c | ||
| userfaultfd.c | ||
| uuid.c | ||
| vfio-helpers.c | ||
| vhost-user-server.c | ||
| yank.c | ||