aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-05 10:46:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-05 10:46:15 -0400
commit2071b3e34fd33e496ebd7b90331ac5b3b0ac3b81 (patch)
treeaeee17f8994ffaa234354cfe70d664f85b331247 /arch/x86/mm
parent9df0fe64ebbdd85dd871cb8d52c16efe5ec45319 (diff)
parente6ab9a20e73e790d47e6aa231fcf66f27b6ce3d4 (diff)
Merge branch 'x86/espfix' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next
Pull x86-64 espfix changes from Peter Anvin: "This is the espfix64 code, which fixes the IRET information leak as well as the associated functionality problem. With this code applied, 16-bit stack segments finally work as intended even on a 64-bit kernel. Consequently, this patchset also removes the runtime option that we added as an interim measure. To help the people working on Linux kernels for very small systems, this patchset also makes these compile-time configurable features" * 'x86/espfix' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: Revert "x86-64, modify_ldt: Make support for 16-bit segments a runtime option" x86, espfix: Make it possible to disable 16-bit support x86, espfix: Make espfix64 a Kconfig option, fix UML x86, espfix: Fix broken header guard x86, espfix: Move espfix definitions into a separate header file x86-32, espfix: Remove filter for espfix32 due to race x86-64, espfix: Don't leak bits 31:16 of %esp returning to 16-bit stack
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/dump_pagetables.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 20621d753d5f..167ffcac16ed 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -30,12 +30,14 @@ struct pg_state {
30 unsigned long start_address; 30 unsigned long start_address;
31 unsigned long current_address; 31 unsigned long current_address;
32 const struct addr_marker *marker; 32 const struct addr_marker *marker;
33 unsigned long lines;
33 bool to_dmesg; 34 bool to_dmesg;
34}; 35};
35 36
36struct addr_marker { 37struct addr_marker {
37 unsigned long start_address; 38 unsigned long start_address;
38 const char *name; 39 const char *name;
40 unsigned long max_lines;
39}; 41};
40 42
41/* indices for address_markers; keep sync'd w/ address_markers below */ 43/* indices for address_markers; keep sync'd w/ address_markers below */
@@ -46,6 +48,7 @@ enum address_markers_idx {
46 LOW_KERNEL_NR, 48 LOW_KERNEL_NR,
47 VMALLOC_START_NR, 49 VMALLOC_START_NR,
48 VMEMMAP_START_NR, 50 VMEMMAP_START_NR,
51 ESPFIX_START_NR,
49 HIGH_KERNEL_NR, 52 HIGH_KERNEL_NR,
50 MODULES_VADDR_NR, 53 MODULES_VADDR_NR,
51 MODULES_END_NR, 54 MODULES_END_NR,
@@ -68,6 +71,7 @@ static struct addr_marker address_markers[] = {
68 { PAGE_OFFSET, "Low Kernel Mapping" }, 71 { PAGE_OFFSET, "Low Kernel Mapping" },
69 { VMALLOC_START, "vmalloc() Area" }, 72 { VMALLOC_START, "vmalloc() Area" },
70 { VMEMMAP_START, "Vmemmap" }, 73 { VMEMMAP_START, "Vmemmap" },
74 { ESPFIX_BASE_ADDR, "ESPfix Area", 16 },
71 { __START_KERNEL_map, "High Kernel Mapping" }, 75 { __START_KERNEL_map, "High Kernel Mapping" },
72 { MODULES_VADDR, "Modules" }, 76 { MODULES_VADDR, "Modules" },
73 { MODULES_END, "End Modules" }, 77 { MODULES_END, "End Modules" },
@@ -182,7 +186,7 @@ static void note_page(struct seq_file *m, struct pg_state *st,
182 pgprot_t new_prot, int level) 186 pgprot_t new_prot, int level)
183{ 187{
184 pgprotval_t prot, cur; 188 pgprotval_t prot, cur;
185 static const char units[] = "KMGTPE"; 189 static const char units[] = "BKMGTPE";
186 190
187 /* 191 /*
188 * If we have a "break" in the series, we need to flush the state that 192 * If we have a "break" in the series, we need to flush the state that
@@ -197,6 +201,7 @@ static void note_page(struct seq_file *m, struct pg_state *st,
197 st->current_prot = new_prot; 201 st->current_prot = new_prot;
198 st->level = level; 202 st->level = level;
199 st->marker = address_markers; 203 st->marker = address_markers;
204 st->lines = 0;
200 pt_dump_seq_printf(m, st->to_dmesg, "---[ %s ]---\n", 205 pt_dump_seq_printf(m, st->to_dmesg, "---[ %s ]---\n",
201 st->marker->name); 206 st->marker->name);
202 } else if (prot != cur || level != st->level || 207 } else if (prot != cur || level != st->level ||
@@ -208,17 +213,24 @@ static void note_page(struct seq_file *m, struct pg_state *st,
208 /* 213 /*
209 * Now print the actual finished series 214 * Now print the actual finished series
210 */ 215 */
211 pt_dump_seq_printf(m, st->to_dmesg, "0x%0*lx-0x%0*lx ", 216 if (!st->marker->max_lines ||
212 width, st->start_address, 217 st->lines < st->marker->max_lines) {
213 width, st->current_address); 218 pt_dump_seq_printf(m, st->to_dmesg,
214 219 "0x%0*lx-0x%0*lx ",
215 delta = (st->current_address - st->start_address) >> 10; 220 width, st->start_address,
216 while (!(delta & 1023) && unit[1]) { 221 width, st->current_address);
217 delta >>= 10; 222
218 unit++; 223 delta = st->current_address - st->start_address;
224 while (!(delta & 1023) && unit[1]) {
225 delta >>= 10;
226 unit++;
227 }
228 pt_dump_cont_printf(m, st->to_dmesg, "%9lu%c ",
229 delta, *unit);
230 printk_prot(m, st->current_prot, st->level,
231 st->to_dmesg);
219 } 232 }
220 pt_dump_cont_printf(m, st->to_dmesg, "%9lu%c ", delta, *unit); 233 st->lines++;
221 printk_prot(m, st->current_prot, st->level, st->to_dmesg);
222 234
223 /* 235 /*
224 * We print markers for special areas of address space, 236 * We print markers for special areas of address space,
@@ -226,7 +238,17 @@ static void note_page(struct seq_file *m, struct pg_state *st,
226 * This helps in the interpretation. 238 * This helps in the interpretation.
227 */ 239 */
228 if (st->current_address >= st->marker[1].start_address) { 240 if (st->current_address >= st->marker[1].start_address) {
241 if (st->marker->max_lines &&
242 st->lines > st->marker->max_lines) {
243 unsigned long nskip =
244 st->lines - st->marker->max_lines;
245 pt_dump_seq_printf(m, st->to_dmesg,
246 "... %lu entr%s skipped ... \n",
247 nskip,
248 nskip == 1 ? "y" : "ies");
249 }
229 st->marker++; 250 st->marker++;
251 st->lines = 0;
230 pt_dump_seq_printf(m, st->to_dmesg, "---[ %s ]---\n", 252 pt_dump_seq_printf(m, st->to_dmesg, "---[ %s ]---\n",
231 st->marker->name); 253 st->marker->name);
232 } 254 }