1. 10 10月, 2012 1 次提交
  2. 02 8月, 2012 2 次提交
  3. 02 11月, 2011 9 次提交
  4. 15 9月, 2011 1 次提交
    • I
      um: Save FPU registers between task switches · fbfe9c84
      Ingo van Lil 提交于
      Some time ago Jeff prepared 42daba31 ("uml: stop saving process FP
      state") for UML to stop saving the process FP state between task
      switches.  The assumption was that since with SKAS0 every guest process
      runs inside a host process context the host OS will take care of keeping
      the proper FP state.
      
      Unfortunately this is not true for multi-threaded applications, where
      all guest threads share a single host process context yet all may use
      the FPU on their own.  Although I haven't verified it I suspect things
      to be even worse in SKAS3 mode where all guest processes run inside a
      single host process.
      
      The patch reintroduces the saving and restoring of the FP context
      between task switches.
      
      [richard@nod.at: Ingo posted this patch in 2009, sadly it was never applied
      and got lost. Now in 2011 the problem was reported by Gunnar.]
      Signed-off-by: NIngo van Lil <inguin@gmx.de>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Reported-by: <gunnarlindroth@hotmail.com>
      Tested-by: <gunnarlindroth@hotmail.com>
      Cc: Stanislav Meduna <stano@meduna.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fbfe9c84
  5. 25 7月, 2008 1 次提交
  6. 07 6月, 2008 1 次提交
  7. 13 5月, 2008 1 次提交
  8. 24 2月, 2008 1 次提交
    • J
      uml: fix FP register corruption · 2f56debd
      Jeff Dike 提交于
      Commit ee3d9bd4 ("uml: simplify SIGSEGV
      handling"), while greatly simplifying the kernel SIGSEGV handler that
      runs in the process address space, introduced a bug which corrupts FP
      state in the process.
      
      Previously, the SIGSEGV handler called the sigreturn system call by hand - it
      couldn't return through the restorer provided to it because that could try to
      call the libc restorer which likely wouldn't exist in the process address
      space.  So, it blocked off some signals, including SIGUSR1, on entry to the
      SIGSEGV handler, queued a SIGUSR1 to itself, and invoked sigreturn.  The
      SIGUSR1 was delivered, and was visible to the UML kernel after sigreturn
      finished.
      
      The commit eliminated the signal masking and the call to sigreturn.  The
      handler simply hits itself with a SIGTRAP to let the UML kernel know that it
      is finished.  UML then restores the process registers, which effectively
      longjmps the process out of the signal handler, skipping sigreturn's restoring
      of register state and the signal mask.
      
      The bug is that the host apparently sets used_fp to 0 when it saves the
      process FP state in the sigcontext on the process signal stack.  Thus, when
      the process is longjmped out of the handler, its FP state is corrupt because
      it wasn't saved on the context switch to the UML kernel.
      
      This manifested itself as sleep hanging.  For some reason, sleep uses floating
      point in order to calculate the sleep interval.  When a page fault corrupts
      its FP state, it is faked into essentially sleeping forever.
      
      This patch saves the FP state before entering the SIGSEGV handler and restores
      it afterwards.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2f56debd
  9. 09 2月, 2008 1 次提交
    • J
      uml: style fixes in arch/um/os-Linux · 5134d8fe
      Jeff Dike 提交于
      Style changes under arch/um/os-Linux:
      	include trimming
      	CodingStyle fixes
      	some printks needed severity indicators
      
      make_tempfile turns out not to be used outside of mem.c, so it is now static.
      Its declaration in tempfile.h is no longer needed, and tempfile.h itself is no
      longer needed.
      
      create_tmp_file was also made static.
      
      checkpatch moans about an EXPORT_SYMBOL in user_syms.c which is part of a
      macro definition - this is copying a bit of kernel infrastructure into the
      libc side of UML because the kernel headers can't be included there.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5134d8fe
  10. 06 2月, 2008 6 次提交
    • J
      uml: add newlines to printks · b5498832
      Jeff Dike 提交于
      Some printks were missing newlines.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b5498832
    • J
      uml: don't allow processes to call into stub · e06173bd
      Jeff Dike 提交于
      Kill a process that tries to branch into a stub and execute a system
      call.  There are no security implications here - a system call in a
      stub is treated the same as a system call anywhere else.  But if a
      process is trying to branch into a stub, either it is trying something
      nasty or it has gone haywire, so it's a good idea to get rid of it in
      either case.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e06173bd
    • J
      uml: kill processes instead of panicing kernel · 3e6f2ac4
      Jeff Dike 提交于
      UML was panicing in the case of failures of libc calls which shouldn't happen.
       This is an overreaction since a failure from libc doesn't normally mean that
      kernel data structures are in an unknown state.  Instead, the current process
      should just be killed if there is no way to recover.
      
      The case that prompted this was a failure of PTRACE_SETREGS restoring the same
      state that was read by PTRACE_GETREGS.  It appears that when a process tries
      to load a bogus value into a segment register, it segfaults (as expected) and
      the value is actually loaded and is seen by PTRACE_GETREGS (not expected).
      
      This case is fixed by forcing a fatal SIGSEGV on the process so that it
      immediately dies.  fatal_sigsegv was added for this purpose.  It was declared
      as noreturn, so in order to pursuade gcc that it actually does not return, I
      added a call to os_dump_core (and declared it noreturn) so that I get a core
      file if somehow the process survives.
      
      All other calls in arch/um/os-Linux/skas/process.c got the same treatment,
      with failures causing the process to die instead of a kernel panic, with some
      exceptions.
      
      userspace_tramp exits with status 1 if anything goes wrong there.  That will
      cause start_userspace to return an error.  copy_context_skas0 and
      map_stub_pages also now return errors instead of panicing.  Callers of thes
      functions were changed to check for errors and do something appropriate.
      Usually that's to return an error to their callers.
      check_skas3_ptrace_faultinfo just exits since that's too early to do anything
      else.
      
      save_registers, restore_registers, and init_registers now return status
      instead of panicing on failure, with their callers doing something
      appropriate.
      
      There were also duplicate declarations of save_registers and restore_registers
      in os.h - these are gone.
      
      I noticed and fixed up some whitespace damage.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3e6f2ac4
    • J
      uml: use ptrace directly in libc code · d25f2e12
      Jeff Dike 提交于
      Some register accessor cleanups -
      	userspace() was calling restore_registers and save_registers for no
      reason, since userspace() is on the libc side of the house, and these
      add no value over calling ptrace directly
      	init_thread_registers and get_safe_registers were the same thing,
      so init_thread_registers is gone
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d25f2e12
    • J
      uml: simplify SIGSEGV handling · ee3d9bd4
      Jeff Dike 提交于
      Simplify the page fault stub by not masking signals while it is running.  This
      allows it to signal that it is done by executing an instruction which will
      generate a SIGTRAP (int3 on x86) rather than running sigreturn by hand after
      queueing a blocked SIGUSR1.
      
      userspace_tramp now no longer puts anything in the SIGSEGV sa_mask, but it
      does add SA_NODEFER to sa_flags so that SIGSEGV is still enabled after the
      signal handler fails to run sigreturn.
      
      SIGWINCH is just blocked so that we don't have to deal with it and the signal
      masks used by wait_stub_done are updated to reflect the smaller number of
      signals that it has to worry about.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ee3d9bd4
    • J
      uml: tidy kern_util.h · edea1385
      Jeff Dike 提交于
      Tidy kern_util.h.  It turns out that most of the function declarations
      aren't used, so they can go away.  os.h no longer includes
      kern_util.h, so files which got it through os.h now need to include it
      directly.  A number of other files never needed it, so these includes
      are deleted.
      
      The structure which was used to pass signal handlers from the kernel
      side to the userspace side is gone.  Instead, the handlers are
      declared here, and used directly from libc code.  This allows
      arch/um/os-Linux/trap.c to be deleted, with its remnants being moved
      to arch/um/os-Linux/skas/trap.c.
      
      arch/um/os-Linux/tty.c had its inclusions changed, and it needed some
      style attention, so it got tidied.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      edea1385
  11. 18 12月, 2007 1 次提交
    • S
      uml: stop gdb from deleting breakpoints when running UML · 4dbed85a
      Stanislaw Gruszka 提交于
      Sometimes when UML is debugged gdb miss breakpoints.
      
      When process traced by gdb do fork, debugger remove breakpoints from
      child address space. There is possibility to trace more than one fork,
      but this not work with UML, I guess (only guess) there is a deadlock -
      gdb waits for UML and UML waits for gdb.
      
      When clone() is called with SIGCHLD and CLONE_VM flags, gdb see this
      as PTRACE_EVENT_FORK not as PTRACE_EVENT_CLONE and remove breakpoints
      from child and at the same time from traced process, because either
      have the same address space.
      
      Maybe it is possible to do fix in gdb, but I'm not sure if there is
      easy way to find out if traced and child processes share memory. So I
      do fix for UML, it simply do not call clone() with both SIGCHLD and
      CLONE_VM flags together.  Additionally __WALL flag is used for
      waitpid() to assure not miss clone and normal process events.
      
      [ jdike - checkpatch fixes ]
      Signed-off-by: NStanislaw Gruszka <stf_xl@wp.pl>
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4dbed85a
  12. 17 10月, 2007 13 次提交
  13. 17 7月, 2007 1 次提交
    • J
      uml: SIGIO support cleanup · 42a359e3
      Jeff Dike 提交于
      Cleanup of the SIGWINCH support.
      
      Some code and comment reformatting.
      
      The stack used for SIGWINCH threads was leaked.  This is now fixed by storing
      it with the pid and other information, and freeing it when the thread is
      killed.
      
      If something goes wrong with a WIGWINCH thread, and this is discovered in the
      interrupt handler, the winch record would leak.  It is now freed, except that
      the IRQ isn't freed.  This is hard to do from interrupt context.  This has the
      side-effect that the IRQ system maintains a reference to the freed structure,
      but that shouldn't cause a problem since the descriptor is disabled.
      
      register_winch_irq is now much better about cleaning up after an
      initialization failure.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      42a359e3
  14. 17 6月, 2007 1 次提交