diff mbox

[076/133] ARM: update FIQ support for relocation of vectors

Message ID 1376692475-28413-77-git-send-email-kamal@canonical.com
State New
Headers show

Commit Message

Kamal Mostafa Aug. 16, 2013, 10:33 p.m. UTC
3.8.13.7 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Russell King <rmk+kernel@arm.linux.org.uk>

commit e39e3f3ebfef03450cf7bfa7a974a8c61f7980c8 upstream.

FIQ should no longer copy the FIQ code into the user visible vector
page.  Instead, it should use the hidden page.  This change makes
that happen.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/kernel/entry-armv.S |  3 +++
 arch/arm/kernel/fiq.c        | 19 ++++++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)

Comments

Kamal Mostafa Aug. 19, 2013, 4:02 p.m. UTC | #1
Thanks Aaro.  I'll apply "2ba85e7 ARM: Fix FIQ code on VIVT CPUs" to
3.8-stable.

Greg KH and Luis Henriques:  Heads up!  3.10-stable and 3.5-stable also
need 2ba85e7 but it isn't marked cc: stable.

 -Kamal


On Mon, 2013-08-19 at 00:09 +0300, Aaro Koskinen wrote:
> On Fri, Aug 16, 2013 at 03:33:38PM -0700, Kamal Mostafa wrote:
> > 3.8.13.7 -stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Russell King <rmk+kernel@arm.linux.org.uk>
> > 
> > commit e39e3f3ebfef03450cf7bfa7a974a8c61f7980c8 upstream.
> > 
> > FIQ should no longer copy the FIQ code into the user visible vector
> > page.  Instead, it should use the hidden page.  This change makes
> > that happen.
> 
> FYI, this patch introduced regression (kernel crash) at least on Amstrad
> E1 board (where FIQ is used for the keyboard). See the following thread:
> http://marc.info/?t=137583169900003&r=1&w=2
> 
> So any stable kernels where this patch was added should also take:
> 
> 	commit 2ba85e7af4c639d933c9a87a6d7363f2983d5ada
> 	Author: Russell King <rmk+kernel@arm.linux.org.uk>
> 	Date:   Thu Aug 8 11:51:21 2013 +0100
> 
> 	ARM: Fix FIQ code on VIVT CPUs
> 
> That patch fixes the regression.
> 
> A.
>
Russell King - ARM Linux Aug. 19, 2013, 4:07 p.m. UTC | #2
On Mon, Aug 19, 2013 at 09:02:23AM -0700, Kamal Mostafa wrote:
> Thanks Aaro.  I'll apply "2ba85e7 ARM: Fix FIQ code on VIVT CPUs" to
> 3.8-stable.
> 
> Greg KH and Luis Henriques:  Heads up!  3.10-stable and 3.5-stable also
> need 2ba85e7 but it isn't marked cc: stable.

There's others from that branch which are probably also needed but I want
them to sit in -rc for a bit before I request them to move into the stable
trees - in case anyone finds anything more from the security fixes a while
back.
Luis Henriques Aug. 20, 2013, 1:25 p.m. UTC | #3
Kamal Mostafa <kamal@canonical.com> writes:

> Thanks Aaro.  I'll apply "2ba85e7 ARM: Fix FIQ code on VIVT CPUs" to
> 3.8-stable.
>
> Greg KH and Luis Henriques:  Heads up!  3.10-stable and 3.5-stable also
> need 2ba85e7 but it isn't marked cc: stable.
>
>  -Kamal
>

Thanks.  I've also seen your IRC msg.  I'll hold this commit for now.

Btw, not sure if you've seen the discussion around

58ad436 genetlink: fix family dump race

Looks like there's a regression introduced by this commit.  I'm
holding it as well.

Cheers,
Kamal Mostafa Aug. 20, 2013, 10:50 p.m. UTC | #4
On Mon, 2013-08-19 at 17:07 +0100, Russell King - ARM Linux wrote:
> On Mon, Aug 19, 2013 at 09:02:23AM -0700, Kamal Mostafa wrote:
> > Thanks Aaro.  I'll apply "2ba85e7 ARM: Fix FIQ code on VIVT CPUs" to
> > 3.8-stable.
> > 
> > Greg KH and Luis Henriques:  Heads up!  3.10-stable and 3.5-stable also
> > need 2ba85e7 but it isn't marked cc: stable.
> 
> There's others from that branch which are probably also needed but I want
> them to sit in -rc for a bit before I request them to move into the stable
> trees - in case anyone finds anything more from the security fixes a while
> back.


[ 3.8-stable ]

On Russell's advice I intend to hold off on applying some of the ARM
security-fixes commits to the imminent v3.8.13.7 release, and instead
pick them up in the next 3.8-stable cycle.  Specifically:

These previously announced commits will NOT be included in 3.8.13.7:

        2ba85e7 ARM: Fix FIQ code on VIVT CPUs
        f6f91b0 ARM: allow kuser helpers to be removed from the vector page
        e39e3f3 ARM: update FIQ support for relocation of vectors

These still WILL be included in 3.8.13.7:

        0cb79f8 ARM: use linker magic for vectors and vector stubs
        b9e2c32 ARM: move vector stubs
        6810219 ARM: poison memory between kuser helpers
        73c083a ARM: poison the vectors page

(Aaro, I'll make sure to keep e39e3f3 and 2ba85e7 together when I pick
them up).

Any objections?

 -Kamal
Russell King - ARM Linux Aug. 20, 2013, 10:57 p.m. UTC | #5
On Tue, Aug 20, 2013 at 03:50:08PM -0700, Kamal Mostafa wrote:
> On Mon, 2013-08-19 at 17:07 +0100, Russell King - ARM Linux wrote:
> > On Mon, Aug 19, 2013 at 09:02:23AM -0700, Kamal Mostafa wrote:
> > > Thanks Aaro.  I'll apply "2ba85e7 ARM: Fix FIQ code on VIVT CPUs" to
> > > 3.8-stable.
> > > 
> > > Greg KH and Luis Henriques:  Heads up!  3.10-stable and 3.5-stable also
> > > need 2ba85e7 but it isn't marked cc: stable.
> > 
> > There's others from that branch which are probably also needed but I want
> > them to sit in -rc for a bit before I request them to move into the stable
> > trees - in case anyone finds anything more from the security fixes a while
> > back.
> 
> 
> [ 3.8-stable ]
> 
> On Russell's advice I intend to hold off on applying some of the ARM
> security-fixes commits to the imminent v3.8.13.7 release, and instead
> pick them up in the next 3.8-stable cycle.  Specifically:
> 
> These previously announced commits will NOT be included in 3.8.13.7:
> 
>         2ba85e7 ARM: Fix FIQ code on VIVT CPUs
>         f6f91b0 ARM: allow kuser helpers to be removed from the vector page
>         e39e3f3 ARM: update FIQ support for relocation of vectors
> 
> These still WILL be included in 3.8.13.7:
> 
>         0cb79f8 ARM: use linker magic for vectors and vector stubs
>         b9e2c32 ARM: move vector stubs
>         6810219 ARM: poison memory between kuser helpers
>         73c083a ARM: poison the vectors page
> 
> (Aaro, I'll make sure to keep e39e3f3 and 2ba85e7 together when I pick
> them up).
> 
> Any objections?

No, that sounds sensible, thanks.
Greg KH Aug. 22, 2013, 9:52 p.m. UTC | #6
On Mon, Aug 19, 2013 at 05:07:41PM +0100, Russell King - ARM Linux wrote:
> On Mon, Aug 19, 2013 at 09:02:23AM -0700, Kamal Mostafa wrote:
> > Thanks Aaro.  I'll apply "2ba85e7 ARM: Fix FIQ code on VIVT CPUs" to
> > 3.8-stable.
> > 
> > Greg KH and Luis Henriques:  Heads up!  3.10-stable and 3.5-stable also
> > need 2ba85e7 but it isn't marked cc: stable.
> 
> There's others from that branch which are probably also needed but I want
> them to sit in -rc for a bit before I request them to move into the stable
> trees - in case anyone finds anything more from the security fixes a while
> back.

Ok, I'll hold off on applying this one until you say it is good to go.

thanks,

greg k-h
diff mbox

Patch

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index c19779f..4c28aff 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -1162,6 +1162,9 @@  vector_addrexcptn:
 vector_fiq:
 	subs	pc, lr, #4
 
+	.globl	vector_fiq_offset
+	.equ	vector_fiq_offset, vector_fiq
+
 	.section .vectors, "ax", %progbits
 __vectors_start:
 	W(b)	vector_rst
diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c
index 2adda11..25442f4 100644
--- a/arch/arm/kernel/fiq.c
+++ b/arch/arm/kernel/fiq.c
@@ -47,6 +47,11 @@ 
 #include <asm/irq.h>
 #include <asm/traps.h>
 
+#define FIQ_OFFSET ({					\
+		extern void *vector_fiq_offset;		\
+		(unsigned)&vector_fiq_offset;		\
+	})
+
 static unsigned long no_fiq_insn;
 
 /* Default reacquire function
@@ -80,13 +85,16 @@  int show_fiq_list(struct seq_file *p, int prec)
 void set_fiq_handler(void *start, unsigned int length)
 {
 #if defined(CONFIG_CPU_USE_DOMAINS)
-	memcpy((void *)0xffff001c, start, length);
+	void *base = (void *)0xffff0000;
 #else
-	memcpy(vectors_page + 0x1c, start, length);
+	void *base = vectors_page;
 #endif
-	flush_icache_range(0xffff001c, 0xffff001c + length);
+	unsigned offset = FIQ_OFFSET;
+
+	memcpy(base + offset, start, length);
+	flush_icache_range(0xffff0000 + offset, 0xffff0000 + offset + length);
 	if (!vectors_high())
-		flush_icache_range(0x1c, 0x1c + length);
+		flush_icache_range(offset, offset + length);
 }
 
 int claim_fiq(struct fiq_handler *f)
@@ -144,6 +152,7 @@  EXPORT_SYMBOL(disable_fiq);
 
 void __init init_FIQ(int start)
 {
-	no_fiq_insn = *(unsigned long *)0xffff001c;
+	unsigned offset = FIQ_OFFSET;
+	no_fiq_insn = *(unsigned long *)(0xffff0000 + offset);
 	fiq_start = start;
 }