[PATCH v5] arm64: errata: Fix exec handling in erratum 1418040 workaround
D Scott Phillips
scott at os.amperecomputing.com
Thu Dec 23 10:22:03 PST 2021
Catalin Marinas <catalin.marinas at arm.com> writes:
> On Wed, Dec 22, 2021 at 08:12:27AM -0800, D Scott Phillips wrote:
>> Catalin Marinas <catalin.marinas at arm.com> writes:
>> > On Mon, Dec 20, 2021 at 03:41:14PM -0800, D Scott Phillips wrote:
>> >> 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: d49f7d7376d0 ("arm64: Move handling of erratum 1418040 into C code")
>> >> Signed-off-by: D Scott Phillips <scott at os.amperecomputing.com>
>> >> Cc: <stable at vger.kernel.org> # 5.4.x
>> >
>> > Why 5.4? I think the fixed commit is 5.9.
>>
>> d49f7d7376d0 got backported into v5.4.62's 82b05f0838aa. That looks like
>> that's the farthest it's made it back. Is this the correct way to handle
>> fixing the backported change, or should a separate backport be sent to
>> 5.4 for the fix?
>
> If it applies cleanly to 5.4.62, I'll just tweak the fixes line back to
> 5.4 (I changed it to 5.9 as I have a git hook that adjusts the Fixes
> line automatically when applying). If it doesn't apply cleanly, you can
> send it separately.
Ah, of course, that makes sense. Looks like its got some superficial
conflicts applying back to 5.4 as is, so 5.9 sounds like the way to
go. Thanks for fixing that up,
Scott
More information about the linux-arm-kernel
mailing list