Lines Matching defs:value
25 * calculate the __cfi_check() of the target dso, and call it. So use CFI shadow and shadow value to store the
27 * values. Shadow value is used to store the relationship. A shadow value can map 1 LIBRARY_ALIGNMENT memory range. So
30 * There are 3 types for shadow value:
34 * The valid shadow value records the distance from the end of a LIBRARY_ALIGNMENT memory range to the __cfi_check addr
36 * The valid shadow value is calculated as below:
40 * + 2 : to avoid conflict with invalid and uncheck shadow value.
63 * - First align up the target addr with LIBRARY_ALIGNMENT to locate the corresponding shadow value.
91 /* Shadow value */
92 /* The related shadow value(s) will be set to `sv_invalid` when:
96 /* The related shadow value(s) will be set to `sv_uncheck` if:
99 * its shadow value will be set to `sv_uncheck`. */
101 /* If a DSO enabled CFI Cross-Dso, the DSO's shadow value should be valid. Because of the defination of `sv_invalid`
102 * and `sv_unchecked`, the valid shadow value should be at least 2. */
125 * Shift left 1 bit because the shadow value is uint16_t. */
168 static uintptr_t get_cfi_check_addr(uint16_t value, void* func_ptr)
174 uintptr_t cfi_check_func_addr = aligned_addr - ((uintptr_t)(value - sv_valid_min) << cfi_check_granularity);
187 uint16_t value = sv_invalid;
201 /* Get shadow value */
210 value = sv_invalid;
212 value = *((uint16_t*)(cfi_shadow_start + offset));
214 LD_LOGD("[CFI] [%{public}s] called from %{public}s to %{public}s func_ptr:0x%{public}p shadow value:%{public}d diag_data:0x%{public}p call_site_type_id[%{public}p.\n",
218 func_ptr, value, diag_data, call_site_type_id);
221 switch (value)
233 LD_LOGE("[CFI] [%{public}s] can not find the dso from address:%{public}p func_ptr:0x%{public}p shadow value:%{public}d call_site_type_id[%{public}p!\n",
236 func_ptr, value, call_site_type_id);
243 LD_LOGE("[CFI] [%{public}s] can not find the __cfi_check in the dso: %{public}s func_ptr:0x%{public}p shadow value:%{public}d call_site_type_id[%{public}p!\n",
246 func_ptr, value, call_site_type_id);
256 ((cfi_check_t)get_cfi_check_addr(value, func_ptr))(call_site_type_id, func_ptr, diag_data);
334 /* Set the dso's shadow value as invalid. */
347 * value is uint16_t. The size passed to mmap() should be aligned with 4096, so shadow_size should be aligned. */
380 /* If the dso doesn't have __cfi_check(), set it's shadow value unchecked. */
387 /* If the dso has __cfi_check(), set it's shadow value valid. */
415 /* To ensure the atomicity of the CFI shadow operation, we create a temp_shadow, write the shadow value to
440 /* If the dso has __cfi_check(), calculate valid shadow value */