Commit 38e0257
arm64: errata: Fix exec handling in erratum 1418040 workaround
The erratum 1418040 workaround enables CNTVCT_EL1 access trapping in EL0
when executing compat threads. The workaround is applied when switching
between tasks, but the need for the workaround could also change at an
exec(), when a non-compat task execs a compat binary or vice versa. Apply
the workaround in arch_setup_new_exec().
This leaves a small window of time between SET_PERSONALITY and
arch_setup_new_exec where preemption could occur and confuse the old
workaround logic that compares TIF_32BIT between prev and next. Instead, we
can just read cntkctl to make sure it's in the state that the next task
needs. I measured cntkctl read time to be about the same as a mov from a
general-purpose register on N1. Update the workaround logic to examine the
current value of cntkctl instead of the previous task's compat state.
Fixes: d49f7d7 ("arm64: Move handling of erratum 1418040 into C code")
Cc: <stable@vger.kernel.org> # 5.9.x
Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211220234114.3926-1-scott@os.amperecomputing.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>1 parent 31e833b commit 38e0257
1 file changed
Lines changed: 16 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
| 442 | + | |
| 443 | + | |
446 | 444 | | |
447 | | - | |
448 | | - | |
| 445 | + | |
449 | 446 | | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
| 447 | + | |
| 448 | + | |
460 | 449 | | |
461 | 450 | | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
| 451 | + | |
| 452 | + | |
466 | 453 | | |
467 | | - | |
| 454 | + | |
| 455 | + | |
468 | 456 | | |
469 | | - | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
470 | 462 | | |
471 | 463 | | |
472 | 464 | | |
| |||
501 | 493 | | |
502 | 494 | | |
503 | 495 | | |
504 | | - | |
| 496 | + | |
505 | 497 | | |
506 | 498 | | |
507 | 499 | | |
| |||
611 | 603 | | |
612 | 604 | | |
613 | 605 | | |
| 606 | + | |
614 | 607 | | |
615 | 608 | | |
616 | 609 | | |
| |||
0 commit comments