1. 27 11月, 2018 1 次提交
  2. 14 9月, 2017 1 次提交
  3. 07 7月, 2017 2 次提交
  4. 04 5月, 2017 2 次提交
  5. 11 1月, 2016 1 次提交
    • M
      um: Fix ptrace GETREGS/SETREGS bugs · e04c989e
      Mickaël Salaün 提交于
      This fix two related bugs:
      * PTRACE_GETREGS doesn't get the right orig_ax (syscall) value
      * PTRACE_SETREGS can't set the orig_ax value (erased by initial value)
      
      Get rid of the now useless and error-prone get_syscall().
      
      Fix inconsistent behavior in the ptrace implementation for i386 when
      updating orig_eax automatically update the syscall number as well. This
      is now updated in handle_syscall().
      Signed-off-by: NMickaël Salaün <mic@digikod.net>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Will Drewry <wad@chromium.org>
      Cc: Thomas Meyer <thomas@m3y3r.de>
      Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
      Cc: Anton Ivanov <aivanov@brocade.com>
      Cc: Meredydd Luff <meredydd@senatehouse.org>
      Cc: David Drysdale <drysdale@google.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Acked-by: NKees Cook <keescook@chromium.org>
      e04c989e
  6. 07 11月, 2015 2 次提交
    • A
      um: Switch clocksource to hrtimers · 2eb5f31b
      Anton Ivanov 提交于
      UML is using an obsolete itimer call for
      all timers and "polls" for kernel space timer firing
      in its userspace portion resulting in a long list
      of bugs and incorrect behaviour(s). It also uses
      ITIMER_VIRTUAL for its timer which results in the
      timer being dependent on it running and the cpu
      load.
      
      This patch fixes this by moving to posix high resolution
      timers firing off CLOCK_MONOTONIC and relaying the timer
      correctly to the UML userspace.
      
      Fixes:
       - crashes when hosts suspends/resumes
       - broken userspace timers - effecive ~40Hz instead
         of what they should be. Note - this modifies skas behavior
         by no longer setting an itimer per clone(). Timer events
         are relayed instead.
       - kernel network packet scheduling disciplines
       - tcp behaviour especially under load
       - various timer related corner cases
      
      Finally, overall responsiveness of userspace is better.
      Signed-off-by: NThomas Meyer <thomas@m3y3r.de>
      Signed-off-by: NAnton Ivanov <aivanov@brocade.com>
      [rw: massaged commit message]
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      2eb5f31b
    • R
      um: Store syscall number after syscall_trace_enter() · 1d80f0cd
      Richard Weinberger 提交于
      To support changing syscall numbers we have to store
      it after syscall_trace_enter().
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      1d80f0cd
  7. 31 5月, 2015 1 次提交
  8. 14 4月, 2015 2 次提交
    • T
      um: Move uml_postsetup in the init_thread stack · 33bbc306
      Thomas Meyer 提交于
      atomic_notifier_chain_register() and uml_postsetup() do call kernel code
      that rely on the "current" kernel macro and a valid task_struct resp.
      thread_info struct. Give those functions a valid stack by moving
      uml_postsetup() in the init_thread stack. This moves enables a panic()
      call in this early code to generate a valid stacktrace, instead of
      crashing.
      E.g. when an UML kernel is started with an initrd but too few physical
      memory the panic() call get's actually processed.
      Signed-off-by: NThomas Meyer <thomas@m3y3r.de>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      33bbc306
    • R
      um: Remove SKAS3/4 support · d0b5e15f
      Richard Weinberger 提交于
      Before we had SKAS0 UML had two modes of operation
      TT (tracing thread) and SKAS3/4 (separated kernel address space).
      TT was known to be insecure and got removed a long time ago.
      SKAS3/4 required a few (3 or 4) patches on the host side which never went
      mainline. The last host patch is 10 years old.
      
      With SKAS0 mode (separated kernel address space using 0 host patches),
      default since 2005, SKAS3/4 is obsolete and can be removed.
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      d0b5e15f
  9. 20 7月, 2014 1 次提交
  10. 19 7月, 2013 2 次提交
  11. 10 10月, 2012 1 次提交
  12. 02 8月, 2012 2 次提交
  13. 02 11月, 2011 9 次提交
  14. 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
  15. 25 7月, 2008 1 次提交
  16. 07 6月, 2008 1 次提交
  17. 13 5月, 2008 1 次提交
  18. 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
  19. 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
  20. 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
  21. 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