KPScript crashes on mono 3.4.0 (tested on Archlinux)
A lightweight and easy-to-use password manager
Brought to you by:
dreichl
The command:
sudo /usr/bin/mono /usr/share/keepass/KPScript.exe -c:GetEntryString "/path/to/keepass/database.kdbx" -pw:somepass -keyfile:"/path/to/keepass/keyfile.key" -Field:Password -refx-UUID:ABE48B532246AC43BA896121248ED583
The trace:
* Assertion at class.c:4583, condition `cur_slot == class->vtable_size' not met
Stacktrace:
at <unknown> <0xffffffff>
at KeePassLib.Utility.MemUtil.Read (System.IO.Stream,int) <0x00064>
at KeePassLib.Serialization.BinaryReaderEx.ReadBytes (int) <0x0002e>
at KeePassLib.Serialization.KdbxFile.ReadHeader (KeePassLib.Serialization.BinaryReaderEx) <0x00099>
at KeePassLib.Serialization.KdbxFile.Load (System.IO.Stream,KeePassLib.Serialization.KdbxFormat,KeePassLib.Interfaces.IStatusLogger) <0x00180>
at KeePassLib.PwDatabase.Open (KeePassLib.Serialization.IOConnectionInfo,KeePassLib.Keys.CompositeKey,KeePassLib.Interfaces.IStatusLogger) <0x001fd>
at KPScript.Program.RunScriptLine (KeePass.Util.CommandLineArgs) <0x0063c>
at KPScript.Program.Main (string[]) <0x00113>
at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
/usr/lib/libmonosgen-2.0.so.1(+0xd4eea) [0x7fa80ada8eea]
/usr/lib/libpthread.so.0(+0x10200) [0x7fa80aac8200]
/usr/lib/libc.so.6(gsignal+0x37) [0x7fa80a748967]
/usr/lib/libc.so.6(abort+0x16a) [0x7fa80a749d3a]
/usr/lib/libmonosgen-2.0.so.1(+0x26a993) [0x7fa80af3e993]
/usr/lib/libmonosgen-2.0.so.1(+0x26ab03) [0x7fa80af3eb03]
/usr/lib/libmonosgen-2.0.so.1(+0x146b29) [0x7fa80ae1ab29]
/usr/lib/libmonosgen-2.0.so.1(+0x146ef5) [0x7fa80ae1aef5]
/usr/lib/libmonosgen-2.0.so.1(+0x14bd5a) [0x7fa80ae1fd5a]
/usr/lib/libmonosgen-2.0.so.1(+0xd8187) [0x7fa80adac187]
[0x414bbdf2]
Debug info from gdb:
warning: File "/usr/bin/mono-sgen-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
add-auto-load-safe-path /usr/bin/mono-sgen-gdb.py
line to your configuration file "/root/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/root/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[New LWP 15045]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Got object file from memory but can't read symbols: File truncated.
0x00007fa80aac7deb in waitpid () from /usr/lib/libpthread.so.0
Id Target Id Frame
2 Thread 0x7fa80857c700 (LWP 15045) "mono" 0x00007fa80aac6910 in sem_wait () from /usr/lib/libpthread.so.0
* 1 Thread 0x7fa80b48e780 (LWP 15044) "mono" 0x00007fa80aac7deb in waitpid () from /usr/lib/libpthread.so.0
Thread 2 (Thread 0x7fa80857c700 (LWP 15045)):
#0 0x00007fa80aac6910 in sem_wait () from /usr/lib/libpthread.so.0
#1 0x00007fa80af34a66 in mono_sem_wait () from /usr/lib/libmonosgen-2.0.so.1
#2 0x00007fa80aeb2bf6 in ?? () from /usr/lib/libmonosgen-2.0.so.1
#3 0x00007fa80ae93595 in ?? () from /usr/lib/libmonosgen-2.0.so.1
#4 0x00007fa80af39fa5 in ?? () from /usr/lib/libmonosgen-2.0.so.1
#5 0x00007fa80aabf314 in start_thread () from /usr/lib/libpthread.so.0
#6 0x00007fa80a7fd3ed in clone () from /usr/lib/libc.so.6
Thread 1 (Thread 0x7fa80b48e780 (LWP 15044)):
#0 0x00007fa80aac7deb in waitpid () from /usr/lib/libpthread.so.0
#1 0x00007fa80ada8f80 in ?? () from /usr/lib/libmonosgen-2.0.so.1
#2 <signal handler called>
#3 0x00007fa80a748967 in raise () from /usr/lib/libc.so.6
#4 0x00007fa80a749d3a in abort () from /usr/lib/libc.so.6
#5 0x00007fa80af3e993 in ?? () from /usr/lib/libmonosgen-2.0.so.1
#6 0x00007fa80af3eb03 in ?? () from /usr/lib/libmonosgen-2.0.so.1
#7 0x00007fa80ae1ab29 in ?? () from /usr/lib/libmonosgen-2.0.so.1
#8 0x00007fa80ae1aef5 in ?? () from /usr/lib/libmonosgen-2.0.so.1
#9 0x00007fa80ae1fd5a in ?? () from /usr/lib/libmonosgen-2.0.so.1
#10 0x00007fa80adac187 in ?? () from /usr/lib/libmonosgen-2.0.so.1
#11 0x00000000414bbdf2 in ?? ()
#12 0x0000000000000000 in ?? ()
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Diff:
This is a native crash in Mono code, and thus needs to be fixed in Mono, not KPScript/KeePass.
Best regards,
Dominik
BTW, the crash happens with the prebuilt binary (I guess microsoft's tools are used for building). Rebuilding from sources (on monodevelop) worked fine.