SIGILL: illegal instruction

My app is written in golang and uses C libraries to send text as if it is typed on a keyboard. The app executable works fine when invoked via command line from a directory under my home directory. When I invoke the executable in the app bundle from the command line, the app loads and displays the icon in the status bar. But when the app tries to send text to the cursor, I get:

SIGILL: illegal instruction
PC=0x7fff676b98f1 m=5 sigcode=1
instruction bytes: 0xf 0xb 0x55 0x48 0x89 0xe5 0x48 0x8b 0x7 0xf 0xb6 0x40 0x28 0x48 0x8d 0x48
.... (lots of trace information)

Ordinarily, app behavior like this may be seen as a security risk. Can you point me to guidelines around this issue and alternatives for achieving my goal.

The app listens for MIDI input and translates it into text, allowing a MIDI instrument to be used as an alternative to a QWERTY keyboard.

Disclosure: This is my first MacOS App. Golang is used so I may compile the same code for other platforms.

Thanks for any assistance!

David

Ordinarily, app behavior like this may be seen as a security risk.

Potentially, yes, but in this case definitely no. The Go signal handler has printed a short dump of the instructions at the location that triggered the SIGILL and the first two bytes, 0xf 0xb, are a ud2 instruction. This instruction is commonly used as a trap, that is, a way to stop the process after the code has detected an irrecoverable problem. For example, Swift code will trap in this way if you access an array out of bounds.

As to what’s causing that trap, it’s hard to say without a backtrace. If you disable the Go signal handler than the system should generate a crash report which will include a backtrace of the crashing process. If you post that crash report here, I should be able to advise you further.

Use the text attachment feature (click the paperclip icon and then choose Add File) to avoid clogging up the timeline.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you, Quinn. The attached is the remainder of the traceback when the program fails. Is this sufficient to see what the cause of the SIGILL is?

Is this simply an entitlement issue? When I run the code on Mojave in my home directory space, it gives the warning that I'm performing an illegal operation, but it continues to run. When I run on Catalina, there is no such warning.

David

Is this sufficient to see what the cause of the SIGILL is?

It may well be but I’m not sufficiently versed in the Go runtime to help you with that. You should escalate this via the support channel for Go, for advice on either:

  • How to get a symbolicated backtrace out of the Go crash reporter?

  • How to disable the Go crash reporter so that the Apple crash reporter can do its thing?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Here's what happens on Mojave

Oh, that might actually be significant. That message indicates that your using a main-thread-only framework from a secondary thread. That will yield undefined behaviour, and it’s possible that this manifests on 10.15 as a trap.

Keep in mind that all UI frameworks on Apple platforms are only safe to use from the main thread [1]. What framework are you using to synthesise these keyboard events? And what API within that framework?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] This isn’t quite true — some UI frameworks have specific subsystems that can be used on a secondary thread — but it’s a good guideline if you’re new to the platform.

It's just Go. Here's how it works:

  1. Main thread
  2. Open a channel "M" for passing selected MIDI messages for processing.
  3. Launch Thread "A" to process MIDI messages forwarded on channel "M".
  4. Create real-time MIDI listener in main thread and forward selected MIDI messages to Thread "A" over channel "M".
  5. Thread "A" processes received MIDI messages and makes calls to robotgo package which sends text to TIS/TSM.

Does this sound like a Catalina entitlement issue?

makes calls to robotgo package which sends text to TIS/TSM.

Right, but what does that package actually do at the Apple API level?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

SIGILL: illegal instruction
 
 
Q