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

Reinitialize NSRunningApplication at EVENT_HANDLER_APPLICATION_LAUNCHED #5

Closed

Conversation

donaldguy
Copy link

As per koekeishiya#923 (comment) this appears to resolve koekeishiya#920 crashes for me

(all the ones I have experienced so far anyway, there may be more like it)

I'm not asserting this is the correct way to handle this, but its a workaround at least

@donaldguy donaldguy force-pushed the xorpse-reinit-ns_application branch from 48a2533 to ed71768 Compare July 23, 2021 19:14
@donaldguy
Copy link
Author

(^ Rebased on c35ef0a )

@xorpse
Copy link
Owner

xorpse commented Jul 23, 2021

In principle, since this fork started off as a workaround for issues not tackled in the main repository, I have no issue merging the fix if it works :).

However, I'd love to get to the bottom of the scripting additions issue. From your comments in #4 and koekeishiya#923, am I correct in assuming you've been able to get yabai running without issues on the M1 with scripting additions working using the bundled injector, not the Frida/standalone one?

@donaldguy
Copy link
Author

donaldguy commented Jul 23, 2021

However, I'd love to get to the bottom of the scripting additions issue. From your comments in #4 and koekeishiya#923, am I correct in assuming you've been able to get yabai running without issues on the M1 with scripting additions working using the bundled injector, not the Frida/standalone one?

Not quite. yabai starts and manages windows but is presenting
image

on init.

Running sudo yabai --install-sa fails silently with return of 2
Running sudo yabai --load-sa fails silently with return of 1

:(

maybe and maybe not of relevance, but to my surprise
pgrep -fl Dock.app
8221 /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock
8224 /System/Library/CoreServices/Dock.app/Contents/XPCServices/com.apple.dock.extra.xpc/Contents/MacOS/com.apple.dock.extra
8225 /System/Library/CoreServices/Dock.app/Contents/XPCServices/com.apple.dock.external.extra.arm64.xpc/Contents/MacOS/com.apple.dock.external.extra.arm64

(XPC is a new one to me (though I see there is code in upstream yabai to filter out / ignore such processes ) - and I wonder if it doesn't offer a better approach to the current injection - but I imagine if it did, we'd have already gone down that path(?); maybe I've just never run pgrep -f Dock before (though that seems impossible) ; maybe also I just have some docklet running somehow for the first time)

but:

❯ git rev-parse HEAD
ed717687b2ed65e5db0bbb7bf6536b64f4f1af40

yabai on  canon [?] via 
❯ cd arm64-injector-standalone

yabai/arm64-injector-standalone on  canon [?]
❯ make clean
rm -f inject inject.o
rm -f sa_arm64e sa_arm64e.o sa_arm64e.h

yabai/arm64-injector-standalone on  canon [?]
❯ make
./extract.sh
clang -o inject inject.c -arch arm64e -std=c99 -Wall -DNDEBUG -O2 -fvisibility=hidden -mmacosx-version-min=10.13

yabai/arm64-injector-standalone on  canon [?]
❯ pgrep Dock
8221

yabai/arm64-injector-standalone on  canon [?]
❯ sudo ./inject 8221
Password:

yabai/arm64-injector-standalone on  canon [?] took 2s
❯ echo $?
0

but (re)starting yabai thereafter still gives
image

I haven't dug into the injector or the payload much at all, so idk if that implies that the above 0 return from inject.c's main is spurious - or if its successfully injecting a null (or malformed) payload but can't do the full/real one for some reason

@donaldguy
Copy link
Author

Feel free to suggest things for me to look at / ask for me to report on some stuff - since you are without a 12.0 M1

@donaldguy
Copy link
Author

donaldguy commented Jul 23, 2021

also, possibly of relevance, I am not doing any code signing of any kind right now cause that bit wasn't clear to me. but I gather there may be relevant entitlements in the arm64e sitch

In particular, I'm not clear what the yabai-cert file in the existing sign Makefile target should be;

I saw something that looked relevant in my brief glance at a frida tutorial, but I gather we aren't doing that anymore?

(It's probs not relevant to this signature (which I imagine is either a self-signed bit or like a MDM cert?), but I am a registered apple developer for the time being)

@donaldguy
Copy link
Author

Closing in favor of #7 (which maybe you don't want, if this is likely to go upstream)

but would love to still hear advice on playing more with the injector on Monterey

@donaldguy donaldguy closed this Jul 28, 2021
@donaldguy donaldguy deleted the xorpse-reinit-ns_application branch October 25, 2023 05:10
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

Successfully merging this pull request may close these issues.

Yabai is crashing/restarting constantly on macOS 12
2 participants