Commit 9cf85e4
committed
x86/mm: Randomize per-cpu entry area
jira VULN-3958
cve CVE-2023-0597
commit-author Peter Zijlstra <peterz@infradead.org>
commit 97e3d26
upstream-diff |
1. Ignored changes in `arch/x86/kernel/hw_breakpoint.c'. The modified
function `within_cpu_entry()' doesn't exist in `ciqlts8_6'
revision. The conflict might have been resolved by pure cherry
picking of 24ae0c9,
d390e6d,
97417cb, but would result in
introducing dead code: `within_area()' and `within_cpu_entry()'
functions.
2. Moved the `arch/x86/include/asm/pgtable_areas.h' changes to
`arch/x86/include/asm/cpu_entry_area.h'. This must have been done
because of the 186525b commit
missing from `ciqlts8_6' history, which factored out the relevant
#defines from `cpu_entry_area.h' to `pgtable_areas.h'. It was decided
not to backport this commit as prerequisite since it's too extensive
and making changes not related to the patch.
3. Made small adaptation of changes relating to `cea_offset()'
definitions in `arch/x86/mm/cpu_entry_area.c' which was necessary
because of the dc4e002 commit
missing from `ciqlts8_6' history. It was too functionality-intrusive
to backport as prerequisite for auto resolution of just this single
conflict.
Seth found that the CPU-entry-area; the piece of per-cpu data that is
mapped into the userspace page-tables for kPTI is not subject to any
randomization -- irrespective of kASLR settings.
On x86_64 a whole P4D (512 GB) of virtual address space is reserved for
this structure, which is plenty large enough to randomize things a
little.
As such, use a straight forward randomization scheme that avoids
duplicates to spread the existing CPUs over the available space.
[ bp: Fix le build. ]
Reported-by: Seth Jenkins <sethjenkins@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
(cherry picked from commit 97e3d26)
Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>1 parent 20daefe commit 9cf85e4
2 files changed
+52
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | 110 | | |
115 | 111 | | |
116 | 112 | | |
| |||
124 | 120 | | |
125 | 121 | | |
126 | 122 | | |
127 | | - | |
128 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
19 | 60 | | |
20 | 61 | | |
21 | 62 | | |
22 | 63 | | |
23 | 64 | | |
24 | | - | |
| 65 | + | |
25 | 66 | | |
26 | 67 | | |
27 | 68 | | |
| |||
194 | 235 | | |
195 | 236 | | |
196 | 237 | | |
197 | | - | |
198 | 238 | | |
199 | 239 | | |
200 | 240 | | |
| |||
210 | 250 | | |
211 | 251 | | |
212 | 252 | | |
| 253 | + | |
| 254 | + | |
213 | 255 | | |
214 | 256 | | |
215 | 257 | | |
| |||
0 commit comments