linux-mips
[Top] [All Lists]

Re: Improper handling of unaligned user address access?

To: "Steven J. Hill" <sjhill@realitydiluted.com>
Subject: Re: Improper handling of unaligned user address access?
From: "Steven J. Hill" <sjhill@realitydiluted.com>
Date: Mon, 03 Mar 2003 18:14:20 -0600
Cc: linux-mips@linux-mips.org
In-reply-to: <3E63B17C.8000403@realitydiluted.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <3E63B17C.8000403@realitydiluted.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021226 Debian/1.2.1-9
The first thing I tried to fix this issue was to use the
'memcpy.S' file from 2.4.7 and that actually worked, but
that was a step backwards. It was much simpler to just
add a 'nop' after the offending branch instruction. It
fixes all of my problems with 'copy_from_user'. I have
already checked these into both the 2.4 and 2.5 trees.

I do have one further question. In 'arch/mips/mm/fault.c'
when we need to do a fixup:

   fixup = search_exception_table(regs->cp0_epc);

Why do we not check to see if the EPC is a branch insn
before looking in the exception table?

-Steve
Index: memcpy.S
===================================================================
RCS file: /home/cvs/linux/arch/mips/lib/memcpy.S,v
retrieving revision 1.6.2.4
diff -u -r1.6.2.4 memcpy.S
--- memcpy.S    19 Sep 2002 14:01:24 -0000      1.6.2.4
+++ memcpy.S    4 Mar 2003 00:09:52 -0000
@@ -357,6 +357,7 @@
        beqz    len, done
         and    rem, len, NBYTES-1  # rem = len % NBYTES
        beq     rem, len, copy_bytes
+       nop
 1:
 EXC(    LDFIRST t0, FIRST(0)(src),     l_exc)
 EXC(   LDREST  t0, REST(0)(src),       l_exc_copy)
Index: memcpy.S
===================================================================
RCS file: /home/cvs/linux/arch/mips/lib/memcpy.S,v
retrieving revision 1.11
diff -u -r1.11 memcpy.S
--- memcpy.S    19 Sep 2002 14:01:28 -0000      1.11
+++ memcpy.S    4 Mar 2003 00:10:58 -0000
@@ -357,6 +357,7 @@
        beqz    len, done
         and    rem, len, NBYTES-1  # rem = len % NBYTES
        beq     rem, len, copy_bytes
+       nop
 1:
 EXC(    LDFIRST t0, FIRST(0)(src),     l_exc)
 EXC(   LDREST  t0, REST(0)(src),       l_exc_copy)
<Prev in Thread] Current Thread [Next in Thread>