On 6/25/20 11:50 AM, Peter Maydell wrote: > On Fri, 5 Jun 2020 at 05:17, Richard Henderson > <richard.hender...@linaro.org> wrote: >> >> These prctl fields are required for the function of MTE. >> >> Signed-off-by: Richard Henderson <richard.hender...@linaro.org> > > This API doesn't seem to be in the upstream kernel yet, right?
It has finally landed in 5.10. Thus the long delay since my last revision. >> + /* >> + * Write PR_MTE_TCF to SCTLR_EL1[TCF0]. >> + * Note that the syscall values are consistent with hw. >> + */ >> + env->cp15.sctlr_el[1] = >> + deposit64(env->cp15.sctlr_el[1], 38, 2, >> + arg2 >> TARGET_PR_MTE_TCF_SHIFT); > > This actually will be per-thread since each linux-user thread has > its own CPU. You probably need to do something to make it be > inherited across clone and fork, though (assuming those are > the required semantics). FWIW, these are a per-thread quantities. >From arch/arm64/kernel/mte.c: > void mte_thread_switch(struct task_struct *next) > { > if (!system_supports_mte()) > return; > > /* avoid expensive SCTLR_EL1 accesses if no change */ > if (current->thread.sctlr_tcf0 != next->thread.sctlr_tcf0) > update_sctlr_el1_tcf0(next->thread.sctlr_tcf0); > update_gcr_el1_excl(next->thread.gcr_user_incl); > } I don't think I have to do anything special wrt fork/clone, as env->cp15 will get copied by our own cpu_copy(). r~