-
-
Notifications
You must be signed in to change notification settings - Fork 187
Description
Hi! The test for aegis in samples/minimal crashes on x86_64-linux machines (both Ubuntu and NixOS) without AVX support. When --without-aegis is passed to ./configure, the samples/minimal program does not crash when run.
This seems similar to #120, but was not resolved by the fix there.
Full details are below.
Steps to reproduce (on an affected machine):
Note: I don't have an affected physical machine. This is all on a virtual machine (Hyper-V, with "Migrate to a physical computer with a different processor version" selected).
git clone https://github.com/utelle/wxsqlite3
cd wxsqlite3
autoreconf
mkdir build-test
cd build-test
./configure --disable-shared --enable-static # Easier debugging
make -j
cd samples
./minimal
What happens:
...
Open database 'persons-aegis-testkey.db3'
Cipher salt: 494D6E26A71F9C897EFA808C2AE87379
Illegal instruction (core dumped)
Details and backtrace (from GDB):
Program received signal SIGILL, Illegal instruction.
aegis256_soft_impl_stream (out=0x7fffffffbf20 "", len=64,
npub=0x555555852928 "\311m\023\201\326\213sFi\364\254\314E\227\371\241\033ٔi6\b\033o\334F\304\auԵ\337H\031\205UUU",
k=0x55555583cf24 "h\005\r\316HP%\315+w*N\342\247\0259\202\306\366\224\310\\\254\030\374w\b4u%l\214IMn&\247\037\234\211~\372\200\214*\350syUU")
at ../src/sqlite3mc_amalgamation.c:307431
307431 memset(src, 0, sizeof src);
---
#0 aegis256_soft_impl_stream (out=0x7fffffffbf20 "", len=64,
npub=0x555555852928 "\311m\023\201\326\213sFi\364\254\314E\227\371\241\033ٔi6\b\033o\334F\304\auԵ\337H\031\205UUU",
k=0x55555583cf24 "h\005\r\316HP%\315+w*N\342\247\0259\202\306\366\224\310\\\254\030\374w\b4u%l\214IMn&\247\037\234\211~\372\200\214*\350syUU")
at ../src/sqlite3mc_amalgamation.c:307431
#1 0x00005555555bccc3 in AegisGenOtk (aegisCipher=aegisCipher@entry=0x55555583cf08,
out=out@entry=0x7fffffffbf20 "", outLength=64,
nonce=nonce@entry=0x555555852928 "\311m\023\201\326\213sFi\364\254\314E\227\371\241\033ٔi6\b\033o\334F\304\auԵ\337H\031\205UUU", page=page@entry=1, nonceLength=<optimized out>)
at ../src/sqlite3mc_amalgamation.c:328911
#2 0x00005555555bcf85 in DecryptPageAegisCipher (cipher=0x55555583cf08, page=1,
data=0x555555851948 "IMn&\247\037\234\211~\372\200\214*\350sy\020", len=<optimized out>,
reserved=<optimized out>, hmacCheck=1) at ../src/sqlite3mc_amalgamation.c:329034
#3 0x00005555555e1eae in sqlite3mcDecrypt (codec=0x5555558259f8, page=1,
data=0x555555851948 "IMn&\247\037\234\211~\372\200\214*\350sy\020", len=4096)
at ../src/sqlite3mc_amalgamation.c:329757
#4 sqlite3mcCodec (pCodecArg=0x5555558259f8, data=data@entry=0x555555851948,
nPageNum=nPageNum@entry=1, nMode=nMode@entry=3) at ../src/sqlite3mc_amalgamation.c:331593
#5 0x000055555560cfd0 in sqlite3mcCodec (pCodecArg=<optimized out>, data=0x555555851948,
nPageNum=1, nMode=3) at ../src/sqlite3mc_amalgamation.c:355362
#6 mcReadMainDb (pFile=0x5555559ef150, buffer=<optimized out>, count=<optimized out>,
offset=<optimized out>) at ../src/sqlite3mc_amalgamation.c:355364
#7 mcIoRead (pFile=0x5555559ef150, buffer=<optimized out>, count=<optimized out>,
offset=<optimized out>) at ../src/sqlite3mc_amalgamation.c:355508
#8 0x000055555564140f in sqlite3OsRead (id=<optimized out>, pBuf=<optimized out>,
amt=<optimized out>, offset=<optimized out>) at ../src/sqlite3mc_amalgamation.c:26759
#9 readDbPage (pPg=pPg@entry=0x555555852980) at ../src/sqlite3mc_amalgamation.c:61241
#10 0x000055555566b50f in getPageNormal (pPager=0x5555559eefc8, pgno=1,
ppPage=0x7fffffffc0c0, flags=<optimized out>) at ../src/sqlite3mc_amalgamation.c:63805
#11 0x00005555555a04fd in sqlite3PagerGet (pPager=<optimized out>, pgno=1,
ppPage=0x7fffffffc0c0, flags=<optimized out>) at ../src/sqlite3mc_amalgamation.c:63929
#12 btreeGetPage (pBt=0x555555865058, pgno=1, ppPage=0x7fffffffc120, flags=<optimized out>)
at ../src/sqlite3mc_amalgamation.c:74036
#13 0x0000555555691e27 in lockBtree (pBt=0x555555865058)
at ../src/sqlite3mc_amalgamation.c:74980
#14 btreeBeginTrans (p=0x5555559ef878, wrflag=wrflag@entry=0,
pSchemaVersion=pSchemaVersion@entry=0x0) at ../src/sqlite3mc_amalgamation.c:75375
#15 0x00005555556ca5a4 in sqlite3BtreeBeginTrans (p=<optimized out>, wrflag=<optimized out>,
pSchemaVersion=<optimized out>) at ../src/sqlite3mc_amalgamation.c:75475
#16 sqlite3InitOne (db=0x55555583bd28, iDb=iDb@entry=0,
pzErrMsg=pzErrMsg@entry=0x7fffffffce08, mFlags=mFlags@entry=0)
at ../src/sqlite3mc_amalgamation.c:144138
#17 0x00005555556cab7c in sqlite3Init (db=db@entry=0x55555583bd28,
pzErrMsg=pzErrMsg@entry=0x7fffffffce08) at ../src/sqlite3mc_amalgamation.c:144325
#18 0x00005555556cabbf in sqlite3ReadSchema (pParse=pParse@entry=0x7fffffffce00)
at ../src/sqlite3mc_amalgamation.c:144351
#19 0x00005555556db825 in yy_reduce (yypParser=0x7fffffffc3f0, yyruleno=<optimized out>,
yyLookaheadToken=..., pParse=pParse@entry=0x7fffffffce00, yyLookahead=<optimized out>)
at ../src/sqlite3mc_amalgamation.c:179388
#20 0x00005555556ddf17 in sqlite3Parser (yyp=0x7fffffffc3f0, yymajor=<optimized out>,
yyminor=...) at ../src/sqlite3mc_amalgamation.c:180845
#21 sqlite3RunParser (pParse=pParse@entry=0x7fffffffce00, zSql=<optimized out>,
zSql@entry=0x5555557270ed "SELECT COUNT(*) FROM persons")
at ../src/sqlite3mc_amalgamation.c:182186
#22 0x00005555556de9d1 in sqlite3Prepare (db=db@entry=0x55555583bd28,
zSql=zSql@entry=0x5555557270ed "SELECT COUNT(*) FROM persons", nBytes=nBytes@entry=-1,
prepFlags=prepFlags@entry=128, pReprepare=pReprepare@entry=0x0,
ppStmt=ppStmt@entry=0x7fffffffd078, pzTail=0x7fffffffd070)
at ../src/sqlite3mc_amalgamation.c:144662
#23 0x00005555556dedf3 in sqlite3LockAndPrepare (db=0x55555583bd28,
zSql=0x5555557270ed "SELECT COUNT(*) FROM persons", nBytes=-1,
prepFlags=prepFlags@entry=128, pOld=pOld@entry=0x0, ppStmt=0x7fffffffd078,
pzTail=0x7fffffffd070) at ../src/sqlite3mc_amalgamation.c:144737
#24 0x00005555556df1aa in sqlite3_prepare_v2 (db=<optimized out>, zSql=<optimized out>,
nBytes=<optimized out>, ppStmt=<optimized out>, pzTail=<optimized out>)
at ../src/sqlite3mc_amalgamation.c:144824
#25 0x00005555555962fc in wxSQLite3Database::Prepare (this=this@entry=0x7fffffffd2a0,
sql=sql@entry=0x5555557270ed "SELECT COUNT(*) FROM persons") at ../src/wxsqlite3.cpp:4045
#26 0x0000555555596918 in wxSQLite3Database::ExecuteQuery (this=this@entry=0x7fffffffd2a0,
sql=sql@entry=0x5555557270ed "SELECT COUNT(*) FROM persons") at ../src/wxsqlite3.cpp:3590
#27 0x000055555559b23f in wxSQLite3Database::ExecuteScalar (this=this@entry=0x7fffffffd2a0,
sql=sql@entry=0x5555557270ed "SELECT COUNT(*) FROM persons") at ../src/wxsqlite3.cpp:3626
#28 0x000055555557a1cb in Minimal::TestPersonsDb (this=<optimized out>, cipher=...,
dbFileName=..., dbKey=...) at ../samples/minimal.cpp:886
#29 0x000055555557b631 in Minimal::TestCiphers (this=this@entry=0x5555557ecd10)
at ../samples/minimal.cpp:963
#30 0x0000555555581913 in Minimal::OnRun (this=0x5555557ecd10) at ../samples/minimal.cpp:812
#31 0x00007ffff7d17920 in wxEntry (argc=@0x7ffff7e7c104: 1, argv=<optimized out>)
at ./src/common/init.cpp:497
#32 0x00007ffff7d179d3 in wxEntry (argc=<optimized out>, argv=<optimized out>)
at ./src/common/init.cpp:509
#33 0x0000555555577fe6 in main (argc=<optimized out>, argv=<optimized out>)
at ../samples/minimal.cpp:969
Screenshots from GDB (the highlighted line is the line that crashed):
CPU flags from /proc/cpuinfo:
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology cpuid tsc_known_freq pni ssse3 cx16 sse4_1 sse4_2 x2apic popcnt hypervisor lahf_lm pti ssbd ibrs ibpb md_clear flush_l1d arch_capabilities