int __execute_only_pkey(struct mm_struct *mm)
{ bool need_to_set_mm_pkey = false; int execute_only_pkey = mm->context.execute_only_pkey; int ret;
/* Do we need to assign a pkey for mm's execute-only maps? */ if (execute_only_pkey == -1) { /* Go allocate one to use, which might fail */
execute_only_pkey = mm_pkey_alloc(mm); if (execute_only_pkey < 0) return -1;
need_to_set_mm_pkey = true;
}
/* We got one, store it and use it from here on out */ if (need_to_set_mm_pkey)
mm->context.execute_only_pkey = execute_only_pkey; return execute_only_pkey;
}
staticinlinebool vma_is_pkey_exec_only(struct vm_area_struct *vma)
{ /* Do this check first since the vm_flags should be hot */ if ((vma->vm_flags & VM_ACCESS_FLAGS) != VM_EXEC) returnfalse; if (vma_pkey(vma) != vma->vm_mm->context.execute_only_pkey) returnfalse;
returntrue;
}
/* *Thisisonlycalledfor*plain*mprotectcalls.
*/ int __arch_override_mprotect_pkey(struct vm_area_struct *vma, int prot, int pkey)
{ /* *Isthisanmprotect_pkey()call?Ifso,never *overridethevaluethatcamefromtheuser.
*/ if (pkey != -1) return pkey;
staticint __init create_init_pkru_value(void)
{ /* Do not expose the file if pkeys are not supported. */ if (!cpu_feature_enabled(X86_FEATURE_OSPKE)) return0;
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 und die Messung sind noch experimentell.