Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAPSTONE-NG (AFTER 5.0) #3564

Closed
wants to merge 8 commits into from
Closed

CAPSTONE-NG (AFTER 5.0) #3564

wants to merge 8 commits into from

Conversation

XVilka
Copy link
Member

@XVilka XVilka commented Jun 8, 2023

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository
  • I made sure to follow the project's coding style
  • I've documented or updated the documentation of every function and struct this PR changes. If not so I've explained why.
  • I've added tests that prove my fix is effective or that my feature works (if possible)
  • I've updated the rizin book with the relevant information (if needed)

Detailed description

Once auto-sync for ARM, AARCH64, PPC is merged, corresponding tests should be fixed and this PR merged into dev

Test plan

CI is green, no additional BROKEN marks compared to the current dev

Closing issues

Depends on:

@XVilka XVilka added this to the 0.7.0 milestone Jun 9, 2023
@XVilka XVilka mentioned this pull request Jun 16, 2023
5 tasks
XVilka referenced this pull request in bkoppelmann/qemu Jun 27, 2023
this are the changes from volumit
(https://github.com/volumit/qemu/commits/master) compacted into one
patch.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
@XVilka
Copy link
Member Author

XVilka commented Jun 30, 2023

As capstone-engine/capstone@f8f50f0 was merged, this branch should be updated and removed using % from tests for the Tricore registers

@imbillow

This comment was marked as resolved.

@XVilka

This comment was marked as outdated.

@XVilka
Copy link
Member Author

XVilka commented Jul 5, 2023

There is one problem that fails our ASAN build: capstone-engine/capstone#1978

@imbillow
Copy link
Contributor

imbillow commented Jul 5, 2023

There is one problem that fails our ASAN build: capstone-engine/capstone#1978

We can use werror=false for capstone subproject

@Rot127
Copy link
Member

Rot127 commented Jul 5, 2023

Hope this helps: capstone-engine/capstone#2075

@XVilka
Copy link
Member Author

XVilka commented Jul 6, 2023

Please rebase and update to the latest capstone commit, before ARM auto-sync PR is merged (I hope it will happen now)

@XVilka
Copy link
Member Author

XVilka commented Jul 6, 2023

Nice! Looks like now it produces much better results on SPARC after that fix:

[XX] db/analysis/sparc Analyze bb with branch delay instruction head
RZ_NOPLUGINS=1 /private/var/folders/bc/yvvw2g2s4jlg9r8x7tf61xv800009d/T/woodpecker-local-1287038090/rizinorg/rizin/prefix/bin/rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -eflirt.sigdb.load.system=false -eflirt.sigdb.load.home=false -N -Qc 's 0x0001bc04
af
afb
' bins/elf/elf-solaris-sparc-ls
-- stdout
--- expected
+++ actual
@@ -8,6 +8,6 @@
 0x0001bc98 0x0001bca8 00:0000 16 j 0x0001bcf8 f 0x0001bca8
 0x0001bca8 0x0001bcbc 00:0000 20 j 0x0001bcf8 f 0x0001bcbc
 0x0001bcbc 0x0001bcc4 00:0000 8 j 0x0001bc34 f 0x0001bcc4
-0x0001bcc4 0x0001bcec 00:0000 40 j 0x0001bc70 f 0x0001bcec
+0x0001bcc4 0x0001bcec 00:0000 40 f 0x0001bcec
 0x0001bcec 0x0001bcf8 00:0000 12 j 0x0001bc70 f 0x0001bcf8
 0x0001bcf8 0x0001bd00 00:0000 8

[XX] db/analysis/sparc analysis.fcnprefix sparc
RZ_NOPLUGINS=1 /private/var/folders/bc/yvvw2g2s4jlg9r8x7tf61xv800009d/T/woodpecker-local-1287038090/rizinorg/rizin/prefix/bin/rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -eflirt.sigdb.load.system=false -eflirt.sigdb.load.home=false -N -Qc 's 0x00018c08
e analysis.fcnprefix=root
af
afl
' bins/elf/elf-solaris-sparc-ls
-- stdout
--- expected
+++ actual
@@ -1,1 +1,92 @@
-0x00018c08  357 8388 -> 7340 main
+0x00018c08  344 8388 -> 7276 main
+0x0001b334    7 136          sym.set_program_name
+0x0003fb78    1 12           sym.imp.setlocale
+0x0003f98c    2 60           sym.imp.atexit
+0x0003fb60    1 12           sym.imp.abort
+0x00022a74    2 24           sym.set_quoting_style
+0x0003fb84    1 12           sym.imp.getenv
+0x0001b59c   14 248          sym.argmatch
+0x00021a50   26 416  -> 396  sym.human_options
+0x0003fb90    1 12           sym.imp.ioctl
+0x00025948   53 796          sym.xstrtoul
+0x0001f7c4    1 44           sym.rpl_getopt_long
+0x0001f720    1 116          sym._getopt_internal
+0x0001eb64  181 3004         sym._getopt_internal_r
+0x00018954    4 696          sym.usage
+0x0003fb6c    1 12           sym.imp.fprintf
+0x0003f998    1 12           sym.imp.exit
+0x0003f9e0    1 12           sym.imp.printf
+0x0003fb00    1 12           sym.imp.fwrite
+0x0003fa40    1 12           sym.imp..udiv
+0x00022a24    2 56           sym.clone_quoting_options
+0x00025720    1 32           sym.xmemdup
+0x00022a5c    2 24           sym.get_quoting_style
+0x00022a8c    2 80           sym.set_char_quoting
+0x0003fa4c    1 12           sym.imp..umul
+0x000255f0    3 56           sym.xmalloc
+0x0003fc20    1 12           sym.imp.malloc
+0x0001b558    1 44           sym.xalloc_die
+0x0001bb8c    4 120          sym.error
+0x0001386c    5 180          sym.clear_files
+0x0003f9f8    1 12           sym.imp.free
+0x00015f6c  129 2740 -> 2480 sym.gobble_file
+0x00013774    1 16           sym.dev_ino_free
+0x00013784    1 32           sym.free_pending_ent
+0x0003fb9c    1 12           sym.imp.opendir
+0x0001ba88    1 8            sym.dirfd
+0x0003fba8    1 12           sym.imp.fstat64
+0x0003fbb4    1 12           sym.imp.readdir64
+0x00013d0c    6 72           sym.patterns_match
+0x0001e84c    3 552  -> 80   sym.gnu_fnmatch
+0x0003fa70    1 12           sym.imp.strlen
+0x0001caf4  198 2792 -> 2732 sym.internal_fnmatch
+0x00013cd8    1 52           sym.file_failure
+0x0003fbc0    1 12           sym.imp.closedir
+0x00015c2c   13 396  -> 368  sym.sort_files
+0x00016a20   31 748  -> 508  sym.quote_name
+0x0003fb0c    1 12           sym.imp.memcpy
+0x0003f9d4    1 12           sym.imp.fputs
+0x00016da0   31 420          sym.restore_default_color
+0x0003fb18    1 12           sym.imp.fflush
+0x0003fbcc    1 12           sym.imp.sigismember
+0x0003fb3c    1 12           sym.imp.signal
+0x0003fb30    1 12           sym.imp.raise
+0x0003fbd8    1 12           sym.imp.isatty
+0x000237dc    1 108          sym.quotearg
+0x000237a8    1 28           sym.quotearg_n
+0x00023634   15 372          sym.quotearg_n_options
+0x000237c4    1 24           sym.quotearg_n_mem
+0x00022afc    1 12           sym.quoting_options_from_style
+0x0001b7e4    3 88           sym.__xargmatch_internal
+0x0001b694    3 88           sym.argmatch_invalid
+0x0001b6ec    9 248          sym.argmatch_valid
+0x00013920    1 40           sym.add_ignore_pattern
+0x0001b528    1 48           sym.version_etc
+0x0001b3e4   16 324  -> 316  sym.version_etc_va
+0x00013d80   22 476  -> 344  sym.extract_dirs_from_files
+0x00017b7c    3 3544 -> 56   sym.print_current_files
+0x0003fa64    1 12           sym.imp.__assert_c99
+0x00022414   23 408          sym._obstack_newchunk
+0x0002396c    3 588          sym.quotearg_colon
+0x0003faa0    1 12           sym.imp.stat64
+0x0003f9ec    1 12           sym.imp.__flsbuf
+0x0001f998    1 8            sym.hash_get_n_entries
+0x000201f0   26 324          sym.hash_free
+0x0001f8d0   10 184          sym.hard_locale
+0x0003fa04    1 12           sym.imp.strncmp
+0x0003fbe4    1 12           sym.imp.strchr
+0x00022768    1 700          sym.quote
+0x000137a4    9 132          sym.is_colored
+0x0003fbf0    1 12           sym.imp.tcgetpgrp
+0x0003fbfc    1 12           sym.imp.sigemptyset
+0x0003fc08    1 12           sym.imp.sigaction
+0x0003fc14    1 12           sym.imp.sigaddset
+0x0001ff34   27 480          sym.hash_initialize
+0x00022250    8 224          sym._obstack_begin
+0x00013620   12 240          sym.dired_dump_obstack
+0x00013c38    5 104          sym.queue_directory
+0x00025758   14 436          sym.xstrtol_fatal
+0x00025740    1 24           sym.xstrdup
+0x00013948    1 64           sym.get_funky_string
+0x0003fa28    1 12           sym.imp.strcmp
+0x0003fc2c    1 12           sym.imp.acl_trivial

Needs to be carefully rechecked though

@XVilka
Copy link
Member Author

XVilka commented Jul 7, 2023

@imbillow after the recent change of Tricore IMM representation, now also calls look wrong (no need to add # in case there is a symbol):

$ rizin -A test/bins/elf/float_ex1/float_ex1_hightec
[0x80000000]> pdf @ dbg.prout
            ;-- prout:
╭ void *dbg.prout(void *str, const char *buf, size_t n);
│           ; arg void *str @ a15
│           ; arg size_t n @ d4
│           ; arg const char *buf @ a5
│           0x80000c04      404f           mov.aa a15, a4              ; printf.c:5 ; arg5 ; void *prout(void *str, const char *buf, size_t n);
│           0x80000c06      024f           mov   d15, d4
│           0x80000c08      4054           mov.aa a4, a5               ; printf.c:6 ; arg6
│           0x80000c0a      02f5           mov   d5, d15
│           0x80000c0c      8214           mov   d4, #1
│           0x80000c0e      40f5           mov.aa a5, a15
│           0x80000c10      6d003e08       call  #dbg.fwrite           ; size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream)
│           0x80000c14      0bf20021       eq    d2, d2, d15
│           0x80000c18      80ff           mov.d d15, a15              ; printf.c:7
│           0x80000c1a      2bf250f2       seln  d15, d2, d2, d15
│           0x80000c1e      60f2           mov.a a2, d15
╰           0x80000c20      0090           ret
[0x80000000]>

@XVilka
Copy link
Member Author

XVilka commented Jul 15, 2023

Superseded by #3653

@XVilka XVilka closed this Jul 15, 2023
@imbillow imbillow deleted the capstone-ng branch September 1, 2023 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants