X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/2dced7af2b695f87fe26496a3e73c219b7880cbc..4bd07ac2140668789aa3ee8ec4dde4a3e0a3bba5:/osfmk/mach/vm_param.h diff --git a/osfmk/mach/vm_param.h b/osfmk/mach/vm_param.h index 6a33043a6..1fa361488 100644 --- a/osfmk/mach/vm_param.h +++ b/osfmk/mach/vm_param.h @@ -308,7 +308,9 @@ extern vm_offset_t vm_elinkedit; * VM_KERNEL_UNSLIDE_OR_ADDRPERM: * Use this macro when you are exposing an address to userspace that could * come from either kernel text/data *or* the heap. This is a rare case, - * but one that does come up and must be handled correctly. + * but one that does come up and must be handled correctly. If the argument + * is known to be lower than any potential heap address, no transformation + * is applied, to avoid revealing the operation on a constant. * * Nesting of these macros should be considered invalid. */ @@ -333,7 +335,7 @@ extern vm_offset_t vm_elinkedit; VM_KERNEL_IS_PRELINKINFO(_v) || \ VM_KERNEL_IS_KEXT_LINKEDIT(_v)) ? \ (vm_offset_t)(_v) - vm_kernel_slide : \ - VM_KERNEL_ADDRPERM(_v)) + ((vm_offset_t)(_v) >= VM_MIN_KERNEL_AND_KEXT_ADDRESS ? VM_KERNEL_ADDRPERM(_v) : (vm_offset_t)(_v))) #endif /* XNU_KERNEL_PRIVATE */