C program received "killed 9" on Apple Silicon macOS, but fine on Intel

215 Views Asked by At

I have a C implementation of NIST-800-90Ar1 CTR-DRBG random bits generator which is working fine Intel Macs, but when I test it on Apple Silicon Mac, it received the SIGKILL signal.

I've already worked out the solution, I'm just sharing information, and if it doesn't solve your problem, please do ask a new one.

1

There are 1 best solutions below

1
On

The cause is that I'm doing pointer arithmetic on uintptr_t, which causes the pointer authentication to fail.

For example, the following code fragment was present in my code:

uint8_t *seed = (void *)((uintptr_t)ctx + ctx->seed_offset);

Arithmetic on uintptr_t destroys authentication information on the pointer. It should've been:

uint8_t *seed = ((uint8_t *)ctx + ctx->seed_offset);

Pointer authentication is a security feature present with ARM processors, and this was introduced in WWDC 2020 talks.