简体   繁体   English

C 程序在 Apple Silicon macOS 上收到“killed 9”,但在 Intel 上很好

[英]C program received “killed 9” on Apple Silicon macOS, but fine on Intel

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.我有一个 NIST-800-90Ar1 CTR-DRBG 随机位发生器的 C 实现,它在 Intel Mac 上运行良好,但是当我在 Apple Silicon Mac 上测试它时,它收到了 SIGKILL 信号。

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.我已经制定了解决方案,我只是分享信息,如果它不能解决您的问题,请询问新的。

The cause is that I'm doing pointer arithmetic on uintptr_t , which causes the pointer authentication to fail.原因是我在uintptr_t上进行指针运算,导致指针身份验证失败。

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. uintptr_t上的算术会破坏指针上的身份验证信息。 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.指针身份验证是 ARM 处理器中的一项安全功能,这是在 WWDC 2020 会谈中介绍的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM