linux-snps-arc.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"
@ 2020-10-20  2:19 Vineet Gupta
  2020-11-06 20:27 ` Vineet Gupta
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Vineet Gupta @ 2020-10-20  2:19 UTC (permalink / raw)
  To: stable; +Cc: Waldemar Brodkorb, Vineet Gupta, linux-snps-arc, linux-kernel

This reverts commit 00fdec98d9881bf5173af09aebd353ab3b9ac729.
(but only from 5.2 and prior kernels)

The original commit was a preventive fix based on code-review and was
auto-picked for stable back-port (for better or worse).
It was OK for v5.3+ kernels, but turned up needing an implicit change
68e5c6f073bcf70 "(ARC: entry: EV_Trap expects r10 (vs. r9) to have
 exception cause)" merged in v5.3 which itself was not backported.
So to summarize the stable backport of this patch for v5.2 and prior
kernels is busted and it won't boot.

The obvious solution is backport 68e5c6f073bcf70 but that is a pain as
it doesn't revert cleanly and each of affected kernels (so far v4.19,
v4.14, v4.9, v4.4) needs a slightly different massaged varaint.
So the easier fix is to simply revert the backport from 5.2 and prior.
The issue was not a big deal as it would cause strace to sporadically
not work correctly.

Waldemar Brodkorb first reported this when running ARC uClibc regressions
on latest stable kernels (with offending backport). Once he bisected it,
the analysis was trivial, so thx to him for this.

Reported-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Bisected-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Cc: stable <stable@vger.kernel.org> # 5.2 and prior
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
 arch/arc/kernel/entry.S | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S
index ea00c8a17f07..60406ec62eb8 100644
--- a/arch/arc/kernel/entry.S
+++ b/arch/arc/kernel/entry.S
@@ -165,6 +165,7 @@ END(EV_Extension)
 tracesys:
 	; save EFA in case tracer wants the PC of traced task
 	; using ERET won't work since next-PC has already committed
+	lr  r12, [efa]
 	GET_CURR_TASK_FIELD_PTR   TASK_THREAD, r11
 	st  r12, [r11, THREAD_FAULT_ADDR]	; thread.fault_address
 
@@ -207,9 +208,15 @@ tracesys_exit:
 ; Breakpoint TRAP
 ; ---------------------------------------------
 trap_with_param:
-	mov r0, r12	; EFA in case ptracer/gdb wants stop_pc
+
+	; stop_pc info by gdb needs this info
+	lr  r0, [efa]
 	mov r1, sp
 
+	; Now that we have read EFA, it is safe to do "fake" rtie
+	;   and get out of CPU exception mode
+	FAKE_RET_FROM_EXCPN
+
 	; Save callee regs in case gdb wants to have a look
 	; SP will grow up by size of CALLEE Reg-File
 	; NOTE: clobbers r12
@@ -236,10 +243,6 @@ ENTRY(EV_Trap)
 
 	EXCEPTION_PROLOGUE
 
-	lr  r12, [efa]
-
-	FAKE_RET_FROM_EXCPN
-
 	;============ TRAP 1   :breakpoints
 	; Check ECR for trap with arg (PROLOGUE ensures r10 has ECR)
 	bmsk.f 0, r10, 7
@@ -247,6 +250,9 @@ ENTRY(EV_Trap)
 
 	;============ TRAP  (no param): syscall top level
 
+	; First return from Exception to pure K mode (Exception/IRQs renabled)
+	FAKE_RET_FROM_EXCPN
+
 	; If syscall tracing ongoing, invoke pre-post-hooks
 	GET_CURR_THR_INFO_FLAGS   r10
 	btst r10, TIF_SYSCALL_TRACE
-- 
2.25.1


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"
  2020-10-20  2:19 [PATCH] Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE" Vineet Gupta
@ 2020-11-06 20:27 ` Vineet Gupta
  2020-11-07 14:10   ` Greg Kroah-Hartman
  2020-11-09 10:34 ` Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.4-stable tree gregkh
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Vineet Gupta @ 2020-11-06 20:27 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Waldemar Brodkorb, linux-snps-arc, linux-kernel

Hi Stable Team,

On 10/19/20 7:19 PM, Vineet Gupta wrote:
> This reverts commit 00fdec98d9881bf5173af09aebd353ab3b9ac729.
> (but only from 5.2 and prior kernels)
> 
> The original commit was a preventive fix based on code-review and was
> auto-picked for stable back-port (for better or worse).
> It was OK for v5.3+ kernels, but turned up needing an implicit change
> 68e5c6f073bcf70 "(ARC: entry: EV_Trap expects r10 (vs. r9) to have
>  exception cause)" merged in v5.3 which itself was not backported.
> So to summarize the stable backport of this patch for v5.2 and prior
> kernels is busted and it won't boot.
> 
> The obvious solution is backport 68e5c6f073bcf70 but that is a pain as
> it doesn't revert cleanly and each of affected kernels (so far v4.19,
> v4.14, v4.9, v4.4) needs a slightly different massaged varaint.
> So the easier fix is to simply revert the backport from 5.2 and prior.
> The issue was not a big deal as it would cause strace to sporadically
> not work correctly.
> 
> Waldemar Brodkorb first reported this when running ARC uClibc regressions
> on latest stable kernels (with offending backport). Once he bisected it,
> the analysis was trivial, so thx to him for this.
> 
> Reported-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
> Bisected-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
> Cc: stable <stable@vger.kernel.org> # 5.2 and prior
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>

Can this revert be please applied to 4.19 and older kernels for the next cycle.

Or is there is a procedural issue given this revert is not in mainline. I've
described the issue in detail above so if there's a better/desirable way of
reverting it from backports, please let me know.

Thx,

> ---
>  arch/arc/kernel/entry.S | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S
> index ea00c8a17f07..60406ec62eb8 100644
> --- a/arch/arc/kernel/entry.S
> +++ b/arch/arc/kernel/entry.S
> @@ -165,6 +165,7 @@ END(EV_Extension)
>  tracesys:
>  	; save EFA in case tracer wants the PC of traced task
>  	; using ERET won't work since next-PC has already committed
> +	lr  r12, [efa]
>  	GET_CURR_TASK_FIELD_PTR   TASK_THREAD, r11
>  	st  r12, [r11, THREAD_FAULT_ADDR]	; thread.fault_address
>  
> @@ -207,9 +208,15 @@ tracesys_exit:
>  ; Breakpoint TRAP
>  ; ---------------------------------------------
>  trap_with_param:
> -	mov r0, r12	; EFA in case ptracer/gdb wants stop_pc
> +
> +	; stop_pc info by gdb needs this info
> +	lr  r0, [efa]
>  	mov r1, sp
>  
> +	; Now that we have read EFA, it is safe to do "fake" rtie
> +	;   and get out of CPU exception mode
> +	FAKE_RET_FROM_EXCPN
> +
>  	; Save callee regs in case gdb wants to have a look
>  	; SP will grow up by size of CALLEE Reg-File
>  	; NOTE: clobbers r12
> @@ -236,10 +243,6 @@ ENTRY(EV_Trap)
>  
>  	EXCEPTION_PROLOGUE
>  
> -	lr  r12, [efa]
> -
> -	FAKE_RET_FROM_EXCPN
> -
>  	;============ TRAP 1   :breakpoints
>  	; Check ECR for trap with arg (PROLOGUE ensures r10 has ECR)
>  	bmsk.f 0, r10, 7
> @@ -247,6 +250,9 @@ ENTRY(EV_Trap)
>  
>  	;============ TRAP  (no param): syscall top level
>  
> +	; First return from Exception to pure K mode (Exception/IRQs renabled)
> +	FAKE_RET_FROM_EXCPN
> +
>  	; If syscall tracing ongoing, invoke pre-post-hooks
>  	GET_CURR_THR_INFO_FLAGS   r10
>  	btst r10, TIF_SYSCALL_TRACE
> 

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"
  2020-11-06 20:27 ` Vineet Gupta
@ 2020-11-07 14:10   ` Greg Kroah-Hartman
  2020-11-09 10:29     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 9+ messages in thread
From: Greg Kroah-Hartman @ 2020-11-07 14:10 UTC (permalink / raw)
  To: Vineet Gupta; +Cc: Waldemar Brodkorb, linux-snps-arc, linux-kernel, stable

On Fri, Nov 06, 2020 at 08:27:44PM +0000, Vineet Gupta wrote:
> Hi Stable Team,
> 
> On 10/19/20 7:19 PM, Vineet Gupta wrote:
> > This reverts commit 00fdec98d9881bf5173af09aebd353ab3b9ac729.
> > (but only from 5.2 and prior kernels)
> > 
> > The original commit was a preventive fix based on code-review and was
> > auto-picked for stable back-port (for better or worse).
> > It was OK for v5.3+ kernels, but turned up needing an implicit change
> > 68e5c6f073bcf70 "(ARC: entry: EV_Trap expects r10 (vs. r9) to have
> >  exception cause)" merged in v5.3 which itself was not backported.
> > So to summarize the stable backport of this patch for v5.2 and prior
> > kernels is busted and it won't boot.
> > 
> > The obvious solution is backport 68e5c6f073bcf70 but that is a pain as
> > it doesn't revert cleanly and each of affected kernels (so far v4.19,
> > v4.14, v4.9, v4.4) needs a slightly different massaged varaint.
> > So the easier fix is to simply revert the backport from 5.2 and prior.
> > The issue was not a big deal as it would cause strace to sporadically
> > not work correctly.
> > 
> > Waldemar Brodkorb first reported this when running ARC uClibc regressions
> > on latest stable kernels (with offending backport). Once he bisected it,
> > the analysis was trivial, so thx to him for this.
> > 
> > Reported-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
> > Bisected-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
> > Cc: stable <stable@vger.kernel.org> # 5.2 and prior
> > Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> 
> Can this revert be please applied to 4.19 and older kernels for the next cycle.
> 
> Or is there is a procedural issue given this revert is not in mainline. I've
> described the issue in detail above so if there's a better/desirable way of
> reverting it from backports, please let me know.

THis is fine, sorry, it's just in a backlog of lots of stable patches...

We will get to it soon.

thanks,

greg k-h

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"
  2020-11-07 14:10   ` Greg Kroah-Hartman
@ 2020-11-09 10:29     ` Greg Kroah-Hartman
  2020-11-10 19:33       ` Vineet Gupta
  0 siblings, 1 reply; 9+ messages in thread
From: Greg Kroah-Hartman @ 2020-11-09 10:29 UTC (permalink / raw)
  To: Vineet Gupta; +Cc: Waldemar Brodkorb, linux-snps-arc, linux-kernel, stable

On Sat, Nov 07, 2020 at 03:10:06PM +0100, Greg Kroah-Hartman wrote:
> On Fri, Nov 06, 2020 at 08:27:44PM +0000, Vineet Gupta wrote:
> > Hi Stable Team,
> > 
> > On 10/19/20 7:19 PM, Vineet Gupta wrote:
> > > This reverts commit 00fdec98d9881bf5173af09aebd353ab3b9ac729.
> > > (but only from 5.2 and prior kernels)
> > > 
> > > The original commit was a preventive fix based on code-review and was
> > > auto-picked for stable back-port (for better or worse).
> > > It was OK for v5.3+ kernels, but turned up needing an implicit change
> > > 68e5c6f073bcf70 "(ARC: entry: EV_Trap expects r10 (vs. r9) to have
> > >  exception cause)" merged in v5.3 which itself was not backported.
> > > So to summarize the stable backport of this patch for v5.2 and prior
> > > kernels is busted and it won't boot.
> > > 
> > > The obvious solution is backport 68e5c6f073bcf70 but that is a pain as
> > > it doesn't revert cleanly and each of affected kernels (so far v4.19,
> > > v4.14, v4.9, v4.4) needs a slightly different massaged varaint.
> > > So the easier fix is to simply revert the backport from 5.2 and prior.
> > > The issue was not a big deal as it would cause strace to sporadically
> > > not work correctly.
> > > 
> > > Waldemar Brodkorb first reported this when running ARC uClibc regressions
> > > on latest stable kernels (with offending backport). Once he bisected it,
> > > the analysis was trivial, so thx to him for this.
> > > 
> > > Reported-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
> > > Bisected-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
> > > Cc: stable <stable@vger.kernel.org> # 5.2 and prior
> > > Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> > 
> > Can this revert be please applied to 4.19 and older kernels for the next cycle.
> > 
> > Or is there is a procedural issue given this revert is not in mainline. I've
> > described the issue in detail above so if there's a better/desirable way of
> > reverting it from backports, please let me know.
> 
> THis is fine, sorry, it's just in a backlog of lots of stable patches...
> 
> We will get to it soon.

Now queued up, thanks.

gre gk-h

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.4-stable tree
  2020-10-20  2:19 [PATCH] Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE" Vineet Gupta
  2020-11-06 20:27 ` Vineet Gupta
@ 2020-11-09 10:34 ` gregkh
  2020-11-09 10:40 ` Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.9-stable tree gregkh
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: gregkh @ 2020-11-09 10:34 UTC (permalink / raw)
  To: Vineet.Gupta1, gregkh, linux-snps-arc, vgupta, wbx; +Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     revert-arc-entry-fix-potential-efa-clobber-when-tif_syscall_trace.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From Vineet.Gupta1@synopsys.com  Mon Nov  9 11:28:19 2020
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Date: Mon, 19 Oct 2020 19:19:57 -0700
Subject: Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"
To: stable@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, Vineet Gupta <Vineet.Gupta1@synopsys.com>, Waldemar Brodkorb <wbx@uclibc-ng.org>
Message-ID: <20201020021957.1260521-1-vgupta@synopsys.com>

From: Vineet Gupta <Vineet.Gupta1@synopsys.com>

This reverts commit 00fdec98d9881bf5173af09aebd353ab3b9ac729.
(but only from 5.2 and prior kernels)

The original commit was a preventive fix based on code-review and was
auto-picked for stable back-port (for better or worse).
It was OK for v5.3+ kernels, but turned up needing an implicit change
68e5c6f073bcf70 "(ARC: entry: EV_Trap expects r10 (vs. r9) to have
 exception cause)" merged in v5.3 which itself was not backported.
So to summarize the stable backport of this patch for v5.2 and prior
kernels is busted and it won't boot.

The obvious solution is backport 68e5c6f073bcf70 but that is a pain as
it doesn't revert cleanly and each of affected kernels (so far v4.19,
v4.14, v4.9, v4.4) needs a slightly different massaged varaint.
So the easier fix is to simply revert the backport from 5.2 and prior.
The issue was not a big deal as it would cause strace to sporadically
not work correctly.

Waldemar Brodkorb first reported this when running ARC uClibc regressions
on latest stable kernels (with offending backport). Once he bisected it,
the analysis was trivial, so thx to him for this.

Reported-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Bisected-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Cc: stable <stable@vger.kernel.org> # 5.2 and prior
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arc/kernel/entry.S |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

--- a/arch/arc/kernel/entry.S
+++ b/arch/arc/kernel/entry.S
@@ -168,6 +168,7 @@ END(EV_Extension)
 tracesys:
 	; save EFA in case tracer wants the PC of traced task
 	; using ERET won't work since next-PC has already committed
+	lr  r12, [efa]
 	GET_CURR_TASK_FIELD_PTR   TASK_THREAD, r11
 	st  r12, [r11, THREAD_FAULT_ADDR]	; thread.fault_address
 
@@ -210,9 +211,15 @@ tracesys_exit:
 ; Breakpoint TRAP
 ; ---------------------------------------------
 trap_with_param:
-	mov r0, r12	; EFA in case ptracer/gdb wants stop_pc
+
+	; stop_pc info by gdb needs this info
+	lr  r0, [efa]
 	mov r1, sp
 
+	; Now that we have read EFA, it is safe to do "fake" rtie
+	;   and get out of CPU exception mode
+	FAKE_RET_FROM_EXCPN
+
 	; Save callee regs in case gdb wants to have a look
 	; SP will grow up by size of CALLEE Reg-File
 	; NOTE: clobbers r12
@@ -239,10 +246,6 @@ ENTRY(EV_Trap)
 
 	EXCEPTION_PROLOGUE
 
-	lr  r12, [efa]
-
-	FAKE_RET_FROM_EXCPN
-
 	;============ TRAP 1   :breakpoints
 	; Check ECR for trap with arg (PROLOGUE ensures r9 has ECR)
 	bmsk.f 0, r9, 7
@@ -250,6 +253,9 @@ ENTRY(EV_Trap)
 
 	;============ TRAP  (no param): syscall top level
 
+	; First return from Exception to pure K mode (Exception/IRQs renabled)
+	FAKE_RET_FROM_EXCPN
+
 	; If syscall tracing ongoing, invoke pre-post-hooks
 	GET_CURR_THR_INFO_FLAGS   r10
 	btst r10, TIF_SYSCALL_TRACE


Patches currently in stable-queue which might be from Vineet.Gupta1@synopsys.com are

queue-4.4/revert-arc-entry-fix-potential-efa-clobber-when-tif_syscall_trace.patch

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.9-stable tree
  2020-10-20  2:19 [PATCH] Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE" Vineet Gupta
  2020-11-06 20:27 ` Vineet Gupta
  2020-11-09 10:34 ` Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.4-stable tree gregkh
@ 2020-11-09 10:40 ` gregkh
  2020-11-09 10:40 ` Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.14-stable tree gregkh
  2020-11-09 10:42 ` Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.19-stable tree gregkh
  4 siblings, 0 replies; 9+ messages in thread
From: gregkh @ 2020-11-09 10:40 UTC (permalink / raw)
  To: Vineet.Gupta1, gregkh, linux-snps-arc, vgupta, wbx; +Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     revert-arc-entry-fix-potential-efa-clobber-when-tif_syscall_trace.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From Vineet.Gupta1@synopsys.com  Mon Nov  9 11:28:19 2020
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Date: Mon, 19 Oct 2020 19:19:57 -0700
Subject: Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"
To: stable@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, Vineet Gupta <Vineet.Gupta1@synopsys.com>, Waldemar Brodkorb <wbx@uclibc-ng.org>
Message-ID: <20201020021957.1260521-1-vgupta@synopsys.com>

From: Vineet Gupta <Vineet.Gupta1@synopsys.com>

This reverts commit 00fdec98d9881bf5173af09aebd353ab3b9ac729.
(but only from 5.2 and prior kernels)

The original commit was a preventive fix based on code-review and was
auto-picked for stable back-port (for better or worse).
It was OK for v5.3+ kernels, but turned up needing an implicit change
68e5c6f073bcf70 "(ARC: entry: EV_Trap expects r10 (vs. r9) to have
 exception cause)" merged in v5.3 which itself was not backported.
So to summarize the stable backport of this patch for v5.2 and prior
kernels is busted and it won't boot.

The obvious solution is backport 68e5c6f073bcf70 but that is a pain as
it doesn't revert cleanly and each of affected kernels (so far v4.19,
v4.14, v4.9, v4.4) needs a slightly different massaged varaint.
So the easier fix is to simply revert the backport from 5.2 and prior.
The issue was not a big deal as it would cause strace to sporadically
not work correctly.

Waldemar Brodkorb first reported this when running ARC uClibc regressions
on latest stable kernels (with offending backport). Once he bisected it,
the analysis was trivial, so thx to him for this.

Reported-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Bisected-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Cc: stable <stable@vger.kernel.org> # 5.2 and prior
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arc/kernel/entry.S |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

--- a/arch/arc/kernel/entry.S
+++ b/arch/arc/kernel/entry.S
@@ -156,6 +156,7 @@ END(EV_Extension)
 tracesys:
 	; save EFA in case tracer wants the PC of traced task
 	; using ERET won't work since next-PC has already committed
+	lr  r12, [efa]
 	GET_CURR_TASK_FIELD_PTR   TASK_THREAD, r11
 	st  r12, [r11, THREAD_FAULT_ADDR]	; thread.fault_address
 
@@ -198,9 +199,15 @@ tracesys_exit:
 ; Breakpoint TRAP
 ; ---------------------------------------------
 trap_with_param:
-	mov r0, r12	; EFA in case ptracer/gdb wants stop_pc
+
+	; stop_pc info by gdb needs this info
+	lr  r0, [efa]
 	mov r1, sp
 
+	; Now that we have read EFA, it is safe to do "fake" rtie
+	;   and get out of CPU exception mode
+	FAKE_RET_FROM_EXCPN
+
 	; Save callee regs in case gdb wants to have a look
 	; SP will grow up by size of CALLEE Reg-File
 	; NOTE: clobbers r12
@@ -227,10 +234,6 @@ ENTRY(EV_Trap)
 
 	EXCEPTION_PROLOGUE
 
-	lr  r12, [efa]
-
-	FAKE_RET_FROM_EXCPN
-
 	;============ TRAP 1   :breakpoints
 	; Check ECR for trap with arg (PROLOGUE ensures r9 has ECR)
 	bmsk.f 0, r9, 7
@@ -238,6 +241,9 @@ ENTRY(EV_Trap)
 
 	;============ TRAP  (no param): syscall top level
 
+	; First return from Exception to pure K mode (Exception/IRQs renabled)
+	FAKE_RET_FROM_EXCPN
+
 	; If syscall tracing ongoing, invoke pre-post-hooks
 	GET_CURR_THR_INFO_FLAGS   r10
 	btst r10, TIF_SYSCALL_TRACE


Patches currently in stable-queue which might be from Vineet.Gupta1@synopsys.com are

queue-4.9/revert-arc-entry-fix-potential-efa-clobber-when-tif_syscall_trace.patch

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.14-stable tree
  2020-10-20  2:19 [PATCH] Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE" Vineet Gupta
                   ` (2 preceding siblings ...)
  2020-11-09 10:40 ` Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.9-stable tree gregkh
@ 2020-11-09 10:40 ` gregkh
  2020-11-09 10:42 ` Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.19-stable tree gregkh
  4 siblings, 0 replies; 9+ messages in thread
From: gregkh @ 2020-11-09 10:40 UTC (permalink / raw)
  To: Vineet.Gupta1, gregkh, linux-snps-arc, vgupta, wbx; +Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     revert-arc-entry-fix-potential-efa-clobber-when-tif_syscall_trace.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From Vineet.Gupta1@synopsys.com  Mon Nov  9 11:28:19 2020
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Date: Mon, 19 Oct 2020 19:19:57 -0700
Subject: Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"
To: stable@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, Vineet Gupta <Vineet.Gupta1@synopsys.com>, Waldemar Brodkorb <wbx@uclibc-ng.org>
Message-ID: <20201020021957.1260521-1-vgupta@synopsys.com>

From: Vineet Gupta <Vineet.Gupta1@synopsys.com>

This reverts commit 00fdec98d9881bf5173af09aebd353ab3b9ac729.
(but only from 5.2 and prior kernels)

The original commit was a preventive fix based on code-review and was
auto-picked for stable back-port (for better or worse).
It was OK for v5.3+ kernels, but turned up needing an implicit change
68e5c6f073bcf70 "(ARC: entry: EV_Trap expects r10 (vs. r9) to have
 exception cause)" merged in v5.3 which itself was not backported.
So to summarize the stable backport of this patch for v5.2 and prior
kernels is busted and it won't boot.

The obvious solution is backport 68e5c6f073bcf70 but that is a pain as
it doesn't revert cleanly and each of affected kernels (so far v4.19,
v4.14, v4.9, v4.4) needs a slightly different massaged varaint.
So the easier fix is to simply revert the backport from 5.2 and prior.
The issue was not a big deal as it would cause strace to sporadically
not work correctly.

Waldemar Brodkorb first reported this when running ARC uClibc regressions
on latest stable kernels (with offending backport). Once he bisected it,
the analysis was trivial, so thx to him for this.

Reported-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Bisected-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Cc: stable <stable@vger.kernel.org> # 5.2 and prior
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arc/kernel/entry.S |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

--- a/arch/arc/kernel/entry.S
+++ b/arch/arc/kernel/entry.S
@@ -156,6 +156,7 @@ END(EV_Extension)
 tracesys:
 	; save EFA in case tracer wants the PC of traced task
 	; using ERET won't work since next-PC has already committed
+	lr  r12, [efa]
 	GET_CURR_TASK_FIELD_PTR   TASK_THREAD, r11
 	st  r12, [r11, THREAD_FAULT_ADDR]	; thread.fault_address
 
@@ -198,9 +199,15 @@ tracesys_exit:
 ; Breakpoint TRAP
 ; ---------------------------------------------
 trap_with_param:
-	mov r0, r12	; EFA in case ptracer/gdb wants stop_pc
+
+	; stop_pc info by gdb needs this info
+	lr  r0, [efa]
 	mov r1, sp
 
+	; Now that we have read EFA, it is safe to do "fake" rtie
+	;   and get out of CPU exception mode
+	FAKE_RET_FROM_EXCPN
+
 	; Save callee regs in case gdb wants to have a look
 	; SP will grow up by size of CALLEE Reg-File
 	; NOTE: clobbers r12
@@ -227,10 +234,6 @@ ENTRY(EV_Trap)
 
 	EXCEPTION_PROLOGUE
 
-	lr  r12, [efa]
-
-	FAKE_RET_FROM_EXCPN
-
 	;============ TRAP 1   :breakpoints
 	; Check ECR for trap with arg (PROLOGUE ensures r9 has ECR)
 	bmsk.f 0, r9, 7
@@ -238,6 +241,9 @@ ENTRY(EV_Trap)
 
 	;============ TRAP  (no param): syscall top level
 
+	; First return from Exception to pure K mode (Exception/IRQs renabled)
+	FAKE_RET_FROM_EXCPN
+
 	; If syscall tracing ongoing, invoke pre-post-hooks
 	GET_CURR_THR_INFO_FLAGS   r10
 	btst r10, TIF_SYSCALL_TRACE


Patches currently in stable-queue which might be from Vineet.Gupta1@synopsys.com are

queue-4.14/revert-arc-entry-fix-potential-efa-clobber-when-tif_syscall_trace.patch

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.19-stable tree
  2020-10-20  2:19 [PATCH] Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE" Vineet Gupta
                   ` (3 preceding siblings ...)
  2020-11-09 10:40 ` Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.14-stable tree gregkh
@ 2020-11-09 10:42 ` gregkh
  4 siblings, 0 replies; 9+ messages in thread
From: gregkh @ 2020-11-09 10:42 UTC (permalink / raw)
  To: Vineet.Gupta1, gregkh, linux-snps-arc, vgupta, wbx; +Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     revert-arc-entry-fix-potential-efa-clobber-when-tif_syscall_trace.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From Vineet.Gupta1@synopsys.com  Mon Nov  9 11:28:19 2020
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Date: Mon, 19 Oct 2020 19:19:57 -0700
Subject: Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"
To: stable@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, Vineet Gupta <Vineet.Gupta1@synopsys.com>, Waldemar Brodkorb <wbx@uclibc-ng.org>
Message-ID: <20201020021957.1260521-1-vgupta@synopsys.com>

From: Vineet Gupta <Vineet.Gupta1@synopsys.com>

This reverts commit 00fdec98d9881bf5173af09aebd353ab3b9ac729.
(but only from 5.2 and prior kernels)

The original commit was a preventive fix based on code-review and was
auto-picked for stable back-port (for better or worse).
It was OK for v5.3+ kernels, but turned up needing an implicit change
68e5c6f073bcf70 "(ARC: entry: EV_Trap expects r10 (vs. r9) to have
 exception cause)" merged in v5.3 which itself was not backported.
So to summarize the stable backport of this patch for v5.2 and prior
kernels is busted and it won't boot.

The obvious solution is backport 68e5c6f073bcf70 but that is a pain as
it doesn't revert cleanly and each of affected kernels (so far v4.19,
v4.14, v4.9, v4.4) needs a slightly different massaged varaint.
So the easier fix is to simply revert the backport from 5.2 and prior.
The issue was not a big deal as it would cause strace to sporadically
not work correctly.

Waldemar Brodkorb first reported this when running ARC uClibc regressions
on latest stable kernels (with offending backport). Once he bisected it,
the analysis was trivial, so thx to him for this.

Reported-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Bisected-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Cc: stable <stable@vger.kernel.org> # 5.2 and prior
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arc/kernel/entry.S |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

--- a/arch/arc/kernel/entry.S
+++ b/arch/arc/kernel/entry.S
@@ -156,6 +156,7 @@ END(EV_Extension)
 tracesys:
 	; save EFA in case tracer wants the PC of traced task
 	; using ERET won't work since next-PC has already committed
+	lr  r12, [efa]
 	GET_CURR_TASK_FIELD_PTR   TASK_THREAD, r11
 	st  r12, [r11, THREAD_FAULT_ADDR]	; thread.fault_address
 
@@ -198,9 +199,15 @@ tracesys_exit:
 ; Breakpoint TRAP
 ; ---------------------------------------------
 trap_with_param:
-	mov r0, r12	; EFA in case ptracer/gdb wants stop_pc
+
+	; stop_pc info by gdb needs this info
+	lr  r0, [efa]
 	mov r1, sp
 
+	; Now that we have read EFA, it is safe to do "fake" rtie
+	;   and get out of CPU exception mode
+	FAKE_RET_FROM_EXCPN
+
 	; Save callee regs in case gdb wants to have a look
 	; SP will grow up by size of CALLEE Reg-File
 	; NOTE: clobbers r12
@@ -227,10 +234,6 @@ ENTRY(EV_Trap)
 
 	EXCEPTION_PROLOGUE
 
-	lr  r12, [efa]
-
-	FAKE_RET_FROM_EXCPN
-
 	;============ TRAP 1   :breakpoints
 	; Check ECR for trap with arg (PROLOGUE ensures r9 has ECR)
 	bmsk.f 0, r9, 7
@@ -238,6 +241,9 @@ ENTRY(EV_Trap)
 
 	;============ TRAP  (no param): syscall top level
 
+	; First return from Exception to pure K mode (Exception/IRQs renabled)
+	FAKE_RET_FROM_EXCPN
+
 	; If syscall tracing ongoing, invoke pre-post-hooks
 	GET_CURR_THR_INFO_FLAGS   r10
 	btst r10, TIF_SYSCALL_TRACE


Patches currently in stable-queue which might be from Vineet.Gupta1@synopsys.com are

queue-4.19/revert-arc-entry-fix-potential-efa-clobber-when-tif_syscall_trace.patch

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"
  2020-11-09 10:29     ` Greg Kroah-Hartman
@ 2020-11-10 19:33       ` Vineet Gupta
  0 siblings, 0 replies; 9+ messages in thread
From: Vineet Gupta @ 2020-11-10 19:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Waldemar Brodkorb, linux-snps-arc, linux-kernel, stable

On 11/9/20 2:29 AM, Greg Kroah-Hartman wrote:
> On Sat, Nov 07, 2020 at 03:10:06PM +0100, Greg Kroah-Hartman wrote:
>> On Fri, Nov 06, 2020 at 08:27:44PM +0000, Vineet Gupta wrote:
>>> Hi Stable Team,
>>>
>>> On 10/19/20 7:19 PM, Vineet Gupta wrote:
>>>> This reverts commit 00fdec98d9881bf5173af09aebd353ab3b9ac729.
>>>> (but only from 5.2 and prior kernels)
>>>>
>>>> The original commit was a preventive fix based on code-review and was
>>>> auto-picked for stable back-port (for better or worse).
>>>> It was OK for v5.3+ kernels, but turned up needing an implicit change
>>>> 68e5c6f073bcf70 "(ARC: entry: EV_Trap expects r10 (vs. r9) to have
>>>>   exception cause)" merged in v5.3 which itself was not backported.
>>>> So to summarize the stable backport of this patch for v5.2 and prior
>>>> kernels is busted and it won't boot.
>>>>
>>>> The obvious solution is backport 68e5c6f073bcf70 but that is a pain as
>>>> it doesn't revert cleanly and each of affected kernels (so far v4.19,
>>>> v4.14, v4.9, v4.4) needs a slightly different massaged varaint.
>>>> So the easier fix is to simply revert the backport from 5.2 and prior.
>>>> The issue was not a big deal as it would cause strace to sporadically
>>>> not work correctly.
>>>>
>>>> Waldemar Brodkorb first reported this when running ARC uClibc regressions
>>>> on latest stable kernels (with offending backport). Once he bisected it,
>>>> the analysis was trivial, so thx to him for this.
>>>>
>>>> Reported-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
>>>> Bisected-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
>>>> Cc: stable <stable@vger.kernel.org> # 5.2 and prior
>>>> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
>>> Can this revert be please applied to 4.19 and older kernels for the next cycle.
>>>
>>> Or is there is a procedural issue given this revert is not in mainline. I've
>>> described the issue in detail above so if there's a better/desirable way of
>>> reverting it from backports, please let me know.
>> THis is fine, sorry, it's just in a backlog of lots of stable patches...
>>
>> We will get to it soon.
> Now queued up, thanks.

Thx a bunch Greg.

-Vineet
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-11-10 19:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-20  2:19 [PATCH] Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE" Vineet Gupta
2020-11-06 20:27 ` Vineet Gupta
2020-11-07 14:10   ` Greg Kroah-Hartman
2020-11-09 10:29     ` Greg Kroah-Hartman
2020-11-10 19:33       ` Vineet Gupta
2020-11-09 10:34 ` Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.4-stable tree gregkh
2020-11-09 10:40 ` Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.9-stable tree gregkh
2020-11-09 10:40 ` Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.14-stable tree gregkh
2020-11-09 10:42 ` Patch "Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"" has been added to the 4.19-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).