]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/mach/vm_param.h
xnu-3248.20.55.tar.gz
[apple/xnu.git] / osfmk / mach / vm_param.h
index 6a33043a6a5a4df55dd9de3cff11632e9171ea24..1fa361488256fe4209d6d53b7f706df179ccf640 100644 (file)
@@ -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 */