staticvoid *__scs_alloc(int node)
{ int i; void *s;
for (i = 0; i < NR_CACHED_SCS; i++) {
s = this_cpu_xchg(scs_cache[i], NULL); if (s) {
s = kasan_unpoison_vmalloc(s, SCS_SIZE,
KASAN_VMALLOC_PROT_NORMAL);
memset(s, 0, SCS_SIZE); goto out;
}
}
/* * Poison the allocation to catch unintentional accesses to * the shadow stack when KASAN is enabled.
*/
kasan_poison_vmalloc(s, SCS_SIZE);
__scs_account(s, 1); return s;
}
void scs_free(void *s)
{ int i;
__scs_account(s, -1);
/* * We cannot sleep as this can be called in interrupt context, * so use this_cpu_cmpxchg to update the cache, and vfree_atomic * to free the stack.
*/
for (i = 0; i < NR_CACHED_SCS; i++) if (this_cpu_cmpxchg(scs_cache[i], 0, s) == NULL) return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.