Commit c3710ee
powerpc/code-patching: Use dedicated memory routines for patching
The patching page set up as a writable alias may be in quadrant 0
(userspace) if the temporary mm path is used. This causes sanitiser
failures if so. Sanitiser failures also occur on the non-mm path
because the plain memset family is instrumented, and KASAN treats the
patching window as poisoned.
Introduce locally defined patch_* variants of memset that perform an
uninstrumented lower level set, as well as detecting write errors like
the original single patch variant does.
copy_to_user() is not correct here, as the PTE makes it a proper kernel
page (the EAA is privileged access only, RW). It just happens to be in
quadrant 0 because that's the hardware's mechanism for using the current
PID vs PID 0 in translations. Importantly, it's incorrect to allow user
page accesses.
Now that the patching memsets are used, we also propagate a failure up
to the caller as the single patch variant does.
Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240325052815.854044-2-bgray@linux.ibm.com1 parent c5ef5e3 commit c3710ee
1 file changed
Lines changed: 27 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
375 | 397 | | |
376 | 398 | | |
377 | 399 | | |
| 400 | + | |
378 | 401 | | |
379 | 402 | | |
380 | 403 | | |
| |||
383 | 406 | | |
384 | 407 | | |
385 | 408 | | |
386 | | - | |
| 409 | + | |
387 | 410 | | |
388 | 411 | | |
389 | 412 | | |
390 | | - | |
| 413 | + | |
391 | 414 | | |
392 | 415 | | |
393 | | - | |
| 416 | + | |
394 | 417 | | |
395 | 418 | | |
396 | 419 | | |
397 | 420 | | |
398 | | - | |
| 421 | + | |
399 | 422 | | |
400 | 423 | | |
401 | 424 | | |
| |||
0 commit comments