Apply bit mask if ptrauth_strip is not available

This commit is contained in:
Ivan Matkov 2020-02-13 19:20:21 +03:00
Родитель 2b472454a3
Коммит fbcb801b14
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -77,7 +77,16 @@
#else // __has_feature(ptrauth_calls)
#define THREAD_STATE_GET_PTR(name, type, ts) arm_thread_state64_get_ ## name (ts->arm_state. type)
/*
* Even if pointer authentication is not available at the compile time, the binary still can be used in an environment with PAC.
* In this case, we can apply bitmask as a workaround.
*/
#define ARM64_PTR_MASK 0x0000000FFFFFFFFF
#define THREAD_STATE_GET_PTR(name, type, ts) ({ \
plcrash_greg_t ptr = arm_thread_state64_get_ ## name (ts->arm_state. type); \
(ptr & ARM64_PTR_MASK); \
})
#define THREAD_STATE_GET_FPTR(name, type, ts) THREAD_STATE_GET_PTR(name ## _fptr, type, ts)
#define THREAD_STATE_SET_PTR(name, type, ts, regnum, value) { \