Bug 1201047 - memusage script not usable due wrong memusageso variable
Summary: memusage script not usable due wrong memusageso variable
Status: REOPENED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Dr. Werner Fink
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-30 08:52 UTC by Dr. Werner Fink
Modified: 2022-07-25 14:21 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dr. Werner Fink 2022-06-30 08:52:19 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 "$@"
Comment 1 Andreas Schwab 2022-07-06 15:16:36 UTC
The quoting is correct because it is passed though eval.
Comment 2 Dr. Werner Fink 2022-07-07 06:54:48 UTC
echo $LIB
LIB: Undefined variable.
man memusage | grep -c LIB
0
Comment 3 Dr. Werner Fink 2022-07-07 06:59:06 UTC
(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
Comment 4 Andreas Schwab 2022-07-07 07:56:05 UTC
That's why it needs to be quoted.
Comment 5 Andreas Schwab 2022-07-07 08:47:02 UTC
Worksforme.
Comment 6 Dr. Werner Fink 2022-07-07 10:28:53 UTC
(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
Comment 7 Dr. Werner Fink 2022-07-07 10:30:56 UTC
Btw: Even if it works on your system ... on this Tumbleweed with this Hardware it does not.
Comment 8 Dr. Werner Fink 2022-07-07 10:36:27 UTC
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.
Comment 9 Andreas Schwab 2022-07-07 10:44:15 UTC
You need to debug the crash yourself.
Comment 10 Dr. Werner Fink 2022-07-07 10:56:48 UTC
#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
Comment 12 Dr. Werner Fink 2022-07-07 11:25:38 UTC
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.
Comment 13 Dr. Werner Fink 2022-07-07 11:56:56 UTC
(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
Comment 14 Michael Pujos 2022-07-07 22:03:17 UTC
I can reproduce this crash with just 'memusage kodi' on my system.
'memusage dolphin' crashes as well, but with an entirely different stack trace.
Comment 15 Dr. Werner Fink 2022-07-25 14:21:40 UTC
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