binaryninja-api icon indicating copy to clipboard operation
binaryninja-api copied to clipboard

prevent Binary Ninja from being installed in BNGetUserDirectory()

Open arcturus-prime opened this issue 1 year ago • 8 comments

Version and Platform (required):

  • Binary Ninja Version: 4.0.5336-stable
  • OS: Ubuntu Linux
  • OS Version: 24.04 LTS
  • CPU Architecture: x64

Bug Description: Attempting to start a fresh copy of Binary Ninja results in a panic about SetLoggerError. The file paths are related to dwarf_import and dwarf_export. After disabling these and the RISC-V architecture plugin, it starts without -p. The error message prior to disabling anything is:

thread '<unnamed>' panicked at 'Unable to initialize logger: SetLoggerError(())', examples/dwarf/dwarf_export/src/lib.rs:786:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5

After temporarily starting with -p and disabling the Dwarf Import and Dwarf Export core plugins:

thread '<unnamed>' panicked at 'Failed to set up logging: SetLoggerError(())', src/lib.rs:2855:56
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

At this point, using the debug log flag reveals this at the time of the panic:

[0:11103607258094950935 Core info] Loaded native plugin arch_riscv
[0:11103607258094950935 Core debug] Plugin Path: /home/arcprime/.binaryninja/plugins/libarch_riscv.so

Disabling the RISC-V architecture plugin resolves this last message and allows Binary Ninja to start without -p.

Steps To Reproduce: Please provide all steps required to reproduce the behavior:

  1. Start Binary Ninja through the command line
  2. Error immediately appears

Expected Behavior: Binary Ninja should succeed in loading with the core plugins enabled.

Additional Information: I attempted to switch to the dev channel as suggested, both after starting with -p and after disabling these specific plugins. I was met with an error message which is attached below. Dismissing this error allowed Binary Ninja to start, but there was no change in the channel.

Screenshot from 2024-06-24 18-42-51

arcturus-prime avatar Jun 25 '24 00:06 arcturus-prime

Try using https://binary.ninja/recover/ requesting the dev branch. This almost sounds like some file corruption.

psifertex avatar Jun 25 '24 01:06 psifertex

Can also double check the stable installer hashes against https://binary.ninja/js/hashes.js (though not dev)

psifertex avatar Jun 25 '24 01:06 psifertex

I just verified the hash for stable, it matches. I will request the dev branch though.

arcturus-prime avatar Jun 25 '24 01:06 arcturus-prime

I requested the developer builds and I am encountering the same exact issue with those. Disabling the 3 plugins resolves the error as before.

arcturus-prime avatar Jun 25 '24 01:06 arcturus-prime

After deleting my configuration in .config and installing to another location, I seem to resolved the issue. In all honesty, I don't really know what the issue was there.

arcturus-prime avatar Jun 25 '24 01:06 arcturus-prime

Very strange. No idea what might have caused that but glad it's resolved. Thanks for letting us know.

psifertex avatar Jun 25 '24 01:06 psifertex

Actually, I just realized that Binary Ninja makes a folder named .binaryninja in $HOME. In a spectacular failure, I happened to name the installation folder the same thing. User fail.

arcturus-prime avatar Jun 25 '24 01:06 arcturus-prime

Ohhh, that will do it. We'll actually throw a warning into the product to prevent that. You might not be the first person to have done it. Makes way more sense now why the update failed.

I'm going to re-open this issue to track that guard-rail.

psifertex avatar Jun 25 '24 01:06 psifertex

Since on Linux installing binja merely means to extract it, we cannot really prevent people from accidentally installing binja into that directory. Probably need to detect the case and throw a warning in a more discoverable way

xusheng6 avatar Jul 02 '24 04:07 xusheng6