Re: [PATCH] arm64: mte: Move MTE TCF0 check in entry-common

2021-04-08 Thread Will Deacon
On Thu, Apr 08, 2021 at 04:06:23PM +0100, Mark Rutland wrote: > On Thu, Apr 08, 2021 at 03:56:04PM +0100, Will Deacon wrote: > > On Thu, Apr 08, 2021 at 03:37:23PM +0100, Vincenzo Frascino wrote: > > > diff --git a/arch/arm64/kernel/entry-common.c > > > b/arch/arm64/kernel/entry-common.c > > >

Re: [PATCH] arm64: mte: Move MTE TCF0 check in entry-common

2021-04-08 Thread Vincenzo Frascino
On 4/8/21 4:18 PM, Mark Rutland wrote: > Hi Vincenzo, > > On Thu, Apr 08, 2021 at 03:37:23PM +0100, Vincenzo Frascino wrote: >> The check_mte_async_tcf macro sets the TIF flag non-atomically. This can >> race with another CPU doing a set_tsk_thread_flag() and the flag can be >> lost in the

Re: [PATCH] arm64: mte: Move MTE TCF0 check in entry-common

2021-04-08 Thread Vincenzo Frascino
On 4/8/21 4:06 PM, Mark Rutland wrote: > On Thu, Apr 08, 2021 at 03:56:04PM +0100, Will Deacon wrote: >> On Thu, Apr 08, 2021 at 03:37:23PM +0100, Vincenzo Frascino wrote: >>> The check_mte_async_tcf macro sets the TIF flag non-atomically. This can >>> race with another CPU doing a

Re: [PATCH] arm64: mte: Move MTE TCF0 check in entry-common

2021-04-08 Thread Mark Rutland
Hi Vincenzo, On Thu, Apr 08, 2021 at 03:37:23PM +0100, Vincenzo Frascino wrote: > The check_mte_async_tcf macro sets the TIF flag non-atomically. This can > race with another CPU doing a set_tsk_thread_flag() and the flag can be > lost in the process. > > Move the tcf0 check to

Re: [PATCH] arm64: mte: Move MTE TCF0 check in entry-common

2021-04-08 Thread Mark Rutland
On Thu, Apr 08, 2021 at 03:56:04PM +0100, Will Deacon wrote: > On Thu, Apr 08, 2021 at 03:37:23PM +0100, Vincenzo Frascino wrote: > > The check_mte_async_tcf macro sets the TIF flag non-atomically. This can > > race with another CPU doing a set_tsk_thread_flag() and the flag can be > > lost in the

Re: [PATCH] arm64: mte: Move MTE TCF0 check in entry-common

2021-04-08 Thread Will Deacon
On Thu, Apr 08, 2021 at 03:37:23PM +0100, Vincenzo Frascino wrote: > The check_mte_async_tcf macro sets the TIF flag non-atomically. This can > race with another CPU doing a set_tsk_thread_flag() and the flag can be > lost in the process. Actually, it's all the *other* flags that get lost! >

[PATCH] arm64: mte: Move MTE TCF0 check in entry-common

2021-04-08 Thread Vincenzo Frascino
The check_mte_async_tcf macro sets the TIF flag non-atomically. This can race with another CPU doing a set_tsk_thread_flag() and the flag can be lost in the process. Move the tcf0 check to enter_from_user_mode() and clear tcf0 in exit_to_user_mode() to address the problem. Note: Moving the check