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

e- segfaults and crashes #4998

Open
divyaranjan1905 opened this issue Mar 13, 2025 · 4 comments
Open

e- segfaults and crashes #4998

divyaranjan1905 opened this issue Mar 13, 2025 · 4 comments
Labels
blocker bug Something isn't working crash rz-asm
Milestone

Comments

@divyaranjan1905
Copy link

Work environment

Questions Answers
OS/arch/bits (mandatory) GNU Guix, AMD64
File format of the file you reverse (mandatory) ELF
Architecture/bits of the file (mandatory) 8051
rizin -v full output, not truncated (mandatory) rizin 0.7.2 @ linux-x86-64, package: 0.7.2 (guix)

Expected behavior

As listed by e?, e- should reset the config variables.

Actual behavior

Doing e- crashes with a segmentation fault and no further error or backtrace is provided.

Steps to reproduce the behavior

@divyaranjan1905
Copy link
Author

Even though GNU Guix has only packaged upto 0.7.2, the same issue can be reproduced with the latest build of rizin from the dev branch.

@Rot127
Copy link
Member

Rot127 commented Mar 13, 2025

Stack trace:

[0x00000000]> e-
../librz/arch/platform_profile.c:94:18: runtime error: null pointer passed as argument 2, which is declared to never be null
    #0 0x7115cd819b1a in cpu_reload_needed ../librz/arch/platform_profile.c:94
    #1 0x7115cd81ae91 in rz_platform_profiles_init ../librz/arch/platform_profile.c:219
    #2 0x7115c6db6635 in cb_asmcpu ../librz/core/cconfig.c:429
    #3 0x7115d303a7b5 in rz_config_set_cb ../librz/config/config.c:173
    #4 0x7115c6de6f63 in rz_core_config_init ../librz/core/cconfig.c:3281
    #5 0x7115c71eda79 in rz_eval_reset_handler ../librz/core/cmd/cmd_eval.c:452
    #6 0x7115c71c9ba8 in argv_call_cb ../librz/core/cmd/cmd_api.c:742
    #7 0x7115c71ca9e4 in call_cd ../librz/core/cmd/cmd_api.c:801
    #8 0x7115c71cac5c in rz_cmd_call_parsed_args ../librz/core/cmd/cmd_api.c:819
    #9 0x7115c7197c56 in handle_ts_arged_stmt_internal ../librz/core/cmd/cmd.c:3216
    #10 0x7115c7196a38 in handle_ts_arged_stmt ../librz/core/cmd/cmd.c:3164
    #11 0x7115c71b81d5 in handle_ts_stmt ../librz/core/cmd/cmd.c:4803
    #12 0x7115c71b9a43 in handle_ts_statements_internal ../librz/core/cmd/cmd.c:4860
    #13 0x7115c71b8af8 in handle_ts_statements ../librz/core/cmd/cmd.c:4825
    #14 0x7115c71baf40 in core_cmd_tsrzcmd ../librz/core/cmd/cmd.c:4972
    #15 0x7115c71bb7a1 in rz_core_cmd ../librz/core/cmd/cmd.c:5020
    #16 0x7115c6e83ecd in rz_core_prompt_exec ../librz/core/core.c:1931
    #17 0x7115c6e81d8c in rz_core_prompt_loop ../librz/core/core.c:1800
    #18 0x7115d32e3c1a in rz_main_rizin ../librz/main/rizin.c:1469
    #19 0x401a5f in main ../binrz/rizin/rizin.c:57
    #20 0x7115d2838087 in __libc_start_call_main (/lib64/libc.so.6+0x2a087) (BuildId: c8c3fa52aaee3f5d73b6fd862e39e9d4c010b6ba)
    #21 0x7115d283814a in __libc_start_main_impl (/lib64/libc.so.6+0x2a14a) (BuildId: c8c3fa52aaee3f5d73b6fd862e39e9d4c010b6ba)
    #22 0x4011d4 in _start (/usr/local/bin/rizin+0x4011d4) (BuildId: f4f2bfc3b96322cc69c294647c791a386cb77ce9)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../librz/arch/platform_profile.c:94:18 in 
Aborted (core dumped)

@Rot127 Rot127 added bug Something isn't working rz-asm blocker labels Mar 13, 2025
@notxvilka notxvilka added this to the 0.8.0 milestone Mar 13, 2025
@divyaranjan1905
Copy link
Author

Since I'm interested in getting to work with rizin better, so I'll take this as an opportunity to debug and work on this. But from @Rot127 's stack trace, it looks like we have got a classic null-pointer problem?

@Rot127
Copy link
Member

Rot127 commented Mar 13, 2025

Yeah, there is an rz_return_val_if_fail() missing in rz_platform_profiles_init. But it also should never pass a NULL pointer there. Just adding the assert is not enough. Feel free to debug why it passes a NULL pointer in the first place :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker bug Something isn't working crash rz-asm
Projects
None yet
Development

No branches or pull requests

3 participants