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

Segmentation fault opening main iaito window (M1 Mac, macOS 12) #67

Closed
Maxung opened this issue Feb 6, 2022 · 17 comments
Closed

Segmentation fault opening main iaito window (M1 Mac, macOS 12) #67

Maxung opened this issue Feb 6, 2022 · 17 comments

Comments

@Maxung
Copy link

Maxung commented Feb 6, 2022

Environment Details

QCommandLineParser: already having an option named "w"
iaito 5.5.0
Sun Feb  6 15:24:56 CET 2022
radare2 5.6.0 27361 @ darwin-arm-64 git.5.6.0
commit: e9e600a9a4c22a1e4aa901ab50e1d744648bd722 build: 2022-02-06__13:47:14
Darwin arm64

Description

Iaito crashes (seg fault) after pressing start on the file selection dialog. It doesn't matter if I select a file or check "don't open any file". Installed r2 from source successfully (and fully working).

Following was used to build iaito:

brew install qmake qt@5
brew link --force qt@5
git clone https://github.com/radareorg/iaito.git
cd iaito
./configure
make -j8
make run #or make install

Following is the lldb output (with and without selected file):

(lldb) process launch
Process 69657 launched: '/usr/local/bin/iaito' (arm64)
2022-02-06 15:31:39.345526+0100 iaito[69657:600121] QCommandLineParser: already having an option named "w"
2022-02-06 15:31:40.050198+0100 iaito[69657:600121] Plugins are loaded from "/Users/max/Library/Application Support/radareorg/iaito/plugins"
2022-02-06 15:31:40.050264+0100 iaito[69657:600121] Loaded 0 plugin(s).
2022-02-06 15:31:40.050280+0100 iaito[69657:600121] Plugins are loaded from "/Library/Application Support/radareorg/iaito/plugins"
2022-02-06 15:31:40.050515+0100 iaito[69657:600121] Plugins are loaded from "/usr/local/bin/plugins"
2022-02-06 15:31:40.361970+0100 iaito[69657:600121] [qt.qpa.fonts] Populating font family aliases took 107 ms. Replace uses of missing font family "Helvetica, Arial, Sans-serif" with one that exists to avoid this cost.
Process 69657 stopped
* thread #9, name = 'Thread (pooled)', stop reason = EXC_BAD_ACCESS (code=1, address=0x90)
    frame #0: 0x0000000100619144 libr_cons.dylib`r_cons_sleep_end(user=0x000060000291f800) at cons.c:500:9
   497 	}
   498
   499 	R_API void r_cons_sleep_end(void *user) {
-> 500 		if (I->cb_sleep_end) {
   501 			I->cb_sleep_end (I->user, user);
   502 		}
   503 	}
Target 0: (iaito) stopped.
@trufae
Copy link
Collaborator

trufae commented Feb 6, 2022

Unfortunely, iaito is using a single core instance from multiple threads, which is conceptually wrong, so now, that r2 is thread safe, iaito fails hard by assuming globals are initialized and uses the mutexes incorrectly too.

I pushed some fixes in r2 and iaito, but its still not yet fully working (but at least is not crashing). But you will need to build r2 without threads to try it out.

radare2$ sys/install.sh --disable-threads

@Maxung
Copy link
Author

Maxung commented Feb 6, 2022

Thanks for the quick reply and I understand that as an open source project things might not always be working out right away. I actually just wanted to try iaito out, to see how different it is from command line r2 and got confused because I couldn't find an issue, so no worries

@Maxung
Copy link
Author

Maxung commented Feb 6, 2022

So I was able to run it once, trying to open decompiler crashed it though (maybe r2ghidra?). Now when I try to open it again (make run or in /Applicatons) I get:

rarun2 libpath=/usr/local/lib program=build/iaito.app/Contents/MacOS/iaito
QCommandLineParser: already having an option named "w"
make: *** [run] Killed: 9

Strange thing is when I run it via lldb it crashes but still opens. And decompiler doesn't crash, but it loads forever

@trufae
Copy link
Collaborator

trufae commented Feb 6, 2022

Did you git pull r2 and iaito and compiled r2 without threads? Otherwise if your purpose is to try it out i would recommend you to build r2-5.4 or 5.5 which didnt had thread safety magic yet

@Maxung
Copy link
Author

Maxung commented Feb 6, 2022

Yeah I pulled latest master branch from both and build as per your instruction. But I can try tomorrow again (and use your suggestion)

So tried it again and it doesn't open at all now and I just get make: *** [run] Killed: 9 in terminal.
Also I noticed that it's actually radare2 crashing now, more specifically the r2 binary

@Maxung
Copy link
Author

Maxung commented Feb 7, 2022

Ignore the last edit after restarting it worked. With the master branch decompiler still doesn't work though, but version 5.5 was looking fine, thanks for your help!

@xambroz
Copy link
Contributor

xambroz commented Feb 14, 2022

499 R_API void r_cons_sleep_end(void *user) {

Same issue on Fedora Linux with the r2 5.6.0 release .
Workaround with disabling threads works there as well
(radare2-5a7ffe4c0a71794fbb0b945d52065c7c11d1eec2 + iaito-28a1099603b3fa671bfbb226025d1a8c45558471,
meson ... -Dwant_threads=false )

@trufae
Copy link
Collaborator

trufae commented Feb 15, 2022

Yep that's expected because Iaito is far from thread safe.

I dont think i can cook the needed apis before 5.7. I will update and release a new iaito when this is ready.

@xambroz
Copy link
Contributor

xambroz commented Feb 28, 2022

Seems that -Dwant_threads=false is gone from radare2 5.6.4 ... did anything change regarding compiling iaito with recent radare2 versions?

@xambroz
Copy link
Contributor

xambroz commented Mar 1, 2022

Sorry - my fault - it is working with radare2 5.6.4

@trufae
Copy link
Collaborator

trufae commented Mar 1, 2022

Is the disasm issue (only showing instruction without arguments) still happening?

@xambroz
Copy link
Contributor

xambroz commented Mar 2, 2022

Yes unfortunately issue with not showing the arguments is still there.
image

And BTW there are some comming issues with the recent update of kf5 from 5.90 to 5.91 kf5-syntax-highlighting-devel stopped advertising include dir /usr/include/KF5
https://bugzilla.redhat.com/show_bug.cgi?id=2059619

@trufae
Copy link
Collaborator

trufae commented Mar 3, 2022

The missing operands is fixed in master. What should we do to fix the kf5 issue?

@xambroz
Copy link
Contributor

xambroz commented Mar 3, 2022

OK operands fixed in master.

For #70 KF5 5.91 I am adding include for /usr/include/KF5 when compiling with syntax highlighting. Probably not a best solution, but works for now.

@xambroz
Copy link
Contributor

xambroz commented Mar 7, 2022

I believe this incident can be closed - please @Maxung can you confirm for the MacOS side?

@Maxung
Copy link
Author

Maxung commented Mar 7, 2022

Currently getting this, I'll try tomorrow on my other Mac to see if it's environment problem on my side:

Kyouko:~/iaito (master %) % make   
mkdir -p build
cd build && /opt/homebrew/bin/qmake ../src/Iaito.pro 
Info: creating stash file /Users/max/iaito/build/.qmake.stash
Project ERROR: failed to parse default search paths from compiler output
make: *** [build] Error 3

@Maxung
Copy link
Author

Maxung commented Mar 8, 2022

Ok tested on a pretty fresh system (macOS 12.2) and building + running just fine. Only thing is that the decompiler (pdc) is still loading forever, but I think that might be a separate issue

@Maxung Maxung closed this as completed Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants