Lines Matching +full:width +full:- +full:mm
1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <linux/mm.h>
108 [END_OF_SPACE_NR] = { -1, NULL }
144 [END_OF_SPACE_NR] = { -1, NULL }
231 npages = (addr - st->start_address) / PAGE_SIZE; in note_wx()
238 if (pcibios_enabled && st->start_address >= PAGE_OFFSET + BIOS_BEGIN && in note_wx()
240 pr_warn_once("x86/mm: PCI BIOS W+X mapping %lu pages\n", npages); in note_wx()
245 st->wx_pages += npages; in note_wx()
247 "x86/mm: Found insecure W+X mapping at address %pS\n", in note_wx()
248 (void *)st->start_address); in note_wx()
258 pgprotval_t higher_prot = st->prot_levels[level - 1]; in effective_prot()
266 st->prot_levels[level] = effective; in effective_prot()
281 struct seq_file *m = st->seq; in note_page()
287 new_eff = st->prot_levels[level]; in note_page()
294 cur = st->current_prot; in note_page()
295 eff = st->effective_prot; in note_page()
297 if (st->level == -1) { in note_page()
299 st->current_prot = new_prot; in note_page()
300 st->effective_prot = new_eff; in note_page()
301 st->level = level; in note_page()
302 st->marker = address_markers; in note_page()
303 st->lines = 0; in note_page()
304 pt_dump_seq_printf(m, st->to_dmesg, "---[ %s ]---\n", in note_page()
305 st->marker->name); in note_page()
306 } else if (new_prot != cur || new_eff != eff || level != st->level || in note_page()
307 addr >= st->marker[1].start_address) { in note_page()
310 int width = sizeof(unsigned long) * 2; in note_page() local
312 if (st->check_wx && (eff & _PAGE_RW) && !(eff & _PAGE_NX)) in note_page()
318 if (!st->marker->max_lines || in note_page()
319 st->lines < st->marker->max_lines) { in note_page()
320 pt_dump_seq_printf(m, st->to_dmesg, in note_page()
321 "0x%0*lx-0x%0*lx ", in note_page()
322 width, st->start_address, in note_page()
323 width, addr); in note_page()
325 delta = addr - st->start_address; in note_page()
330 pt_dump_cont_printf(m, st->to_dmesg, "%9lu%c ", in note_page()
332 printk_prot(m, st->current_prot, st->level, in note_page()
333 st->to_dmesg); in note_page()
335 st->lines++; in note_page()
342 if (addr >= st->marker[1].start_address) { in note_page()
343 if (st->marker->max_lines && in note_page()
344 st->lines > st->marker->max_lines) { in note_page()
346 st->lines - st->marker->max_lines; in note_page()
347 pt_dump_seq_printf(m, st->to_dmesg, in note_page()
352 st->marker++; in note_page()
353 st->lines = 0; in note_page()
354 pt_dump_seq_printf(m, st->to_dmesg, "---[ %s ]---\n", in note_page()
355 st->marker->name); in note_page()
358 st->start_address = addr; in note_page()
359 st->current_prot = new_prot; in note_page()
360 st->effective_prot = new_eff; in note_page()
361 st->level = level; in note_page()
366 struct mm_struct *mm, pgd_t *pgd, in ptdump_walk_pgd_level_core() argument
385 .level = -1, in ptdump_walk_pgd_level_core()
391 ptdump_walk_pgd(&st.ptdump, mm, pgd); in ptdump_walk_pgd_level_core()
396 pr_info("x86/mm: Checked W+X mappings: FAILED, %lu W+X pages found.\n", in ptdump_walk_pgd_level_core()
399 pr_info("x86/mm: Checked W+X mappings: passed, no W+X pages found.\n"); in ptdump_walk_pgd_level_core()
402 void ptdump_walk_pgd_level(struct seq_file *m, struct mm_struct *mm) in ptdump_walk_pgd_level() argument
404 ptdump_walk_pgd_level_core(m, mm, mm->pgd, false, true); in ptdump_walk_pgd_level()
407 void ptdump_walk_pgd_level_debugfs(struct seq_file *m, struct mm_struct *mm, in ptdump_walk_pgd_level_debugfs() argument
410 pgd_t *pgd = mm->pgd; in ptdump_walk_pgd_level_debugfs()
415 ptdump_walk_pgd_level_core(m, mm, pgd, false, false); in ptdump_walk_pgd_level_debugfs()
428 pr_info("x86/mm: Checking user space page tables\n"); in ptdump_walk_user_pgd_level_checkwx()
442 * Various markers are not compile-time constants, so assign them in pt_dump_init()