x86/mm/pkeys: Dump pkey from VMA in /proc/pid/smaps
[cascardo/linux.git] / arch / x86 / kernel / setup.c
index d3d80e6..7260f99 100644 (file)
 #include <asm/alternative.h>
 #include <asm/prom.h>
 #include <asm/microcode.h>
+#include <asm/mmu_context.h>
 
 /*
  * max_low_pfn_mapped: highest direct mapped pfn under 4GB
@@ -1282,3 +1283,11 @@ static int __init register_kernel_offset_dumper(void)
        return 0;
 }
 __initcall(register_kernel_offset_dumper);
+
+void arch_show_smap(struct seq_file *m, struct vm_area_struct *vma)
+{
+       if (!boot_cpu_has(X86_FEATURE_OSPKE))
+               return;
+
+       seq_printf(m, "ProtectionKey:  %8u\n", vma_pkey(vma));
+}