ldt.c (cf79f291f985662150363b4a93d16f88f12643bc) | ldt.c (ea4654e0885348f0faa47f6d7b44a08d75ad16e9) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds 4 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> 5 * Copyright (C) 2002 Andi Kleen 6 * 7 * This handles calls from both 32bit and 64bit mode. 8 * --- 170 unchanged lines hidden (view full) --- 179 180 /* The new LDT isn't aliased for PTI yet. */ 181 new_ldt->slot = -1; 182 183 new_ldt->nr_entries = num_entries; 184 return new_ldt; 185} 186 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds 4 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> 5 * Copyright (C) 2002 Andi Kleen 6 * 7 * This handles calls from both 32bit and 64bit mode. 8 * --- 170 unchanged lines hidden (view full) --- 179 180 /* The new LDT isn't aliased for PTI yet. */ 181 new_ldt->slot = -1; 182 183 new_ldt->nr_entries = num_entries; 184 return new_ldt; 185} 186 |
187#ifdef CONFIG_PAGE_TABLE_ISOLATION | 187#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION |
188 189static void do_sanity_check(struct mm_struct *mm, 190 bool had_kernel_mapping, 191 bool had_user_mapping) 192{ 193 if (mm->context.ldt) { 194 /* 195 * We already had an LDT. The top-level entry should already --- 176 unchanged lines hidden (view full) --- 372 pte_unmap_unlock(ptep, ptl); 373 } 374 } 375 376 va = (unsigned long)ldt_slot_va(ldt->slot); 377 flush_tlb_mm_range(mm, va, va + nr_pages * PAGE_SIZE, PAGE_SHIFT, false); 378} 379 | 188 189static void do_sanity_check(struct mm_struct *mm, 190 bool had_kernel_mapping, 191 bool had_user_mapping) 192{ 193 if (mm->context.ldt) { 194 /* 195 * We already had an LDT. The top-level entry should already --- 176 unchanged lines hidden (view full) --- 372 pte_unmap_unlock(ptep, ptl); 373 } 374 } 375 376 va = (unsigned long)ldt_slot_va(ldt->slot); 377 flush_tlb_mm_range(mm, va, va + nr_pages * PAGE_SIZE, PAGE_SHIFT, false); 378} 379 |
380#else /* !CONFIG_PAGE_TABLE_ISOLATION */ | 380#else /* !CONFIG_MITIGATION_PAGE_TABLE_ISOLATION */ |
381 382static int 383map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) 384{ 385 return 0; 386} 387 388static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt) 389{ 390} | 381 382static int 383map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) 384{ 385 return 0; 386} 387 388static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt) 389{ 390} |
391#endif /* CONFIG_PAGE_TABLE_ISOLATION */ | 391#endif /* CONFIG_MITIGATION_PAGE_TABLE_ISOLATION */ |
392 393static void free_ldt_pgtables(struct mm_struct *mm) 394{ | 392 393static void free_ldt_pgtables(struct mm_struct *mm) 394{ |
395#ifdef CONFIG_PAGE_TABLE_ISOLATION | 395#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION |
396 struct mmu_gather tlb; 397 unsigned long start = LDT_BASE_ADDR; 398 unsigned long end = LDT_END_ADDR; 399 400 if (!boot_cpu_has(X86_FEATURE_PTI)) 401 return; 402 403 /* --- 293 unchanged lines hidden --- | 396 struct mmu_gather tlb; 397 unsigned long start = LDT_BASE_ADDR; 398 unsigned long end = LDT_END_ADDR; 399 400 if (!boot_cpu_has(X86_FEATURE_PTI)) 401 return; 402 403 /* --- 293 unchanged lines hidden --- |