]> www.infradead.org Git - users/jedix/linux-maple.git/commit
arm64: move preemption disablement to prctl handlers
authorPeter Collingbourne <pcc@google.com>
Tue, 27 Jul 2021 20:52:57 +0000 (13:52 -0700)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 28 Jul 2021 17:33:49 +0000 (18:33 +0100)
commitd2e0d8f9746d3e09bcaf15e46c792e40819c9186
treecd5de6e1a9625f758df8d727f012112dd50d1b9a
parent433c38f40f6a81cf3988b9372f2983912737f322
arm64: move preemption disablement to prctl handlers

In the next patch, we will start reading sctlr_user from
mte_update_sctlr_user and subsequently writing a new value based on the
task's TCF setting and potentially the per-CPU TCF preference. This
means that we need to be careful to disable preemption around any
code sequences that read from sctlr_user and subsequently write to
sctlr_user and/or SCTLR_EL1, so that we don't end up writing a stale
value (based on the previous CPU's TCF preference) to either of them.

We currently have four such sequences, in the prctl handlers for
PR_SET_TAGGED_ADDR_CTRL and PR_PAC_SET_ENABLED_KEYS, as well as in
the task initialization code that resets the prctl settings. Change
the prctl handlers to disable preemption in the handlers themselves
rather than the functions that they call, and change the task
initialization code to call the respective prctl handlers instead of
setting sctlr_user directly.

As a result of this change, we no longer need the helper function
set_task_sctlr_el1, nor does its behavior make sense any more, so
remove it.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Link: https://linux-review.googlesource.com/id/Ic0e8a0c00bb47d786c1e8011df0b7fe99bee4bb5
Link: https://lore.kernel.org/r/20210727205300.2554659-4-pcc@google.com
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/pointer_auth.h
arch/arm64/include/asm/processor.h
arch/arm64/kernel/mte.c
arch/arm64/kernel/pointer_auth.c
arch/arm64/kernel/process.c