rizinorg / rizin

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

Drop Capstone 3 support #3210

Closed XVilka closed 9 months ago

XVilka commented 1 year ago

Capstone 4.0 was out in 2018, most platforms already migrated:

We could announce deprecation in 0.5.0 and remove it in 0.6.0

Biggest platform that still has no CS4 is Ubuntu 18.04.6 LTS which is EOL on April 2023, it is roughly the possible time for 0.6.0, so it would be safe to remove it: https://wiki.ubuntu.com/Releases

rizin on  dev [$] took 8.1s                                                                                                                                                                                11:42:12
ℤ rg CS_API_MAJOR
librz/analysis/p/analysis_sysz.c
10:#if CS_API_MAJOR < 2

librz/analysis/p/analysis_mips_cs.c
738:#if CS_API_MAJOR > 3

librz/analysis/p/analysis_sparc_cs.c
9:#if CS_API_MAJOR < 2

librz/analysis/p/analysis_tms320c64x.c
15:#if CS_API_MAJOR < 2

librz/analysis/p/analysis_m68k_cs.c
35:#if CS_API_MAJOR >= 4

librz/analysis/p/analysis_m680x_cs.c
8:#if CS_API_MAJOR >= 4 && CS_API_MINOR >= 0

librz/analysis/p/analysis_ppc_cs.c
974:#if CS_API_MAJOR >= 4
985:#if CS_API_MAJOR > 4
1124:#if CS_API_MAJOR >= 4
1142:#if CS_API_MAJOR >= 4
1195:#if CS_API_MAJOR >= 4

librz/analysis/p/analysis_arm_cs.c
382:#if CS_API_MAJOR > 4
399:#if CS_API_MAJOR == 4
528:#if CS_API_MAJOR == 4
585:#if CS_API_MAJOR >= 4
615:#if CS_API_MAJOR > 4
821:#if CS_API_MAJOR > 3
936:#if CS_API_MAJOR > 4
1035:#if CS_API_MAJOR >= 4
1619:#if CS_API_MAJOR > 3
1667:#if CS_API_MAJOR > 3

librz/analysis/p/analysis_xcore_cs.c
9:#if CS_API_MAJOR < 2

librz/analysis/p/analysis_x86_cs.c
31:#if CS_API_MAJOR < 2
95:#if CS_API_MAJOR >= 4
129:#if CS_API_MAJOR >= 4
257:#if CS_API_MAJOR == 3
442:#if CS_API_MAJOR >= 4
525:#if CS_API_MAJOR >= 4
1765:#if CS_API_MAJOR > 4
1909:#if CS_API_MAJOR >= 4
2011:#if CS_API_MAJOR >= 4
2259:#if CS_API_MAJOR >= 4
2356:#if CS_API_MAJOR >= 4
2470:#if CS_API_MAJOR >= 4
2487:#if CS_API_MAJOR >= 4
2492:#if CS_API_MAJOR >= 4
2731:#if CS_API_MAJOR >= 4
2735:#if CS_API_MAJOR == 4
3077:#if CS_API_MAJOR == 4

librz/analysis/arch/arm/arm_accessors32.h
24:#if CS_API_MAJOR > 3

librz/analysis/arch/arm/arm_esil64.c
1057:#if CS_API_MAJOR > 3

librz/analysis/arch/arm/arm_accessors64.h
24:#if CS_API_MAJOR > 3

librz/analysis/arch/x86/x86_il.c
98:#if CS_API_MAJOR >= 4
907:#if CS_API_MAJOR <= 3

librz/analysis/arch/ppc/ppc_il_ops.c
80:#if CS_API_MAJOR > 3
252:#if CS_API_MAJOR > 3
547:#if CS_API_MAJOR > 3
1243:#if CS_API_MAJOR > 3
1292:#if CS_API_MAJOR > 3
1322:#if CS_API_MAJOR > 3

librz/analysis/arch/arm/arm_il64.c
447:#if CS_API_MAJOR > 4
465:#if CS_API_MAJOR > 4
472:#if CS_API_MAJOR > 4
698:#if CS_API_MAJOR > 4
1080:#if CS_API_MAJOR > 4
1091:#if CS_API_MAJOR > 4
1101:#if CS_API_MAJOR > 4
1112:#if CS_API_MAJOR > 4
1123:#if CS_API_MAJOR > 4
1191:#if CS_API_MAJOR > 4
1203:#if CS_API_MAJOR > 4
1254:#if CS_API_MAJOR > 4
1710:#if CS_API_MAJOR > 4
1731:#if CS_API_MAJOR > 4
1805:#if CS_API_MAJOR > 4
1841:#if CS_API_MAJOR > 3
1847:#if CS_API_MAJOR > 3
2015:#if CS_API_MAJOR > 4
2109:#if CS_API_MAJOR > 4
2332:#if CS_API_MAJOR > 4
2343:#if CS_API_MAJOR > 4
2359:#if CS_API_MAJOR > 4
2370:#if CS_API_MAJOR > 4
2382:#if CS_API_MAJOR > 4
2386:#if CS_API_MAJOR > 4
2414:#if CS_API_MAJOR > 4
2471:#if CS_API_MAJOR > 4
2488:#if CS_API_MAJOR > 4
2655:#if CS_API_MAJOR > 3
2666:#if CS_API_MAJOR > 4
2677:#if CS_API_MAJOR > 4
2717:#if CS_API_MAJOR > 4
2726:#if CS_API_MAJOR > 4

librz/analysis/arch/arm/arm_il32.c
1142:#if CS_API_MAJOR > 3
2484:#if CS_API_MAJOR > 3

librz/analysis/arch/ppc/ppc_il.c
63:#if CS_API_MAJOR > 3
102:#if CS_API_MAJOR > 3
121:#if CS_API_MAJOR > 3
143:#if CS_API_MAJOR > 3
160:#if CS_API_MAJOR > 3

librz/asm/p/asm_mips_cs.c
28:#if CS_API_MAJOR > 3

librz/asm/p/asm_m680x_cs.c
8:#if CS_API_MAJOR >= 4 && CS_API_MINOR >= 0

librz/asm/p/asm_x86_cs.c
54:#if CS_API_MAJOR >= 4
58:#if CS_API_MAJOR >= 4
ret2libc commented 1 year ago

Do we gain anything right now by removing support for Capstone 3?

XVilka commented 1 year ago

@ret2libc it was in the 0.5.0 milestone to announce the deprecation. It allows us to remove the ifdefs after the release

ret2libc commented 1 year ago

Why do we want to deprecate it? I mean, it's just a bunch of ifdef at this point and I don't think it's causing us too many problems, is it?

XVilka commented 1 year ago

Why do we need to keep it? Capstone 4 is everywhere already, Capstone 5 is about to be released, and we will focus on likely slightly incompatible results of the auto-sync project.

ret2libc commented 1 year ago

Why do we need to keep it?

Because removing it is additional work at this point, while keeping it is not.

XVilka commented 1 year ago

@ret2libc not entirely true. Take a look at capstone 5 PR - it will likely need more #ifdefs to support both CS4 and CS5. Keeping CS3 support would be unnecessary burden. Also, CS3 is way too incorrect for x86 and ARM decoding.

XVilka commented 11 months ago

Ok, now all distributions that have CS3 as the highest are EOL long time ago. We can safely drop CS3 any minute now.

ret2libc commented 11 months ago

I'd still keep CS3 if it does not require extra effort :) I understand it's wrong often, but unfortunately CS is a mandatory dependency so it's better to be able to compile rizin and have wrong results (but the chance to use other plugins) rather than not being able to have rizin at all.

XVilka commented 11 months ago

I'd still keep CS3 if it does not require extra effort :) I understand it's wrong often, but unfortunately CS is a mandatory dependency so it's better to be able to compile rizin and have wrong results (but the chance to use other plugins) rather than not being able to have rizin at all.

If you use old platform with no capstone above 3, you can always just use bundled capstone. It's super easy to do and we test it even on Debian Wheezy. Thus, should not be a reason to stop this removal, IMHO.

ret2libc commented 11 months ago

Good point, yeah. 👍