rizinorg / rizin

UNIX-like reverse engineering framework and command-line toolset.
https://rizin.re
GNU Lesser General Public License v3.0
2.71k stars 363 forks source link

Fix broken tests on SystemZ platform #297

Closed XVilka closed 1 year ago

XVilka commented 3 years ago

Work environment

Questions Answers
OS/arch/bits (mandatory) Ubuntu S390
File format of the file you reverse (mandatory) -
Architecture/bits of the file (mandatory) S390
rizin -v full output, not truncated (mandatory) https://github.com/rizinorg/rizin/commit/161e3e3dda74f5b1ec36139f903ee409e45744f3

Expected behavior

All green

Actual behavior

See https://app.travis-ci.com/github/rizinorg/rizin/jobs/586429352

[XX] db/cmd/cmd_c cmd_c4
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'c4 0xfa1e0ff2' bins/elf/ls
-- stdout
--- expected
+++ actual
@@ -1,1 +1,4 @@
-0x00005ae0 (byte=01)   f3 ' '  ->  f2 ' '
+0x00005ae0 (byte=01)   f3 ' '  ->  fa ' '
+0x00005ae1 (byte=02)   0f ' '  ->  1e ' '
+0x00005ae2 (byte=03)   1e ' '  ->  0f ' '
+0x00005ae3 (byte=04)   fa ' '  ->  f2 ' '
-- stderr
Compare 0/4 equal bytes (0%)

[**]                                 db/cmd/cmd_foreach       39 OK         1 BR        1 XX        0 FX
[**]                                       db/cmd/cmd_c       44 OK         1 BR        1 XX        0 FX
[**]                                     db/cmd/cmd_env       46 OK         1 BR        1 XX        0 FX
[**]                                     db/cmd/cmd_pae       51 OK         1 BR        1 XX        0 FX

[XX] db/cmd/cmd_i il (file x86_64)
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc il bins/elf/analysis/hello-linux-x86_64
-- stdout
--- expected
+++ actual
@@ -1,3 +1,3 @@
-library   
-----------
-libc.so.6
+library 
+--------
+
-- stderr
WARNING: Neither hash nor gnu_hash exist. Falling back to heuristics for deducing the number of dynamic symbols...
WARNING: Neither hash nor gnu_hash exist. Falling back to heuristics for deducing the number of dynamic symbols...
WARNING: Neither hash nor gnu_hash exist. Falling back to heuristics for deducing the number of dynamic symbols...

[XX] db/cmd/cmd_i il (file x86)
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc il bins/elf/analysis/x86-helloworld-gcc
-- stdout
--- expected
+++ actual
@@ -1,3 +1,3 @@
-library   
-----------
-libc.so.6
+library 
+--------
+

[XX] db/cmd/cmd_i iaq
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc iaq bins/elf/libmagic.so
-- stdout
--- expected
+++ actual
@@ -28,7 +28,7 @@
 __stack_chk_guard
 __gnu_Unwind_Find_exidx
 abort
-operator delete(void*)
+_ZdlPv
 __cxa_pure_virtual
 pthread_key_delete
 pthread_getspecific
@@ -46,40 +46,40 @@
 pthread_mutex_unlock
 0x00005fa8
 0x00007c70 10 __aeabi_unwind_cpp_pr0
-0x00006108 48 getPackageName(_JNIEnv*, _jobject*)
-0x00006138 164 JstringToString(_JNIEnv*, _jstring*)
-0x000061dc 136 CharTojstring(_JNIEnv*, char const*)
-0x00006264 196 invokeStaticMethodss(_JNIEnv*, _jstring*, _jstring*)
-0x00006328 148 getFieldOjbectEx(_JNIEnv*, _jclass*, _jobject*, _jstring*)
-0x000063bc 84 getFieldOjbect(_JNIEnv*, _jstring*, _jobject*, _jstring*)
-0x00006410 152 setFieldOjbectEx(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jobject*)
-0x000064a8 92 setFieldOjbect(_JNIEnv*, _jstring*, _jstring*, _jobject*, _jobject*)
-0x00006504 34 checkException(_JNIEnv*)
-0x00006528 76 forName(_JNIEnv*, _jstring*)
-0x00006574 32 GetFileName(char*)
-0x00006594 216 replaceAll(char const*, char const*, char const*)
-0x0000666c 152 decode(_JNIEnv*, _jstring*, _jstring*)
-0x00006704 12 sub_444(_JNIEnv*, _jobject*, _jobject*, _jstring*, _jstring*)
-0x00006710 476 sub_333(_JNIEnv*, _jobject*, _jobject*, _jstring*, _jstring*)
-0x000074f8 100 SystemClassLoaderInjector::inject(_JNIEnv*, _jobject*, _jstring*, _jstring*)
-0x000068ec 42 registerNativeMethods(_JNIEnv*, char const*, JNINativeMethod*, int)
-0x00006918 28 register_ndk_load(_JNIEnv*)
+0x00006108 48 _Z14getPackageNameP7_JNIEnvP8_jobject
+0x00006138 164 _Z15JstringToStringP7_JNIEnvP8_jstring
+0x000061dc 136 _Z13CharTojstringP7_JNIEnvPKc
+0x00006264 196 _Z20invokeStaticMethodssP7_JNIEnvP8_jstringS2_
+0x00006328 148 _Z16getFieldOjbectExP7_JNIEnvP7_jclassP8_jobjectP8_jstring
+0x000063bc 84 _Z14getFieldOjbectP7_JNIEnvP8_jstringP8_jobjectS2_
+0x00006410 152 _Z16setFieldOjbectExP7_JNIEnvP7_jclassP8_jstringP8_jobjectS6_
+0x000064a8 92 _Z14setFieldOjbectP7_JNIEnvP8_jstringS2_P8_jobjectS4_
+0x00006504 34 _Z14checkExceptionP7_JNIEnv
+0x00006528 76 _Z7forNameP7_JNIEnvP8_jstring
+0x00006574 32 _Z11GetFileNamePc
+0x00006594 216 _Z10replaceAllPKcS0_S0_
+0x0000666c 152 _Z6decodeP7_JNIEnvP8_jstringS2_
+0x00006704 12 _Z7sub_444P7_JNIEnvP8_jobjectS2_P8_jstringS4_
+0x00006710 476 _Z7sub_333P7_JNIEnvP8_jobjectS2_P8_jstringS4_
+0x000074f8 100 _ZN25SystemClassLoaderInjector6injectEP7_JNIEnvP8_jobjectP8_jstringS5_
+0x000068ec 42 _Z21registerNativeMethodsP7_JNIEnvPKcP15JNINativeMethodi
+0x00006918 28 _Z17register_ndk_loadP7_JNIEnv
 0x00006934 40 JNI_OnLoad
-0x0000695c 2 decodeFile()

[XX] db/cmd/cmd_pd asm.imm.str, mov and movabs (#10473)
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'e asm.bytes=false
e asm.imm.str=true
pd 1 @ 0x9a2
pd 1 @ 0x9a9
pd 1 @ 0x9b3
' bins/elf/echo-bin
-- stdout
--- expected
+++ actual
@@ -1,3 +1,3 @@
-            0x000009a2      mov   dword [rbp - 0x30], 0x3c3c2b3e       ; '>+<<'
-            0x000009a9      mov   word [rbp - 0x2c], 0x3e5d            ; ']>'
+            0x000009a2      mov   dword [rbp - 0x30], 0x3c3c2b3e       ; '>+<<' ; 1010576190
+            0x000009a9      mov   word [rbp - 0x2c], 0x3e5d            ; ']>' ; 15965
             0x000009b3      movabs rax, 0x3c2b3c3c5b3e3e3e             ; '>>>[<<+<'

[XX] db/cmd/cmd_pd emu.strflag
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'e asm.bytes=false
e emu.pre=true
e emu.str=true
e emu.str.flag=true
pd 1 @ 0x161d
e emu.str.flag=false
pd 1 @ 0x161d
pd 1 @ 0x1447
' bins/elf/redpill
-- stdout
--- expected
+++ actual
@@ -0,4 +0,4 @@
             0x0000161d      lea   eax, [esi - 0x21f7]                  ; "\n  Blue Pill" str.Blue_Pill
             0x0000161d      lea   eax, [esi - 0x21f7]                  ; "\n  Blue Pill"
-            0x00001447      add   esi, 0x2bb9                          ; section..got.plt
+            0x00001447      add   esi, 0x2bb9                          ; 11193 ; section..got.plt

[XX] db/cmd/cmd_pd pdJ asm.emu=1 comment
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'e asm.bytes=true
e asm.emu=1
pdJ 1 @ 0x08048566
' bins/elf/crackme0x05
-- stdout
--- expected
+++ actual
@@ -1,1 +1,1 @@
-[{"offset":134514022,"text":"            0x08048566      e829feffff     call  sym.imp.printf        ; esp=0xfffffffffffffffc ; eip=0x8048394 -> 0xa00c25ff"},{"offset":134514022,"text":"                                                                       ; int printf(-1)"}]
+[{"offset":134514022,"text":"            0x08048566      e829feffff     call  sym.imp.printf        ; esp=0xfffffffffffffffc ; eip=0x8048394 -> 0xff250ca0"},{"offset":134514022,"text":"                                                                       ; int printf(-1)"}]

[XX] db/cmd/cmd_pd varsub for rip variable
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'aa; s main
e asm.syntax=att
e asm.var=0
e asm.lines.bb=0
e asm.bytes=0
e asm.comments=false
pdf
' bins/elf/varsub_2
-- stdout
--- expected
+++ actual
@@ -1,7 +1,7 @@
 / int main (int argc, char **argv, char **envp);
 | 0x0000061a      pushq %rbp
 | 0x0000061b      movq  %rsp, %rbp
-| 0x0000061e      movl  $1, obj.sa
+| 0x0000061e      movl  $1, obj._ZL2sa
 | 0x00000628      movl  $0, %eax
 | 0x0000062d      popq  %rbp
 \ 0x0000062e      retq
-- stderr
WARNING: Neither hash nor gnu_hash exist. Falling back to heuristics for deducing the number of dynamic symbols...
WARNING: Neither hash nor gnu_hash exist. Falling back to heuristics for deducing the number of dynamic symbols...
WARNING: Neither hash nor gnu_hash exist. Falling back to heuristics for deducing the number of dynamic symbols...
[x] Analyze all flags starting with sym. and entry0 (aa)

[XX] db/cmd/cmd_pd pdf fcnline with size
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'e asm.bytes=true
e asm.lines.fcn=true
s 0x004017c0
af+ 0x004017c0 fcn2.0x004017c0
afb+ 0x4017c0 0x4017c0 13 0x4017dd 0x4017cd
pdf
?e
e asm.lines.fcn=false
e asm.fcn.size=true
pdf
' bins/pe/a.exe
-- stdout
--- expected
+++ actual
@@ -2,12 +2,12 @@
 |           0x004017c0      51             push  ecx
 |           0x004017c1      89e1           mov   ecx, esp
 |           0x004017c3      83c108         add   ecx, 8
-|           0x004017c6      3d00100000     cmp   eax, 0x1000
+|           0x004017c6      3d00100000     cmp   eax, 0x1000           ; 4096
 \       ,=< 0x004017cb      7210           jb    0x4017dd

 13: fcn2.0x004017c0 ();
           0x004017c0      51             push  ecx
           0x004017c1      89e1           mov   ecx, esp
           0x004017c3      83c108         add   ecx, 8
-          0x004017c6      3d00100000     cmp   eax, 0x1000
+          0x004017c6      3d00100000     cmp   eax, 0x1000             ; 4096
       ,=< 0x004017cb      7210           jb    0x4017dd

[XX] db/cmd/cmd_pd pdf fcnline
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'e asm.bytes=true
e asm.lines.fcn=true
s 0x004017c0
af+ 0x004017c0 fcn2.0x004017c0
afb+ 0x4017c0 0x4017c0 13 0x4017dd 0x4017cd
pdf
?e
e asm.lines.fcn=false
pdf
' bins/pe/a.exe
-- stdout
--- expected
+++ actual
@@ -2,12 +2,12 @@
 |           0x004017c0      51             push  ecx
 |           0x004017c1      89e1           mov   ecx, esp
 |           0x004017c3      83c108         add   ecx, 8
-|           0x004017c6      3d00100000     cmp   eax, 0x1000
+|           0x004017c6      3d00100000     cmp   eax, 0x1000           ; 4096
 \       ,=< 0x004017cb      7210           jb    0x4017ddm
 fcn2.0x004017c0 ();
           0x004017c0      51             push  ecx
           0x004017c1      89e1           mov   ecx, esp
           0x004017c3      83c108         add   ecx, 8
-          0x004017c6      3d00100000     cmp   eax, 0x1000
+          0x004017c6      3d00100000     cmp   eax, 0x1000             ; 4096
       ,=< 0x004017cb      7210           jb    0x4017dd

[XX] db/cmd/cmd_pd immstr
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'e asm.bytes=true
e asm.bits=64
e asm.arch=x86
e analysis.arch=x86
wx 6833320000
e asm.imm.str=1
pd 1
' malloc://128
-- stdout
--- expected
+++ actual
@@ -1,1 +1,1 @@
-            0x00000000      6833320000     push  0x3233                ; '32'
+            0x00000000      6833320000     push  0x3233                ; '32' ; 12851

[**]                                      db/cmd/cmd_pi      485 OK        12 BR       21 XX        3 FX
[**]                                     db/cmd/md5sha1      486 OK        12 BR       21 XX        3 FX
[**]                                      db/cmd/cmd_pd      489 OK        12 BR       21 XX        3 FX
[**]                                      db/cmd/cmd_pc      501 OK        12 BR       21 XX        3 FX

[XX] db/cmd/bug_duplicate_vtables bug_duplicate_vtable #acll displays duplicate vtable info when using aaa command in many times
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'aaa
acll
aaa
acll
aaa
acll
' bins/elf/analysis/elf-virtualtable
-- stdout
--- expected
+++ actual
@@ -0,136 +0,64 @@
 [A]
  (vtable at 0x400d28)
-nth name            addr vt_offset type        
------------------------------------------------
-1   greet       0x400ac8 0x0       VIRTUAL
-2   printValue  0x400af4 0x8       VIRTUAL
-3   A           0x400b36 -1        CONSTRUCTOR
+nth name                         addr vt_offset type    
+--------------------------------------------------------
+1   sym._ZN1A5greetEv        0x400ac8 0x0       VIRTUAL
+2   sym._ZN1A10printValueEv  0x400af4 0x8       VIRTUAL

See https://app.travis-ci.com/github/rizinorg/rizin/jobs/542280942

Mach-O file format parsing

[XX] db/formats/mach0/arm64e macOS arm64
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'om
?e --
?e regular got
pxQ 0x28 @ 0x100008000
?e --
?e cstring
px 0x18 @ 0x100004008
?e --
?e local fcn ptr (auth, !bind)
pxr 0x18 @ sym._fcns
?e --
?e global (!auth, bind)
px 8 @ reloc._objc_empty_cache
' bins/mach0/hello-macos-arm64
-- stdout
--- expected
+++ actual
@@ -17,8 +17,8 @@
 --
 local fcn ptr (auth, !bind)
 0x100008180 ..[ null bytes ]..   00000000 sym._fcns
-0x100008188 0x0000000100003b9c   .;...... 4294982556 0.__TEXT.__text _something_else,func.100003b9c R X 'sub sp, sp, 0x20'
-0x100008190 0x0000000100003b9c   .;...... 4294982556 0.__TEXT.__text _something_else,func.100003b9c R X 'sub sp, sp, 0x20'
+0x100008188 0x9c3b000001000000   .;...... 4294982556 0.__TEXT.__text _something_else,func.100003b9c R X 'sub sp, sp, 0x20'
+0x100008190 0x9c3b000001000000   .;...... 4294982556 0.__TEXT.__text _something_else,func.100003b9c R X 'sub sp, sp, 0x20'
 --
 global (!auth, bind)
 - offset -    0 1  2 3  4 5  6 7  8 9  A B  C D  E F  0123456789ABCDEF

PE file format parsing

[XX] db/formats/pe/peio pe symbol addr
Z_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc '?v sym._malloc
p8 4
' bins/pe/base.exe
-- stdout
--- expected
+++ actual
@@ -1,2 +1,2 @@
-0x401838
+0x0
 5589e583

MDMP file format parsing:

[XX] db/formats/mdmp mdmp info
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc iI bins/mdmp/calc.dmp
-- stdout
--- expected
+++ actual
@@ -1,9 +1,9 @@
-arch     x86
+arch     N/A
 cpu      N/A
 baddr    ----------
 binsz    0x00008f74
 bintype  mdmp
-bits     64
+bits     0
 retguard false
 class    N/A
 compiler N/A
@@ -15,12 +15,12 @@0m
 intrp    N/A
 laddr    0x00000000
 lang     N/A
-machine  AMD64
-maxopsz  16
-minopsz  1
-os       Windows NT Workstation 6.1.7601
+machine  Unknown
+maxopsz  4
+minopsz  2
+os       Windows NT Workstation 100663296.16777216.-1323499520
 cc       N/A
-pcalign  0
+pcalign  2
 rpath    NONE
 streams  13
 subsys   
-- stderr
[WARN] Invalid or unsupported enumeration encountered 21
[WARN] Invalid or unsupported enumeration encountered 22
[INFO] Parsing data sections for large dumps can take time, please be patient (but if strings ain't your thing try with -z)!

DMP file format parsing:

[XX] db/formats/dmp/dmp : DMP BMP Page maps
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc om~? bins/dmp/bmp.dmp
-- stdout
--- expected
+++ actual
@@ -1,1 +1,1 @@
-21579
+0

[XX] db/formats/dmp/dmp : DMP header & bmp header
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc iH bins/dmp/bmp.dmp
-- stdout
--- expected
+++ actual
@@ --1,25 +-1,20 @@
 DUMP_HEADER64:
-  MajorVersion : 0x0000000f
-  MinorVersion : 0x000047ba
-  DirectoryTableBase : 0x00000000006d4002
-  PfnDataBase : 0xfffff80510c22468
-  PsLoadedModuleList : 0xfffff80510af62f0
-  PsActiveProcessHead : 0x5;52mfffff80510ae6980
-  MachineImageType : 0x00008664
-  NumberProcessors : 0x00000001
+  MajorVersion : 0x0f000000
+  MinorVersion : 0xba470000
+  DirectoryTableBase : 0x02406d0000000000
+  PfnDataBase : 0x6824c21005f8ffff
+  PsLoadedModuleList : 0xf062af1005f8ffff
+  PsActiveProcessHead : 0x8069ae1005f8ffff
+  MachineImageType : 0x64860000
+  NumberProcessors : 0x01000000
   BugCheckCode : 0x00000000
   BugCheckParameter1 : 0x0000000000000000
   BugCheckParameter2 : 0x0000000000000000
   BugCheckParameter3 : 0x0000000000000000
   BugCheckParameter4 : 0x0000000000000000
-  KdDebuggerDataBlock : 0xfffff80510ad45e0
-  SecondaryDataState : 0x45474150
-  ProductType : 0x45474150
-  SuiteMask : 0x45474150
-
-BITMAP_DUMP:
-  HeaderSize : 0x0000a038
-  BitmapSize : 0x00040000
-  Pages : 0x0000544b
+  KdDebuggerDataBlock : 0xe045ad1005f8ffff
+  SecondaryDataState : 0x50414745
+  ProductType : 0x50414745
+  SuiteMask : 0x50414745

NE file format parsing

[XX] db/formats/ne NE Relocs and resolve function ordinal names
RZ_NOPLUGINS=1 /home/travis/build/rizinorg/rizin/install/bin/rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'ir~WIN87EM
ir~:0..9
' bins/ne/anim8.exe
-- stdout
--- expected
+++ actual
@@ -1,18 +1,9 @@
-0x00004c98 0x00004c98 SET_32 WIN87EM.__FPMATH
-0x00004cb2 0x00004cb2 SET_16 WIN87EM.__FPMATH
-0x00004cb8 0x00004cb8 SET_16 WIN87EM.__FPMATH
-0x00004cbd 0x00004cbd SET_32 WIN87EM.__FPMATH
-0x00004ccb 0x00004ccb SET_32 WIN87EM.__FPMATH
-0x0000569a 0x0000569a ADD_16 WIN87EM.0
-0x000056a0 0x000056a0 ADD_16 WIN87EM.0
-0x000056b3 0x000056b3 ADD_16 WIN87EM.0
-0x00005891 0x00005891 ADD_16 WIN87EM.0
-vaddr      paddr      type   name                             
---------------------------------------------------------------
-0x00000a01 0x00000a01 SET_32 KERNEL.INITTASK
-0x00000a25 0x00000a25 SET_32 KERNEL.LOCKSEGMENT
-0x00000a3c 0x00000a3c SET_32 KERNEL.WAITEVENT
-0x00000a45 0x00000a45 SET_32 USER.INITAPP
-0x00000a74 0x00000a74 SET_32 KERNEL.GETWINFLAGS
-0x00000ad0 0x00000ad0 SET_32 KERNEL.UNLOCKSEGMENT
-0x00000b86 0x00000b86 SET_32 KERNEL.CATCH
+vaddr      paddr      type   name                                    
+---------------------------------------------------------------------
+0x00000a01 0x00000a01 SET_32 (null).91
+0x00000a25 0x00000a25 SET_32 (null).23
+0x00000a3c 0x00000a3c SET_32 (null).30
+0x00000a45 0x00000a45 SET_32 ����=u�(���^&�G�j>Ph'�F�PjQ���.5
+0x00000a74 0x00000a74 SET_32 (null).132
+0x00000ad0 0x00000ad0 SET_32 (null).24
+0x00000b86 0x00000b86 SET_32 (null).55

Likely most failures related to assuming the data is always little endian.

Running Linux on S390 in QEMU

XVilka commented 3 years ago

@Basstorm by the way, there are PDB tests that fail on the System-Z as well, please take a look:

[XX] db/formats/pdb GUID CHECK
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc '!rz-bin -I ${RZ_FILE} | grep -ao 15F778B3671D4EFDBDCDE79905308B792' bins/pdb/user32.dll
-- stdout
--- expected
+++ actual
@@ -1,1 +1,0 @@
-15F778B3671D4EFDBDCDE79905308B792

[XX] db/formats/pdb PDB downloader json
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc '%RZ_CURL=1
!rz-bin -PPj bins/pdb/user32.dll
' =
-- stdout
--- expected
+++ actual
@@ -1,1 +1,1 @@
-{"pdb":{"file":"user32.pdb","download":true}}
+{"pdb":{"file":"user32.pdb","download":false}}
-- stderr
Attempting to download compressed pdb in /home/travis/.local/share/rizin/pdb/user32.pdb/B378F7151D67FD4EBDCDE79905308B792000000/user32.pd_
Falling back to uncompressed pdb
Attempting to download uncompressed pdb in /home/travis/.local/share/rizin/pdb/user32.pdb/B378F7151D67FD4EBDCDE79905308B792000000/user32.pdb

[XX] db/formats/pdb idpdj
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc '%RZ_CURL=1
idpdj
' bins/pdb/user32.dll
-- stdout
--- expected
+++ actual
@@ -1,1 +1,1 @@
-{"pdb":{"file":"user32.pdb","download":true}}
+{"pdb":{"file":"user32.pdb","download":false}}
-- stderr
Attempting to download compressed pdb in /home/travis/.local/share/rizin/pdb/user32.pdb/B378F7151D67FD4EBDCDE79905308B792000000/user32.pd_
Falling back to uncompressed pdb
Attempting to download uncompressed pdb in /home/travis/.local/share/rizin/pdb/user32.pdb/B378F7151D67FD4EBDCDE79905308B792000000/user32.pdb
Error while downloading pdb file

[XX] db/formats/pdb PDB downloader check
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc '%RZ_CURL=1
!!rz-bin -PP ${RZ_FILE} ~PDB
' bins/pdb/user32.dll
-- stdout
--- expected
+++ actual
@@ -1,1 +1,1 @@
-PDB "user32.pdb" download success
+PDB "user32.pdb" download failed
-- stderr
Attempting to download compressed pdb in /home/travis/.local/share/rizin/pdb/user32.pdb/B378F7151D67FD4EBDCDE79905308B792000000/user32.pd_
Falling back to uncompressed pdb
Attempting to download uncompressed pdb in /home/travis/.local/share/rizin/pdb/user32.pdb/B378F7151D67FD4EBDCDE79905308B792000000/user32.pdb
wargio commented 3 years ago

this looks like a serious regression linked to endianness

XVilka commented 2 years ago

@Rot127 a bunch of them are from PPC disassembly and uplifting:

[XX] db/asm/ppc_64 <asm> bne cr5

-- <asm> bne cr5 <--- 00009640 ---> <IL>

-- IL

--- expected

+++ actual

@@ -1,1 +1,1 @@

-(seq (set CIA (bv 64 0x1a4)) empty empty (set NIA (ite (let bo (bv 5 0x4) (&& (|| (! (is_zero (& (bv 5 0x10) (var bo)))) (^^ (! (is_zero (& (var cr5) (bv 4 0x2)))) (! (! (is_zero (& (bv 5 0x8) (var bo))))))) (|| (! (is_zero (& (bv 5 0x4) (var bo)))) (^^ (! (is_zero (var ctr))) (! (is_zero (& (bv 5 0x2) (var bo)))))))) (bv 64 0x7) (+ (var CIA) (bv 64 0x4)))) (jmp (var NIA)))

+(seq (set CIA (bv 64 0x1a4)) empty empty (set NIA (ite (let bo (bv 5 0x4) (&& (|| (! (is_zero (& (bv 5 0x10) (var bo)))) (^^ (! (is_zero (& (var cr5) (bv 4 0x2)))) (! (! (is_zero (& (bv 5 0x8) (var bo))))))) (|| (! (is_zero (& (bv 5 0x4) (var bo)))) (^^ (! (is_zero (var ctr))) (! (is_zero (& (bv 5 0x2) (var bo)))))))) (bv 64 0x700000000) (+ (var CIA) (bv 64 0x4)))) (jmp (var NIA)))

[XX] db/asm/ppc_64 <asm> cmpldi cr7, r0, 1

-- <asm> cmpldi cr7, r0, 1 <--- 2ba00001 ---> <IL>

-- IL

--- expected

+++ actual

@@ -1,1 +1,1 @@

-(seq (set l (var r0)) (set r (append (bv 48 0x0) (bv 16 0x1))) (set so_flag (ite (var so) (bv 1 0x1) (bv 1 0x0))) (branch (&& (ule (var l) (var r)) (! (== (var l) (var r)))) (set cr7 (append (bv 3 0x4) (var so_flag))) (branch (! (ule (var l) (var r))) (set cr7 (append (bv 3 0x2) (var so_flag))) (set cr7 (append (bv 3 0x1) (var so_flag))))))

+WARNING: ppc_cmp_set_cr: assertion 'left && right && crX' failed (line 46)

Invalid instruction of lifting not implemented.

[XX] db/asm/ppc_64 <asm> cmplwi cr6, r0, 0

-- <asm> cmplwi cr6, r0, 0 <--- 2b000000 ---> <IL>

-- IL

--- expected

+++ actual

@@ -1,1 +1,1 @@

-(seq (set l (cast 64 (msb (cast 32 false (var r0))) (cast 32 false (var r0)))) (set r (cast 64 false (bv 16 0x0))) (set so_flag (ite (var so) (bv 1 0x1) (bv 1 0x0))) (branch (&& (ule (var l) (var r)) (! (== (var l) (var r)))) (set cr6 (append (bv 3 0x4) (var so_flag))) (branch (! (ule (var l) (var r))) (set cr6 (append (bv 3 0x2) (var so_flag))) (set cr6 (append (bv 3 0x1) (var so_flag))))))

+WARNING: ppc_cmp_set_cr: assertion 'left && right && crX' failed (line 46)

Invalid instruction of lifting not implemented.

[XX] db/asm/ppc_64 <asm> cmpld cr5, r0, r1

-- <asm> cmpld cr5, r0, r1 <--- 7ea00840 ---> <IL>

-- IL

--- expected

+++ actual

@@ -1,1 +1,1 @@

-(seq (set l (var r0)) (set r (var r1)) (set so_flag (ite (var so) (bv 1 0x1) (bv 1 0x0))) (branch (&& (ule (var l) (var r)) (! (== (var l) (var r)))) (set cr5 (append (bv 3 0x4) (var so_flag))) (branch (! (ule (var l) (var r))) (set cr5 (append (bv 3 0x2) (var so_flag))) (set cr5 (append (bv 3 0x1) (var so_flag))))))

+WARNING: ppc_cmp_set_cr: assertion 'left && right && crX' failed (line 46)

Invalid instruction of lifting not implemented.

[XX] db/asm/ppc_64 <asm> cmpdi cr3, r0, 1

-- <asm> cmpdi cr3, r0, 1 <--- 2da00001 ---> <IL>

-- IL

--- expected

+++ actual

@@ -1,1 +1,1 @@

-(seq (set l (var r0)) (set r (let v (bv 16 0x1) (ite (msb (var v)) (cast 64 (msb (var v)) (var v)) (cast 64 false (var v))))) (set so_flag (ite (var so) (bv 1 0x1) (bv 1 0x0))) (branch (&& (sle (var l) (var r)) (! (== (var l) (var r)))) (set cr3 (append (bv 3 0x4) (var so_flag))) (branch (! (sle (var l) (var r))) (set cr3 (append (bv 3 0x2) (var so_flag))) (set cr3 (append (bv 3 0x1) (var so_flag))))))

+WARNING: ppc_cmp_set_cr: assertion 'left && right && crX' failed (line 46)

Invalid instruction of lifting not implemented.

[XX] db/asm/ppc_64 <asm> cmplw cr4, r0, r1

-- <asm> cmplw cr4, r0, r1 <--- 7e000840 ---> <IL>

-- IL

--- expected

+++ actual

@@ -1,1 +1,1 @@

-(seq (set l (cast 64 (msb (cast 32 false (var r0))) (cast 32 false (var r0)))) (set r (cast 64 (msb (cast 32 false (var r1))) (cast 32 false (var r1)))) (set so_flag (ite (var so) (bv 1 0x1) (bv 1 0x0))) (branch (&& (ule (var l) (var r)) (! (== (var l) (var r)))) (set cr4 (append (bv 3 0x4) (var so_flag))) (branch (! (ule (var l) (var r))) (set cr4 (append (bv 3 0x2) (var so_flag))) (set cr4 (append (bv 3 0x1) (var so_flag))))))

+WARNING: ppc_cmp_set_cr: assertion 'left && right && crX' failed (line 46)

Invalid instruction of lifting not implemented.

[XX] db/asm/ppc_64 <asm> cmpd cr5, r0, r1

-- <asm> cmpd cr5, r0, r1 <--- 7ea00800 ---> <IL>

-- IL

--- expected

+++ actual

@@ -1,1 +1,1 @@

-(seq (set l (var r0)) (set r (var r1)) (set so_flag (ite (var so) (bv 1 0x1) (bv 1 0x0))) (branch (&& (sle (var l) (var r)) (! (== (var l) (var r)))) (set cr5 (append (bv 3 0x4) (var so_flag))) (branch (! (sle (var l) (var r))) (set cr5 (append (bv 3 0x2) (var so_flag))) (set cr5 (append (bv 3 0x1) (var so_flag))))))

+WARNING: ppc_cmp_set_cr: assertion 'left && right && crX' failed (line 46)

Invalid instruction of lifting not implemented.

[XX] db/asm/ppc_64 <asm> cmpw cr3, r0, r1

-- <asm> cmpw cr3, r0, r1 <--- 7d800800 ---> <IL>

-- IL

--- expected

+++ actual

@@ -1,1 +1,1 @@

-(seq (set l (cast 64 (msb (cast 32 false (var r0))) (cast 32 false (var r0)))) (set r (cast 64 (msb (cast 32 false (var r1))) (cast 32 false (var r1)))) (set so_flag (ite (var so) (bv 1 0x1) (bv 1 0x0))) (branch (&& (sle (var l) (var r)) (! (== (var l) (var r)))) (set cr3 (append (bv 3 0x4) (var so_flag))) (branch (! (sle (var l) (var r))) (set cr3 (append (bv 3 0x2) (var so_flag))) (set cr3 (append (bv 3 0x1) (var so_flag))))))

+WARNING: ppc_cmp_set_cr: assertion 'left && right && crX' failed (line 46)

Invalid instruction of lifting not implemented.

[XX] db/asm/ppc_64 <asm> cmpwi cr2, r0, 0xffff

-- <asm> cmpwi cr2, r0, 0xffff <--- 2d00ffff ---> <IL>

-- IL

--- expected

+++ actual

@@ -1,1 +1,1 @@

-(seq (set l (cast 64 (msb (cast 32 false (var r0))) (cast 32 false (var r0)))) (set r (cast 64 (msb (bv 16 0xffff)) (bv 16 0xffff))) (set so_flag (ite (var so) (bv 1 0x1) (bv 1 0x0))) (branch (&& (sle (var l) (var r)) (! (== (var l) (var r)))) (set cr2 (append (bv 3 0x4) (var so_flag))) (branch (! (sle (var l) (var r))) (set cr2 (append (bv 3 0x2) (var so_flag))) (set cr2 (append (bv 3 0x1) (var so_flag))))))

+WARNING: ppc_cmp_set_cr: assertion 'left && right && crX' failed (line 46)

Invalid instruction of lifting not implemented.
Rot127 commented 2 years ago

This test: <asm> bne cr5 <--- 00009640 ---> <IL> seems to be broken in Capstone (https://github.com/capstone-engine/capstone/issues/1914). The immediate operand is not filled and contains therefor unprocessed data.

Edit the others come from cs_reg_name. It returns NULL.

XVilka commented 2 years ago

The current count is 147 tests: https://app.travis-ci.com/github/rizinorg/rizin/jobs/585102215

Full log sysz-failures.log