Skip to content
Snippets Groups Projects
Commit bda1e6c3 authored by Ilya Verbin's avatar Ilya Verbin Committed by Feodor Alexandrov
Browse files

core: strip the PAC out of IP during backtrace on AArch64 macOS

Apple's libunwind for AArch64 returns the Instruction Pointer with the
Pointer Authentication Codes (bits 47-63) even though Tarantool is compiled
for arm64 (not arm64e) architecture, so we have to strip them out [1].
Although there is the ptrauth_strip macro for this purpose, it works only
if compilation target is arm64e (not arm64) [2].

1. https://developer.apple.com/documentation/security/preparing_your_app_to_work_with_pointer_authentication#3042105
2. https://github.com/dotnet/runtime/issues/42955#issuecomment-886910180

Closes #8074
Closes tarantool/tarantool-qa#308
Closes tarantool/tarantool-qa#309

NO_DOC=bugfix

(cherry picked from commit 88990e2f)
parent 42563c8d
No related branches found
No related tags found
No related merge requests found
## bugfix/core
* Fixed the collection of fiber backtraces on the M1/M2 macOS platform
(gh-8074).
......@@ -75,6 +75,13 @@ collect_current_stack(struct backtrace *bt, void *stack)
"status: %d", rc);
return stack;
}
#ifdef __aarch64__
/*
* Apple's libunwind for AArch64 returns the IP with the Pointer
* Authentication Codes (bits 47-63). Strip them out.
*/
ip &= 0x7fffffffffffull;
#endif /* __aarch64__ */
append_frame(bt, (void *)ip);
rc = unw_step(&unw_cur);
if (rc <= 0) {
......
......@@ -4,8 +4,6 @@ local t = require('luatest')
local g = t.group()
g.before_all(function()
t.skip_if(jit.arch == 'arm64' and jit.os == 'OSX',
'Disabled on macOS/M1 due to tarantool/tarantool-qa#309')
g.dflt = server:new({alias = 'dflt'})
g.dflt:start()
g.dflt:exec(function()
......
......@@ -4,8 +4,4 @@ import platform
if platform.system() == 'OpenBSD':
self.skip = 1
# Disabled on macOS/M1 due to fail tarantool/tarantool-qa#308.
if platform.machine() == 'arm64' and platform.system() == 'Darwin':
self.skip = 1
# vim: set ft=python:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment