Lines Matching full:shadow

44 	/* Page index for the beginning of the shadow */
46 /* An array of __cfi_check locations (as indices to the shadow) */
47 shadow_t shadow[1]; member
51 * The shadow covers ~128M from the beginning of the module region. If
61 /* The actual size of the shadow array, minus metadata */
62 #define SHADOW_ARR_SIZE (SHADOW_SIZE - offsetof(struct cfi_shadow, shadow))
68 /* Returns the index in the shadow for the given address */
80 return -1; /* Cannot be addressed with shadow */ in ptr_to_shadow()
85 /* Returns the page address for an index in the shadow */
95 /* Returns the __cfi_check function address for the given shadow location */
102 if (unlikely(s->shadow[index] == SHADOW_INVALID)) in shadow_to_check_fn()
106 return (s->base + s->shadow[index]) << PAGE_SHIFT; in shadow_to_check_fn()
115 memset(next->shadow, 0xFF, SHADOW_ARR_SIZE); in prepare_next_shadow()
118 return; /* No previous shadow */ in prepare_next_shadow()
122 memcpy(next->shadow, prev->shadow, SHADOW_ARR_SIZE); in prepare_next_shadow()
126 /* Convert the previous shadow to the new address range */ in prepare_next_shadow()
128 if (prev->shadow[i] == SHADOW_INVALID) in prepare_next_shadow()
136 shadow_to_check_fn(prev, prev->shadow[i])); in prepare_next_shadow()
140 next->shadow[index] = (shadow_t)check; in prepare_next_shadow()
152 pr_warn("cfi: not using shadow for module %s\n", mod->name); in add_module_to_shadow()
158 return; /* Module not addressable with shadow */ in add_module_to_shadow()
160 /* For each page, store the check function index in the shadow */ in add_module_to_shadow()
166 WARN_ON_ONCE(s->shadow[index] != SHADOW_INVALID); in add_module_to_shadow()
167 s->shadow[index] = (shadow_t)check_index; in add_module_to_shadow()
181 s->shadow[index] = SHADOW_INVALID; in remove_module_from_shadow()
238 return NULL; /* No shadow available */ in ptr_to_check_fn()
242 return NULL; /* Cannot be addressed with shadow */ in ptr_to_check_fn()
290 * the shadow and __module_address use RCU, so we need to wake it in find_check_fn()