#ifdef CONFIG_MODIFY_LDT_SYSCALL /* * ldt_structs can be allocated, used, and freed, but they are never * modified while live.
*/ struct ldt_struct { /* * Xen requires page-aligned LDTs with special permissions. This is * needed to prevent us from installing evil descriptors such as * call gates. On native, we could merge the ldt_struct and LDT * allocations, but it's not worth trying to optimize.
*/ struct desc_struct *entries; unsignedint nr_entries;
/* * If PTI is in use, then the entries array is not mapped while we're * in user mode. The whole array will be aliased at the addressed * given by ldt_slot_va(slot). We use two slots so that we can allocate * and map, and enable a new LDT without invalidating the mapping * of an older, still-in-use LDT. * * slot will be -1 if this LDT doesn't have an alias mapping.
*/ int slot;
};
#ifdef CONFIG_ADDRESS_MASKING staticinlineunsignedlong mm_lam_cr3_mask(struct mm_struct *mm)
{ /* * When switch_mm_irqs_off() is called for a kthread, it may race with * LAM enablement. switch_mm_irqs_off() uses the LAM mask to do two * things: populate CR3 and populate 'cpu_tlbstate.lam'. Make sure it * reads a single value for both.
*/ return READ_ONCE(mm->context.lam_cr3_mask);
}
/* * Init a new mm. Used on mm copies, like at fork() * and on mm's that are brand-new, like at execve().
*/ #define init_new_context init_new_context staticinlineint init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{
mutex_init(&mm->context.lock);
#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS if (cpu_feature_enabled(X86_FEATURE_OSPKE)) { /* pkey 0 is the default and allocated implicitly */
mm->context.pkey_allocation_map = 0x1; /* -1 means unallocated or invalid */
mm->context.execute_only_pkey = -1;
} #endif
/* * We only want to enforce protection keys on the current process * because we effectively have no access to PKRU for other * processes or any way to tell *which * PKRU in a threaded * process we could use. * * So do not enforce things if the VMA is not from the current * mm, or if we are in a kernel thread.
*/ staticinlinebool arch_vma_access_permitted(struct vm_area_struct *vma, bool write, bool execute, bool foreign)
{ /* pkeys never affect instruction fetches */ if (execute) returntrue; /* allow access if the VMA is not one from this process */ if (foreign || vma_is_foreign(vma)) returntrue; return __pkru_allows_pkey(vma_pkey(vma), write);
}
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.