X-Git-Url: https://git.stricted.de/?p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git;a=blobdiff_plain;f=arch%2Farm64%2Fkernel%2Fprocess.c;h=ad14dbc07db8d4a135fdb64226b4ae87f87b7ddc;hp=238c54a8d013de0b6153afb2cc7c4f16698f25fd;hb=f29ec40f359012249b26de0356211275656f5a72;hpb=b4350432998578500203d562d5b093c6a5beadd2 diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 238c54a8d013..ad14dbc07db8 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -355,9 +355,27 @@ void exit_thread(void) { } +static void tls_thread_flush(void) +{ + asm ("msr tpidr_el0, xzr"); + + if (is_compat_task()) { + current->thread.tp_value = 0; + + /* + * We need to ensure ordering between the shadow state and the + * hardware state, so that we don't corrupt the hardware state + * with a stale shadow state during context switch. + */ + barrier(); + asm ("msr tpidrro_el0, xzr"); + } +} + void flush_thread(void) { fpsimd_flush_thread(); + tls_thread_flush(); flush_ptrace_hw_breakpoint(current); }