Bugzilla – Bug 1201047
memusage script not usable due wrong memusageso variable
Last modified: 2022-07-25 14:21:40 UTC
In the script /usr/bin/memusage of the package glibc-utils there is the line memusageso='/\$LIB/libmemusage.so' which breaks usage ... beside this (after replacing \$LIB with /usr/lib64) I see memusage -m -u -T -d /tmp/kodi.data /abuild/oscbuild/kodi/home/abuild/rpmbuild/BUILD/xbmc-19.4-Matrix/build/kodi.bin /usr/src/werner/QNAP/kodi/radio.flac /usr/bin/memusage: line 252: 6522 Segmentation fault (core dumped) LD_PRELOAD=/usr/lib64/libmemusage.so MEMUSAGE_OUTPUT=/tmp/kodi.data MEMUSAGE_BUFFER_SIZE=1 MEMUSAGE_TRACE_MMAP=yes "$@"
The quoting is correct because it is passed though eval.
echo $LIB LIB: Undefined variable. man memusage | grep -c LIB 0
(gdb) bt #0 0x00007f016fcd6300 in __memset_sse2_unaligned_erms () at /lib64/libc.so.6 #1 0x00007f0170ac7b9e in () at /lib64/libsqlite3.so.0 #2 0x00007f0170b1df6c in () at /lib64/libsqlite3.so.0 #3 0x00007f0170b623bb in () at /lib64/libsqlite3.so.0 #4 0x00007f0170b6271d in () at /lib64/libsqlite3.so.0 #5 0x00007f0170b62747 in sqlite3_create_function () at /lib64/libsqlite3.so.0 #6 0x00007f0170bab200 in () at /lib64/libsqlite3.so.0 #7 0x00007f0170b63968 in () at /lib64/libsqlite3.so.0 #8 0x0000000000e81e8c in dbiplus::SqliteDatabase::connect(bool) (this=0x1f7c7b0, create=<optimized out>) at /usr/include/c++/11/bits/basic_string.h:194 #9 0x0000000000e80599 in CDatabase::Connect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, DatabaseSettings const&, bool) (this=0x7fff7a4e5d80, dbName=<optimized out>, dbSettings=..., create=<optimized out>) at /home/abuild/rpmbuild/BUILD/xbmc-19.4-Matrix/xbmc/dbwrappers/Database.cpp:617 #10 0x0000000000fd4296 in CDatabaseManager::Update(CDatabase&, DatabaseSettings const&) (this=<optimized out>, db=..., settings=<optimized out>) at /home/abuild/rpmbuild/BUILD/xbmc-19.4-Matrix/xbmc/DatabaseManager.cpp:97 #11 0x0000000000fd4bf9 in CDatabaseManager::UpdateDatabase(CDatabase&, DatabaseSettings*) (this=0x1fec6d0, db=..., settings=0x0) at /home/abuild/rpmbuild/BUILD/xbmc-19.4-Matrix/xbmc/DatabaseManager.cpp:76 #12 0x0000000000fd4ea3 in CDatabaseManager::CDatabaseManager() (this=this@entry=0x1fec6d0, this=<optimized out>) at /home/abuild/rpmbuild/BUILD/xbmc-19.4-Matrix/xbmc/DatabaseManager.cpp:30 #13 0x0000000001020e1c in CServiceManager::InitStageTwo(CAppParamParser const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (this=0x1feb570, params=..., profilesUserDataFolder='\000' <repeats 23 times>) at /home/abuild/rpmbuild/BUILD/xbmc-19.4-Matrix/xbmc/ServiceManager.cpp:103 #14 0x0000000000fa10f6 in CApplication::Create(CAppParamParser const&) (this=0x1f3bed0, params=...) at /home/abuild/rpmbuild/BUILD/xbmc-19.4-Matrix/xbmc/Application.cpp:523 #15 0x0000000000d32b38 in XBMC_Run(bool, CAppParamParser const&) (renderGUI=<optimized out>, params=...) at /home/abuild/rpmbuild/BUILD/xbmc-19.4-Matrix/xbmc/platform/xbmc.cpp:29 #16 0x000000000084a35b in main(int, char**) (argc=1, argv=0x7fff7a4e6688) at /home/abuild/rpmbuild/BUILD/xbmc-19.4-Matrix/xbmc/platform/posix/main.cpp:78
That's why it needs to be quoted.
Worksforme.
(In reply to Andreas Schwab from comment #5) > Worksforme. Wrong CPU type? Actual the crash is happen in __memset_sse2_unaligned_erms of glibc on this Vendor ID: GenuineIntel Model name: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz CPU family: 6 Model: 42 [...] Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmper f pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_ deadline_timer aes xsave avx lahf_lm epb pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm ida arat pln pts md_clear flush_l1d does your CPU have sse2 and is it used by glibc in memset(3) or does it use an other optimized memset function
Btw: Even if it works on your system ... on this Tumbleweed with this Hardware it does not.
Also the well documented script /usr/bin/memusage from glibc-utils does not work out of the box. And the $LIB is not documented. And I know how to quote and this is what I've done but we have customers which might not know about, hence this should be at least documented in the manual page of the script or changed in the script.
You need to debug the crash yourself.
#0 __memset_sse2_unaligned_erms () at ../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S:322 (gdb) list 317 #endif 318 /* Align dst for loop. */ 319 andq $(VEC_SIZE * -2), %LOOP_REG 320 .p2align 4 321 L(loop): 322 VMOVA %VEC(0), LOOP_4X_OFFSET(%LOOP_REG) 323 VMOVA %VEC(0), (VEC_SIZE + LOOP_4X_OFFSET)(%LOOP_REG) 324 VMOVA %VEC(0), (VEC_SIZE * 2 + LOOP_4X_OFFSET)(%LOOP_REG) 325 VMOVA %VEC(0), (VEC_SIZE * 3 + LOOP_4X_OFFSET)(%LOOP_REG) 326 subq $-(VEC_SIZE * 4), %LOOP_REG
I'm not the only one https://www.google.com/search?q=%22__memset_sse2_unaligned_erms%22+%22SIGSEGV%22&client=firefox-b-d&ei=VrzGYtuyIqvh7_UP4qOhgAY&ved=0ahUKEwjbtb-6z-b4AhWr8LsIHeJRCGAQ4dUDCA0&uact=5&oq=%22__memset_sse2_unaligned_erms%22+%22SIGSEGV%22&gs_lcp=Cgdnd3Mtd2l6EANKBAhBGAFKBAhGGABQoQRYoQRgqwZoAXAAeACAAWyIAWySAQMwLjGYAQCgAQHAAQE
I suggest to set LD_HWCAP_MASK=0 and export it in memusage script .. meanwhile I've tried to get an account on sourceware.org to report a bug for glibc there.
(In reply to Dr. Werner Fink from comment #12) > I suggest to set LD_HWCAP_MASK=0 and export it in memusage script .. > meanwhile I've tried to get an account on sourceware.org to report a bug for > glibc there. More complicated as described in https://www.gnu.org/software/libc/manual/html_node/Hardware-Capability-Tunables.html and https://www.gnu.org/software/libc/manual/html_node/Tunables.html
I can reproduce this crash with just 'memusage kodi' on my system. 'memusage dolphin' crashes as well, but with an entirely different stack trace.
For kodi this looke like a problem with sqlite3 and its memory managment, compare with https://sourceware.org/bugzilla/show_bug.cgi?id=29327#c32