1. 06 2月, 2008 1 次提交
  2. 17 10月, 2007 7 次提交
  3. 25 7月, 2007 1 次提交
    • J
      uml: more __init annotations · 97a1fcbb
      Jeff Dike 提交于
      2.6.23-rc1 turned up another batch of references from non-__init code to
      __init code.  In most cases, these were missing __init annotations.  In one
      case (os_drop_memory), the annotation was present but wrong.
      
      init_maps is __init, but for some reason was being very careful about the
      mechanism by which it allocated memory, checking whether it was OK to use
      kmalloc (at this point in the boot, it definitely isn't) and using either
      alloc_bootmem_low_pages or kmalloc/vmalloc.  So, the kmalloc/vmalloc code is
      removed.
      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>
      97a1fcbb
  4. 08 5月, 2007 6 次提交
    • J
      uml: more page fault path trimming · 16dd07bc
      Jeff Dike 提交于
      More trimming of the page fault path.
      
      Permissions are passed around in a single int rather than one bit per
      int.  The permission values are copied from libc so that they can be
      passed to mmap and mprotect without any further conversion.
      
      The register sets used by do_syscall_stub and copy_context_skas0 are
      initialized once, at boot time, rather than once per call.
      
      wait_stub_done checks whether it is getting the signals it expects by
      comparing the wait status to a mask containing bits for the signals of
      interest rather than comparing individually to the signal numbers.  It
      also has one check for a wait failure instead of two.  The caller is
      expected to do the initial continue of the stub.  This gets rid of an
      argument and some logic.  The fname argument is gone, as that can be
      had from a stack trace.
      
      user_signal() is collapsed into userspace() as it is basically one or
      two lines of code afterwards.
      
      The physical memory remapping stuff is gone, as it is unused.
      
      flush_tlb_page is inlined.
      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>
      16dd07bc
    • J
      uml: rename os_{read_write}_file_k back to os_{read_write}_file · a6ea4cce
      Jeff Dike 提交于
      Rename os_{read_write}_file_k back to os_{read_write}_file, delete
      the originals and their bogus infrastructure, and fix all the callers.
      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>
      a6ea4cce
    • J
      uml: change remaining callers of os_{read_write}_file · fda83a99
      Jeff Dike 提交于
      Convert all remaining os_{read_write}_file users to use the simple
      {read,write} wrappers, os_{read_write}_file_k.
      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>
      fda83a99
    • J
      uml: start fixing os_read_file and os_write_file · 3d564047
      Jeff Dike 提交于
      This patch starts the removal of a very old, very broken piece of code.  This
      stems from the problem of passing a userspace buffer into read() or write() on
      the host.  If that buffer had not yet been faulted in, read and write will
      return -EFAULT.
      
      To avoid this problem, the solution was to fault the buffer in before the
      system call by touching the pages that hold the buffer by doing a copy-user of
      a byte to each page.  This is obviously bogus, but it does usually work, in tt
      mode, since the kernel and process are in the same address space and userspace
      addresses can be accessed directly in the kernel.
      
      In skas mode, where the kernel and process are in separate address spaces, it
      is completely bogus because the userspace address, which is invalid in the
      kernel, is passed into the system call instead of the corresponding physical
      address, which would be valid.  Here, it appears that this code, on every host
      read() or write(), tries to fault in a random process page.  This doesn't seem
      to cause any correctness problems, but there is a performance impact.  This
      patch, and the ones following, result in a 10-15% performance gain on a kernel
      build.
      
      This code can't be immediately tossed out because when it is, you can't log
      in.  Apparently, there is some code in the console driver which depends on
      this somehow.
      
      However, we can start removing it by switching the code which does I/O using
      kernel addresses to using plain read() and write().  This patch introduces
      os_read_file_k and os_write_file_k for use with kernel buffers and converts
      all call locations which use obvious kernel buffers to use them.  These
      include I/O using buffers which are local variables which are on the stack or
      kmalloc-ed.  Later patches will handle the less obvious cases, followed by a
      mass conversion back to the original interface.
      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>
      3d564047
    • J
      uml: remove user_util.h · 9218b171
      Jeff Dike 提交于
      user_util.h isn't needed any more, so delete it and remove all includes of it.
      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>
      9218b171
    • J
      uml: create as-layout.h · 4ff83ce1
      Jeff Dike 提交于
      This patch moves all the the symbols defined in um_arch.c, which are mostly
      boundaries between different parts of the UML kernel address space, to a new
      header, as-layout.h.  There are also a few things here which aren't really
      related to address space layout, but which don't really have a better place to
      go.
      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>
      4ff83ce1
  5. 12 2月, 2007 2 次提交
  6. 11 7月, 2006 1 次提交
  7. 02 5月, 2006 1 次提交
  8. 01 5月, 2006 1 次提交
  9. 28 3月, 2006 1 次提交
    • D
      [PATCH] unify PFN_* macros · 22a9835c
      Dave Hansen 提交于
      Just about every architecture defines some macros to do operations on pfns.
       They're all virtually identical.  This patch consolidates all of them.
      
      One minor glitch is that at least i386 uses them in a very skeletal header
      file.  To keep away from #include dependency hell, I stuck the new
      definitions in a new, isolated header.
      
      Of all of the implementations, sh64 is the only one that varied by a bit.
      It used some masks to ensure that any sign-extension got ripped away before
      the arithmetic is done.  This has been posted to that sh64 maintainers and
      the development list.
      
      Compiles on x86, x86_64, ia64 and ppc64.
      Signed-off-by: NDave Hansen <haveblue@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      22a9835c
  10. 22 3月, 2006 1 次提交
  11. 02 2月, 2006 1 次提交
  12. 07 11月, 2005 1 次提交
  13. 11 9月, 2005 1 次提交
  14. 08 7月, 2005 1 次提交
    • J
      [PATCH] uml: skas0 - separate kernel address space on stock hosts · d67b569f
      Jeff Dike 提交于
      UML has had two modes of operation - an insecure, slow mode (tt mode) in
      which the kernel is mapped into every process address space which requires
      no host kernel modifications, and a secure, faster mode (skas mode) in
      which the UML kernel is in a separate host address space, which requires a
      patch to the host kernel.
      
      This patch implements something very close to skas mode for hosts which
      don't support skas - I'm calling this skas0.  It provides the security of
      the skas host patch, and some of the performance gains.
      
      The two main things that are provided by the skas patch, /proc/mm and
      PTRACE_FAULTINFO, are implemented in a way that require no host patch.
      
      For the remote address space changing stuff (mmap, munmap, and mprotect),
      we set aside two pages in the process above its stack, one of which
      contains a little bit of code which can call mmap et al.
      
      To update the address space, the system call information (system call
      number and arguments) are written to the stub page above the code.  The
      %esp is set to the beginning of the data, the %eip is set the the start of
      the stub, and it repeatedly pops the information into its registers and
      makes the system call until it sees a system call number of zero.  This is
      to amortize the cost of the context switch across multiple address space
      updates.
      
      When the updates are done, it SIGSTOPs itself, and the kernel process
      continues what it was doing.
      
      For a PTRACE_FAULTINFO replacement, we set up a SIGSEGV handler in the
      child, and let it handle segfaults rather than nullifying them.  The
      handler is in the same page as the mmap stub.  The second page is used as
      the stack.  The handler reads cr2 and err from the sigcontext, sticks them
      at the base of the stack in a faultinfo struct, and SIGSTOPs itself.  The
      kernel then reads the faultinfo and handles the fault.
      
      A complication on x86_64 is that this involves resetting the registers to
      the segfault values when the process is inside the kill system call.  This
      breaks on x86_64 because %rcx will contain %rip because you tell SYSRET
      where to return to by putting the value in %rcx.  So, this corrupts $rcx on
      return from the segfault.  To work around this, I added an
      arch_finish_segv, which on x86 does nothing, but which on x86_64 ptraces
      the child back through the sigreturn.  This causes %rcx to be restored by
      sigreturn and avoids the corruption.  Ultimately, I think I will replace
      this with the trick of having it send itself a blocked signal which will be
      unblocked by the sigreturn.  This will allow it to be stopped just after
      the sigreturn, and PTRACE_SYSCALLed without all the back-and-forth of
      PTRACE_SYSCALLing it through sigreturn.
      
      This runs on a stock host, so theoretically (and hopefully), tt mode isn't
      needed any more.  We need to make sure that this is better in every way
      than tt mode, though.  I'm concerned about the speed of address space
      updates and page fault handling, since they involve extra round-trips to
      the child.  We can amortize the round-trip cost for large address space
      updates by writing all of the operations to the data page and having the
      child execute them all at the same time.  This will help fork and exec, but
      not page faults, since they involve only one page.
      
      I can't think of any way to help page faults, except to add something like
      PTRACE_FAULTINFO to the host.  There is PTRACE_SIGINFO, but UML doesn't use
      siginfo for SIGSEGV (or anything else) because there isn't enough
      information in the siginfo struct to handle page faults (the faulting
      operation type is missing).  Adding that would make PTRACE_SIGINFO a usable
      equivalent to PTRACE_FAULTINFO.
      
      As for the code itself:
      
      - The system call stub is in arch/um/kernel/sys-$(SUBARCH)/stub.S.  It is
        put in its own section of the binary along with stub_segv_handler in
        arch/um/kernel/skas/process.c.  This is manipulated with run_syscall_stub
        in arch/um/kernel/skas/mem_user.c.  syscall_stub will execute any system
        call at all, but it's only used for mmap, munmap, and mprotect.
      
      - The x86_64 stub calls sigreturn by hand rather than allowing the normal
        sigreturn to happen, because the normal sigreturn is a SA_RESTORER in
        UML's address space provided by libc.  Needless to say, this is not
        available in the child's address space.  Also, it does a couple of odd
        pops before that which restore the stack to the state it was in at the
        time the signal handler was called.
      
      - There is a new field in the arch mmu_context, which is now a union.
        This is the pid to be manipulated rather than the /proc/mm file
        descriptor.  Code which deals with this now checks proc_mm to see whether
        it should use the usual skas code or the new code.
      
      - userspace_tramp is now used to create a new host process for every UML
        process, rather than one per UML processor.  It checks proc_mm and
        ptrace_faultinfo to decide whether to map in the pages above its stack.
      
      - start_userspace now makes CLONE_VM conditional on proc_mm since we need
        separate address spaces now.
      
      - switch_mm_skas now just sets userspace_pid[0] to the new pid rather
        than PTRACE_SWITCH_MM.  There is an addition to userspace which updates
        its idea of the pid being manipulated each time around the loop.  This is
        important on exec, when the pid will change underneath userspace().
      
      - The stub page has a pte, but it can't be mapped in using tlb_flush
        because it is part of tlb_flush.  This is why it's required for it to be
        mapped in by userspace_tramp.
      
      Other random things:
      
      - The stub section in uml.lds.S is page aligned.  This page is written
        out to the backing vm file in setup_physmem because it is mapped from
        there into user processes.
      
      - There's some confusion with TASK_SIZE now that there are a couple of
        extra pages that the process can't use.  TASK_SIZE is considered by the
        elf code to be the usable process memory, which is reasonable, so it is
        decreased by two pages.  This confuses the definition of
        USER_PGDS_IN_LAST_PML4, making it too small because of the rounding down
        of the uneven division.  So we round it to the nearest PGDIR_SIZE rather
        than the lower one.
      
      - I added a missing PT_SYSCALL_ARG6_OFFSET macro.
      
      - um_mmu.h was made into a userspace-usable file.
      
      - proc_mm and ptrace_faultinfo are globals which say whether the host
        supports these features.
      
      - There is a bad interaction between the mm.nr_ptes check at the end of
        exit_mmap, stack randomization, and skas0.  exit_mmap will stop freeing
        pages at the PGDIR_SIZE boundary after the last vma.  If the stack isn't
        on the last page table page, the last pte page won't be freed, as it
        should be since the stub ptes are there, and exit_mmap will BUG because
        there is an unfreed page.  To get around this, TASK_SIZE is set to the
        next lowest PGDIR_SIZE boundary and mm->nr_ptes is decremented after the
        calls to init_stub_pte.  This ensures that we know the process stack (and
        all other process mappings) will be below the top page table page, and
        thus we know that mm->nr_ptes will be one too many, and can be
        decremented.
      
      Things that need fixing:
      
      - We may need better assurrences that the stub code is PIC.
      
      - The stub pte is set up in init_new_context_skas.
      
      - alloc_pgdir is probably the right place.
      Signed-off-by: NJeff Dike <jdike@addtoit.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d67b569f
  15. 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