Commit e80d390
mm: track page table modifications in __apply_to_page_range()
__apply_to_page_range() is also used to change and/or allocate
page-table pages in the vmalloc area of the address space. Make sure
these changes get synchronized to other page-tables in the system by
calling arch_sync_kernel_mappings() when necessary.
The impact appears limited to x86-32, where apply_to_page_range may miss
updating the PMD. That leads to explosions in drivers like
BUG: unable to handle page fault for address: fe036000
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
*pde = 00000000
Oops: 0002 [#1] SMP
CPU: 3 PID: 1300 Comm: gem_concurrent_ Not tainted 5.9.0-rc1+ #16
Hardware name: /NUC6i3SYB, BIOS SYSKLi35.86A.0024.2015.1027.2142 10/27/2015
EIP: __execlists_context_alloc+0x132/0x2d0 [i915]
Code: 31 d2 89 f0 e8 2f 55 02 00 89 45 e8 3d 00 f0 ff ff 0f 87 11 01 00 00 8b 4d e8 03 4b 30 b8 5a 5a 5a 5a ba 01 00 00 00 8d 79 04 <c7> 01 5a 5a 5a 5a c7 81 fc 0f 00 00 5a 5a 5a 5a 83 e7 fc 29 f9 81
EAX: 5a5a5a5a EBX: f60ca00 ECX: fe036000 EDX: 00000001
ESI: f43b7340 EDI: fe036004 EBP: f6389cb8 ESP: f6389c9c
DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010286
CR0: 80050033 CR2: fe036000 CR3: 2d361000 CR4: 001506d0
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: fffe0ff0 DR7: 00000400
Call Trace:
execlists_context_alloc+0x10/0x20 [i915]
intel_context_alloc_state+0x3f/0x70 [i915]
__intel_context_do_pin+0x117/0x170 [i915]
i915_gem_do_execbuffer+0xcc7/0x2500 [i915]
i915_gem_execbuffer2_ioctl+0xcd/0x1f0 [i915]
drm_ioctl_kernel+0x8f/0xd0
drm_ioctl+0x223/0x3d0
__ia32_sys_ioctl+0x1ab/0x760
__do_fast_syscall_32+0x3f/0x70
do_fast_syscall_32+0x29/0x60
do_SYSENTER_32+0x15/0x20
entry_SYSENTER_32+0x9f/0xf2
EIP: 0xb7f28559
Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76
EAX: ffffffda EBX: 00000005 ECX: c0406469 EDX: bf95556c
ESI: b7e68000 EDI: c0406469 EBP: 00000005 ESP: bf9554d8
DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS: 00000296
Modules linked in: i915 x86_pkg_temp_thermal intel_powerclamp crc32_pclmul crc32c_intel intel_cstate intel_uncore intel_gtt drm_kms_helper intel_pch_thermal video button autofs4 i2c_i801 i2c_smbus fan
CR2: 00000000fe036000
It looks like kasan, xen and i915 are vulnerable.
Actual impact is "on thinkpad X60 in 5.9-rc1, screen starts blinking
after 30-or-so minutes, and machine is unusable"
[sfr@canb.auug.org.au: ARCH_PAGE_TABLE_SYNC_MASK needs vmalloc.h]
Link: https://lkml.kernel.org/r/20200825172508.16800a4f@canb.auug.org.au
[chris@chris-wilson.co.uk: changelog addition]
[pavel@ucw.cz: changelog addition]
Fixes: 2ba3e69 ("mm/vmalloc: track which page-table levels were modified")
Fixes: 86cf69f ("x86/mm/32: implement arch_sync_kernel_mappings()")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Tested-by: Chris Wilson <chris@chris-wilson.co.uk> [x86-32]
Tested-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: <stable@vger.kernel.org> [5.8+]
Link: https://lkml.kernel.org/r/20200821123746.16904-1-joro@8bytes.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>1 parent 9d90dd1 commit e80d390
1 file changed
+24
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
2206 | 2208 | | |
2207 | 2209 | | |
2208 | 2210 | | |
2209 | | - | |
| 2211 | + | |
| 2212 | + | |
2210 | 2213 | | |
2211 | 2214 | | |
2212 | 2215 | | |
2213 | 2216 | | |
2214 | 2217 | | |
2215 | 2218 | | |
2216 | 2219 | | |
2217 | | - | |
| 2220 | + | |
2218 | 2221 | | |
2219 | 2222 | | |
2220 | 2223 | | |
| |||
2235 | 2238 | | |
2236 | 2239 | | |
2237 | 2240 | | |
| 2241 | + | |
2238 | 2242 | | |
2239 | 2243 | | |
2240 | 2244 | | |
| |||
2245 | 2249 | | |
2246 | 2250 | | |
2247 | 2251 | | |
2248 | | - | |
| 2252 | + | |
| 2253 | + | |
2249 | 2254 | | |
2250 | 2255 | | |
2251 | 2256 | | |
| |||
2254 | 2259 | | |
2255 | 2260 | | |
2256 | 2261 | | |
2257 | | - | |
| 2262 | + | |
2258 | 2263 | | |
2259 | 2264 | | |
2260 | 2265 | | |
| |||
2264 | 2269 | | |
2265 | 2270 | | |
2266 | 2271 | | |
2267 | | - | |
| 2272 | + | |
2268 | 2273 | | |
2269 | 2274 | | |
2270 | 2275 | | |
| |||
2274 | 2279 | | |
2275 | 2280 | | |
2276 | 2281 | | |
2277 | | - | |
| 2282 | + | |
| 2283 | + | |
2278 | 2284 | | |
2279 | 2285 | | |
2280 | 2286 | | |
2281 | 2287 | | |
2282 | 2288 | | |
2283 | 2289 | | |
2284 | | - | |
| 2290 | + | |
2285 | 2291 | | |
2286 | 2292 | | |
2287 | 2293 | | |
| |||
2291 | 2297 | | |
2292 | 2298 | | |
2293 | 2299 | | |
2294 | | - | |
| 2300 | + | |
2295 | 2301 | | |
2296 | 2302 | | |
2297 | 2303 | | |
| |||
2301 | 2307 | | |
2302 | 2308 | | |
2303 | 2309 | | |
2304 | | - | |
| 2310 | + | |
| 2311 | + | |
2305 | 2312 | | |
2306 | 2313 | | |
2307 | 2314 | | |
2308 | 2315 | | |
2309 | 2316 | | |
2310 | 2317 | | |
2311 | | - | |
| 2318 | + | |
2312 | 2319 | | |
2313 | 2320 | | |
2314 | 2321 | | |
| |||
2318 | 2325 | | |
2319 | 2326 | | |
2320 | 2327 | | |
2321 | | - | |
| 2328 | + | |
2322 | 2329 | | |
2323 | 2330 | | |
2324 | 2331 | | |
| |||
2331 | 2338 | | |
2332 | 2339 | | |
2333 | 2340 | | |
2334 | | - | |
| 2341 | + | |
2335 | 2342 | | |
| 2343 | + | |
2336 | 2344 | | |
2337 | 2345 | | |
2338 | 2346 | | |
| |||
2343 | 2351 | | |
2344 | 2352 | | |
2345 | 2353 | | |
2346 | | - | |
| 2354 | + | |
2347 | 2355 | | |
2348 | 2356 | | |
2349 | 2357 | | |
2350 | 2358 | | |
| 2359 | + | |
| 2360 | + | |
| 2361 | + | |
2351 | 2362 | | |
2352 | 2363 | | |
2353 | 2364 | | |
| |||
0 commit comments