X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/4d15aeb193b2c68f1d38666c317f8d3734f5f083..b226f5e54a60dc81db17b1260381d7dbfea3cdf1:/libkern/os/log_encode.h diff --git a/libkern/os/log_encode.h b/libkern/os/log_encode.h index 4f8afae5c..d214bab21 100644 --- a/libkern/os/log_encode.h +++ b/libkern/os/log_encode.h @@ -27,6 +27,11 @@ #include "log_encode_types.h" #include +#if __has_feature(ptrauth_calls) +#include +#include +#endif /* __has_feature(ptrauth_calls) */ + #ifdef KERNEL #define isdigit(ch) (((ch) >= '0') && ((ch) <= '9')) extern boolean_t doprnt_hide_pointers; @@ -156,13 +161,21 @@ _os_log_encode_arg(void *arg, uint16_t arg_len, os_log_value_type_t ctype, bool unsigned long long value = 0; memcpy(&value, arg, arg_len); +#if __has_feature(ptrauth_calls) + /** + * Strip out the pointer authentication code before + * checking whether the pointer is a kernel address. + */ + value = (unsigned long long)VM_KERNEL_STRIP_PTR(value); +#endif /* __has_feature(ptrauth_calls) */ + if (value >= VM_MIN_KERNEL_AND_KEXT_ADDRESS && value <= VM_MAX_KERNEL_ADDRESS) { is_private = true; bzero(arg, arg_len); } } #endif - + content->type = ctype; content->flags = (is_private ? OS_LOG_CONTENT_FLAG_PRIVATE : 0);