1. 25 12月, 2015 1 次提交
    • R
      sparc64: fix FP corruption in user copy functions · a7c5724b
      Rob Gardner 提交于
      Short story: Exception handlers used by some copy_to_user() and
      copy_from_user() functions do not diligently clean up floating point
      register usage, and this can result in a user process seeing invalid
      values in floating point registers. This sometimes makes the process
      fail.
      
      Long story: Several cpu-specific (NG4, NG2, U1, U3) memcpy functions
      use floating point registers and VIS alignaddr/faligndata to
      accelerate data copying when source and dest addresses don't align
      well. Linux uses a lazy scheme for saving floating point registers; It
      is not done upon entering the kernel since it's a very expensive
      operation. Rather, it is done only when needed. If the kernel ends up
      not using FP regs during the course of some trap or system call, then
      it can return to user space without saving or restoring them.
      
      The various memcpy functions begin their FP code with VISEntry (or a
      variation thereof), which saves the FP regs. They conclude their FP
      code with VISExit (or a variation) which essentially marks the FP regs
      "clean", ie, they contain no unsaved values. fprs.FPRS_FEF is turned
      off so that a lazy restore will be triggered when/if the user process
      accesses floating point regs again.
      
      The bug is that the user copy variants of memcpy, copy_from_user() and
      copy_to_user(), employ an exception handling mechanism to detect faults
      when accessing user space addresses, and when this handler is invoked,
      an immediate return from the function is forced, and VISExit is not
      executed, thus leaving the fprs register in an indeterminate state,
      but often with fprs.FPRS_FEF set and one or more dirty bits. This
      results in a return to user space with invalid values in the FP regs,
      and since fprs.FPRS_FEF is on, no lazy restore occurs.
      
      This bug affects copy_to_user() and copy_from_user() for NG4, NG2,
      U3, and U1. All are fixed by using a new exception handler for those
      loads and stores that are done during the time between VISEnter and
      VISExit.
      
      n.b. In NG4memcpy, the problematic code can be triggered by a copy
      size greater than 128 bytes and an unaligned source address.  This bug
      is known to be the cause of random user process memory corruptions
      while perf is running with the callgraph option (ie, perf record -g).
      This occurs because perf uses copy_from_user() to read user stacks,
      and may fault when it follows a stack frame pointer off to an
      invalid page. Validation checks on the stack address just obscure
      the underlying problem.
      Signed-off-by: NRob Gardner <rob.gardner@oracle.com>
      Signed-off-by: NDave Aldridge <david.j.aldridge@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a7c5724b
  2. 09 2月, 2009 2 次提交
    • D
      sparc64: Fix probe_kernel_{read,write}(). · aeb39876
      David S. Miller 提交于
      This is based upon a report from Chris Torek and his initial patch.
      From Chris's report:
      
      --------------------
      This came up in testing kgdb, using the built-in tests -- turn
      on CONFIG_KGDB_TESTS, then
      
          echo V1 > /sys/module/kgdbts/parameters/kgdbts
      
      -- but it would affect using kgdb if you were debugging and looking
      at bad pointers.
      --------------------
      
      When we get a copy_{from,to}_user() request and the %asi is set to
      something other than ASI_AIUS (which is userspace) then we branch off
      to a routine called memcpy_user_stub().  It just does a straight
      memcpy since we are copying from kernel to kernel in this case.
      
      The logic was that since source and destination are both kernel
      pointers we don't need to have exception checks.
      
      But for what probe_kernel_{read,write}() is trying to do, we have to
      have the checks, otherwise things like kgdb bad kernel pointer
      accesses don't do the right thing.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aeb39876
    • D
      sparc64: Kill .fixup section bloat. · 40bdac7d
      David S. Miller 提交于
      This is an implementation of a suggestion made by Chris Torek:
      --------------------
      Something else I noticed in passing: the EX and EX_LD/EX_ST macros
      scattered throughout the various .S files make a fair bit of .fixup
      code, all of which does the same thing.  At the cost of one symbol
      in copy_in_user.S, you could just have one common two-instruction
      retl-and-mov-1 fixup that they all share.
      --------------------
      
      The following is with a defconfig build:
      
         text	   data	    bss	    dec	    hex	filename
      3972767	 344024	 584449	4901240	 4ac978	vmlinux.orig
      39688877	 344024	 584449	4897360	 4aba50	vmlinux
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      40bdac7d
  3. 05 12月, 2008 1 次提交
  4. 16 8月, 2007 1 次提交
  5. 20 3月, 2006 2 次提交
  6. 05 3月, 2006 1 次提交
  7. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4