rizin icon indicating copy to clipboard operation
rizin copied to clipboard

Refactor the <entries> in RzBinPlugin from list to pvector

Open PeiweiHu opened this issue 1 year ago • 4 comments

Your checklist for this pull request

  • [x] I've read the guidelines for contributing to this repository
  • [x] 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

...

Test plan

CI is green.

Closing issues

partially address https://github.com/rizinorg/rizin/issues/3755 closes https://github.com/rizinorg/rizin/issues/3775

PeiweiHu avatar Jan 17 '24 09:01 PeiweiHu

@PeiweiHu still fails on ASAN builds, but the error is unclear from the logs. I recommend to run it locally to check and see the problem.

XVilka avatar Jan 19 '24 10:01 XVilka

@PeiweiHu Hi! Any progress with this? Would be nice to get this merged before the release (roughly in 2 weeks or so).

XVilka avatar Feb 06 '24 14:02 XVilka

@PeiweiHu Hi! Any progress with this? Would be nice to get this merged before the release (roughly in 2 weeks or so).

Too busy these days. But I think I can finish this in 2 weeks.

PeiweiHu avatar Feb 07 '24 02:02 PeiweiHu

The output before and after adopting PR is different during the test:

ASAN_OPTIONS=detect_leaks=0:detect_odr_violation=0:allocator_may_return_null=1 rz-test test/db/analysis/dalvik

The error is shown as follows. But I don't understand why this PR can cause this....

[XX] /Users/none/Codebase/rizin/test/db/analysis/dalvik Resolve also exception paths found after gotos/returns
RZ_NOPLUGINS=1 /usr/local/bin/rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -eflirt.sigdb.load.system=false -eflirt.sigdb.load.home=false -N -Qc 'aaa
axg @ 0x800000021c
' apk://bins/dex/ade8bef0ac29fa363fc9afd958af0074478aef650adeb0318517b48bd996d5d5.apk
-- stdout
../librz/diff/diff.c:388:12: runtime error: call to function line_elem_at through pointer to incorrect function type 'const void *(*)(const void *, unsigned int)'
lines_diff.c:50: note: line_elem_at defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/diff/diff.c:388:12 in
../librz/diff/unified_diff.c:95:10: runtime error: call to function line_elem_at through pointer to incorrect function type 'const void *(*)(const void *, unsigned int)'
lines_diff.c:50: note: line_elem_at defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/diff/unified_diff.c:95:10 in
../librz/diff/unified_diff.c:96:3: runtime error: call to function line_stringify through pointer to incorrect function type 'void (*)(const void *, RzStrBuf *)'
lines_diff.c:62: note: line_stringify defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/diff/unified_diff.c:96:3 in
../librz/util/list.c:193:3: runtime error: call to function group_op_free through pointer to incorrect function type 'void (*)(void *)'
diff.c:702: note: group_op_free defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/util/list.c:193:3 in
--- expected
+++ actual
@@ -1,77 +1,0 @@
-- 0x800000021c fcn 0x800000021c sym.android.telephony.TelephonyManager.String_getDeviceId
-  - 0x100018936 fcn 0x1000186b0 method.public.static.com.network.android.SmsReceiver.void_a_org.xmlpull.v1.XmlSerializer__java.io.StringWriter__android.content.Context
-  - 0x1000186b0 fcn 0x1000186b0 method.public.static.com.network.android.SmsReceiver.void_a_org.xmlpull.v1.XmlSerializer__java.io.StringWriter__android.content.Context
-    - 0x100025f78 fcn 0x100025f70 fcn.100025f70
-    - 0x100025f70 fcn 0x100025f70 fcn.100025f70
-      - 0x10002666c fcn 0x10002653c method.public.static.com.network.android.g.a
-      - 0x10002653c fcn 0x10002653c method.public.static.com.network.android.g.a
-        - 0x100019cac fcn 0x100019c60 method.public.static.com.network.android.a.c.void_a_android.content.Context__int
-        - 0x100019c60 fcn 0x100019c60 method.public.static.com.network.android.a.c.void_a_android.content.Context__int
-          - 0x100019d1c fcn 0x100019c60 method.public.static.com.network.android.a.c.void_a_android.content.Context__int
-          - 0x100019e00 fcn 0x100019c60 method.public.static.com.network.android.a.c.void_a_android.content.Context__int
-          - 0x10001c7a0 fcn 0x10001c6f0 method.public.final.com.network.android.a.j.void_run
-        - 0x10001ac02 fcn 0x10001abb8 method.public.static.com.network.android.a.c.void_a_android.content.Context__byte____boolean__boolean
-        - 0x10001abb8 fcn 0x10001abb8 method.public.static.com.network.android.a.c.void_a_android.content.Context__byte____boolean__boolean
-          - 0x10001ab9e fcn 0x10001ab9c method.public.static.com.network.android.a.c.void_a_android.content.Context__byte
-          - 0x10001ab9c fcn 0x10001ab9c method.public.static.com.network.android.a.c.void_a_android.content.Context__byte
-            - 0x100027fe2 fcn 0x100027fb4 method.public.static.com.network.android.j.boolean_a_android.content.Context__boolean__boolean__short
-            - 0x100027fb4 fcn 0x100027fb4 method.public.static.com.network.android.j.boolean_a_android.content.Context__boolean__boolean__short
-              - 0x100027e8e fcn 0x100027df0 method.public.static.com.network.android.j.boolean_a_android.content.Context__boolean__boolean
-              - 0x100027df0 fcn 0x100027df0 method.public.static.com.network.android.j.boolean_a_android.content.Context__boolean__boolean
-                - 0x10001c948 fcn 0x10001c918 method.public.final.com.network.android.a.l.void_run
-                - 0x10001c918 fcn 0x10001c918 method.public.final.com.network.android.a.l.void_run
-                  - 0x10000ed93 ???
-                - 0x10001dcd4 fcn 0x10001dcb0 method.public.static.com.network.android.agent.NetworkApp.void_b_android.content.Context
-                - 0x10001dcb0 fcn 0x10001dcb0 method.public.static.com.network.android.agent.NetworkApp.void_b_android.content.Context
-                  - 0x10001dc44 fcn 0x10001daf4 method.static.synthetic.com.network.android.agent.NetworkApp.void_a_com.network.android.agent.NetworkApp
-                  - 0x10001daf4 fcn 0x10001daf4 method.static.synthetic.com.network.android.agent.NetworkApp.void_a_com.network.android.agent.NetworkApp
-                    - 0x10001e918 fcn 0x10001e914 method.public.final.com.network.android.agent.c.void_run
-                  - 0x10001ea30 fcn 0x10001ea2c method.public.final.com.network.android.agent.e.void_run
-                - 0x10001dd60 fcn 0x10001dcb0 method.public.static.com.network.android.agent.NetworkApp.void_b_android.content.Context
-                - 0x10001ddb0 fcn 0x10001dcb0 method.public.static.com.network.android.agent.NetworkApp.void_b_android.content.Context
-                - 0x10001ed72 fcn 0x10001eca0 method.protected.final.com.network.android.android.monitor.AppServicePinger.void_onHandleIntent_android.content.Intent
-                - 0x1000285e2 fcn 0x1000285d4 method.public.static.com.network.android.j.boolean_c_android.content.Context
-                - 0x1000285d4 fcn 0x1000285d4 method.public.static.com.network.android.j.boolean_c_android.content.Context
-                  - 0x100028322 fcn 0x1000282fc method.public.static.com.network.android.j.void_b_android.content.Context
-                  - 0x1000282fc fcn 0x1000282fc method.public.static.com.network.android.j.void_b_android.content.Context
-                    - 0x100028812 fcn 0x1000287f4 method.public.final.com.network.android.l.void_run
-                  - 0x100028802 fcn 0x1000287f4 method.public.final.com.network.android.l.void_run
-                - 0x100045a44 fcn 0x100045a1c method.public.final.com.network.h.k.void_run
-              - 0x10002d7aa fcn 0x10002d714 method.protected.static.com.network.android.monitor.observer.BatteryReceiver.void_a_android.content.Intent__android.content.Context
-              - 0x10002d714 fcn 0x10002d714 method.protected.static.com.network.android.monitor.observer.BatteryReceiver.void_a_android.content.Intent__android.content.Context
-                - 0x10002d6f8 fcn 0x10002d6c4 method.public.static.com.network.android.monitor.observer.BatteryReceiver.String_a_android.content.Context
-                - 0x10002d6c4 fcn 0x10002d6c4 method.public.static.com.network.android.monitor.observer.BatteryReceiver.String_a_android.content.Context
-                  - 0x1000188ec fcn 0x1000186b0 method.public.static.com.network.android.SmsReceiver.void_a_org.xmlpull.v1.XmlSerializer__java.io.StringWriter__android.content.Context
-                - 0x10002fc8c fcn 0x10002fc84 method.public.final.com.network.android.monitor.observer.s.void_run
-            - 0x10002811a fcn 0x100028064 method.public.static.com.network.android.j.boolean_a_android.telephony.TelephonyManager__android.content.Context__boolean__android.net.ConnectivityManager
-            - 0x100028064 fcn 0x100028064 method.public.static.com.network.android.j.boolean_a_android.telephony.TelephonyManager__android.content.Context__boolean__android.net.ConnectivityManager
-              - 0x10001eb52 fcn 0x10001eac4 method.public.final.com.network.android.agent.g.void_run
-              - 0x100027f7a fcn 0x100027df0 method.public.static.com.network.android.j.boolean_a_android.content.Context__boolean__boolean
-          - 0x10001c09c fcn 0x10001c074 method.private.static.com.network.android.a.c.void_g_android.content.Context
-          - 0x10001c074 fcn 0x10001c074 method.private.static.com.network.android.a.c.void_g_android.content.Context
-            - 0x100019eae fcn 0x100019e34 method.public.static.com.network.android.a.c.void_a_android.content.Context__int__int__int
-            - 0x100019e34 fcn 0x100019e34 method.public.static.com.network.android.a.c.void_a_android.content.Context__int__int__int
-              - 0x10001c440 fcn 0x10001c404 method.public.final.com.network.android.a.f.void_run
-              - 0x10001c48a fcn 0x10001c404 method.public.final.com.network.android.a.f.void_run
-              - 0x10001ea86 fcn 0x10001ea68 method.public.final.com.network.android.agent.f.void_run
-            - 0x100019f70 fcn 0x100019ed8 method.public.static.com.network.android.a.c.void_a_android.content.Context__int__String
-            - 0x100019ed8 fcn 0x100019ed8 method.public.static.com.network.android.a.c.void_a_android.content.Context__int__String
-              - 0x10001c8d0 fcn 0x10001c7f8 method.public.final.com.network.android.a.k.void_onReceive_android.content.Context__android.content.Intent
-            - 0x10001a1a2 fcn 0x100019f98 method.public.static.com.network.android.a.c.void_a_android.content.Context__int__String__int
-            - 0x100019f98 fcn 0x100019f98 method.public.static.com.network.android.a.c.void_a_android.content.Context__int__String__int
-              - 0x100019d90 fcn 0x100019c60 method.public.static.com.network.android.a.c.void_a_android.content.Context__int
-              - 0x100019de0 fcn 0x100019c60 method.public.static.com.network.android.a.c.void_a_android.content.Context__int
-              - 0x10001b088 fcn 0x10001b084 method.public.static.com.network.android.a.c.void_b_android.content.Context__int
-              - 0x10001b084 fcn 0x10001b084 method.public.static.com.network.android.a.c.void_b_android.content.Context__int
-                - 0x10001c2e2 fcn 0x10001c1c8 method.public.final.com.network.android.a.e.void_run
-                - 0x10001c39e fcn 0x10001c1c8 method.public.final.com.network.android.a.e.void_run
-                - 0x10001c41c fcn 0x10001c404 method.public.final.com.network.android.a.f.void_run
-                - 0x10001c74c fcn 0x10001c6f0 method.public.final.com.network.android.a.j.void_run
-              - 0x10001bf4a fcn 0x10001befc method.public.static.com.network.android.a.c.void_e_android.content.Context
-              - 0x10001befc fcn 0x10001befc method.public.static.com.network.android.a.c.void_e_android.content.Context
-                - 0x10001c9f4 fcn 0x10001c9f0 method.public.final.com.network.android.a.m.void_run
-              - 0x10001c6ba fcn 0x10001c6ac method.public.final.com.network.android.a.i.void_run
-          - 0x10001c962 fcn 0x10001c918 method.public.final.com.network.android.a.l.void_run
-        - 0x10001c248 fcn 0x10001c1c8 method.public.final.com.network.android.a.e.void_run
-        - 0x100028408 fcn 0x1000282fc method.public.static.com.network.android.j.void_b_android.content.Context
-  - 0x10001a24e fcn 0x100019f98 method.public.static.com.network.android.a.c.void_a_android.content.Context__int__String__int

../librz/diff/diff.c:300:3: runtime error: call to function line_free through pointer to incorrect function type 'void (*)(const void *)'
lines_diff.c:67: note: line_free defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/diff/diff.c:300:3 in
../librz/diff/diff.c:301:3: runtime error: call to function line_free through pointer to incorrect function type 'void (*)(const void *)'
lines_diff.c:67: note: line_free defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/diff/diff.c:301:3 in
-- stderr
../librz/util/vector.c:509:7: runtime error: call to function compare_strings through pointer to incorrect function type 'int (*)(const void *, const void *, void *)'
pal.c:130: note: compare_strings defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/util/vector.c:509:7 in
../librz/lang/lang.c:128:3: runtime error: call to function lang_c_init through pointer to incorrect function type 'int (*)(struct rz_lang_t *)'
c.c:99: note: lang_c_init defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/lang/lang.c:128:3 in
../librz/util/ht/ht_inc.c:23:26: runtime error: call to function sdb_hash through pointer to incorrect function type 'unsigned int (*)(const void *)'
util.c:22: note: sdb_hash defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/util/ht/ht_inc.c:23:26 in
../librz/util/sdb/src/sdb.c:252:27: runtime error: call to function sdb_hash through pointer to incorrect function type 'unsigned int (*)(const void *)'
util.c:22: note: sdb_hash defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/util/sdb/src/sdb.c:252:27 in
../librz/util/sdb/src/ls.c:139:3: runtime error: call to function sdbkv_free through pointer to incorrect function type 'void (*)(void *)'
sdb.c:511: note: sdbkv_free defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/util/sdb/src/ls.c:139:3 in
../librz/config/config.c:176:8: runtime error: call to function cb_analysiscc through pointer to incorrect function type 'bool (*)(void *, void *)'
cconfig.c:2647: note: cb_analysiscc defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/config/config.c:176:8 in
../librz/config/config.c:186:8: runtime error: call to function cb_analysis_gp through pointer to incorrect function type 'bool (*)(void *, void *)'
cconfig.c:2658: note: cb_analysis_gp defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/config/config.c:186:8 in
../librz/config/config.c:340:8: runtime error: call to function cb_analysis_limits through pointer to incorrect function type 'bool (*)(void *, void *)'
cconfig.c:2672: note: cb_analysis_limits defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/config/config.c:340:8 in
../librz/util/list.c:689:14: runtime error: call to function regcmp through pointer to incorrect function type 'int (*)(const void *, const void *)'
reg.c:238: note: regcmp defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/util/list.c:689:14 in
../librz/util/vector.c:368:2: runtime error: call to function rz_type_callable_arg_free through pointer to incorrect function type 'void (*)(void *)'
function.c:101: note: rz_type_callable_arg_free defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/util/vector.c:368:2 in
../librz/util/ht/ht_inc.c:143:5: runtime error: call to function sdbkv_fini through pointer to incorrect function type 'void (*)(struct ht_pp_kv *)'
sdbht.c:6: note: sdbkv_fini defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/util/ht/ht_inc.c:143:5 in
../librz/util/list.c:193:3: runtime error: call to function rz_reg_profile_alias_free through pointer to incorrect function type 'void (*)(void *)'
profile.c:27: note: rz_reg_profile_alias_free defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/util/list.c:193:3 in
../subprojects/tree-sitter-0.20.7/lib/src/./parser.c:1790:38: runtime error: call to function tree_sitter_rzcmd_external_scanner_create through pointer to incorrect function type 'void *(*)(void)'
scanner.c:24: note: tree_sitter_rzcmd_external_scanner_create defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../subprojects/tree-sitter-0.20.7/lib/src/./parser.c:1790:38 in
../librz/cons/cons.c:375:3: runtime error: call to function rz_core_break through pointer to incorrect function type 'void (*)(void *)'
core.c:2092: note: rz_core_break defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/cons/cons.c:375:3 in

-- exit status: -1
[10/10]                     9 OK         0 BR        1 XX        0 FX
Finished in 32 seconds.

PeiweiHu avatar Feb 16 '24 15:02 PeiweiHu