1. 10 9月, 2005 2 次提交
  2. 08 9月, 2005 1 次提交
  3. 05 9月, 2005 11 次提交
  4. 30 8月, 2005 1 次提交
    • S
      [PATCH] convert signal handling of NODEFER to act like other Unix boxes. · 69be8f18
      Steven Rostedt 提交于
      It has been reported that the way Linux handles NODEFER for signals is
      not consistent with the way other Unix boxes handle it.  I've written a
      program to test the behavior of how this flag affects signals and had
      several reports from people who ran this on various Unix boxes,
      confirming that Linux seems to be unique on the way this is handled.
      
      The way NODEFER affects signals on other Unix boxes is as follows:
      
      1) If NODEFER is set, other signals in sa_mask are still blocked.
      
      2) If NODEFER is set and the signal is in sa_mask, then the signal is
      still blocked. (Note: this is the behavior of all tested but Linux _and_
      NetBSD 2.0 *).
      
      The way NODEFER affects signals on Linux:
      
      1) If NODEFER is set, other signals are _not_ blocked regardless of
      sa_mask (Even NetBSD doesn't do this).
      
      2) If NODEFER is set and the signal is in sa_mask, then the signal being
      handled is not blocked.
      
      The patch converts signal handling in all current Linux architectures to
      the way most Unix boxes work.
      
      Unix boxes that were tested:  DU4, AIX 5.2, Irix 6.5, NetBSD 2.0, SFU
      3.5 on WinXP, AIX 5.3, Mac OSX, and of course Linux 2.6.13-rcX.
      
      * NetBSD was the only other Unix to behave like Linux on point #2. The
      main concern was brought up by point #1 which even NetBSD isn't like
      Linux.  So with this patch, we leave NetBSD as the lonely one that
      behaves differently here with #2.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      69be8f18
  5. 19 8月, 2005 1 次提交
  6. 29 7月, 2005 5 次提交
  7. 28 7月, 2005 3 次提交
  8. 27 7月, 2005 1 次提交
  9. 15 7月, 2005 1 次提交
  10. 08 7月, 2005 3 次提交
    • B
      [PATCH] uml: Proper clone support for skas0 · 9786a8f3
      Bodo Stroesser 提交于
      This patch implements the clone-stub mechanism, which allows skas0 to run
      with proc_mm==0, even if the clib in UML uses modify_ldt.
      
      Note: There is a bug in skas3.v7 host patch, that avoids UML-skas from
      running properly on a SMP-box.  In full skas3, I never really saw problems,
      but in skas0 they showed up.
      
      More commentary by jdike - What this patch does is makes sure that the host
      parent of each new host process matches the UML parent of the corresponding
      UML process.  This ensures that any changed LDTs are inherited.  This is
      done by having clone actually called by the UML process from its stub,
      rather than by the kernel.  We have special syscall stubs that are loaded
      onto the stub code page because that code must be completely
      self-contained.  These stubs are given C interfaces, and used like normal C
      functions, but there are subtleties.  Principally, we have to be careful
      about stack variables in stub_clone_handler after the clone.  The code is
      written so that there aren't any - everything boils down to a fixed
      address.  If there were any locals, references to them after the clone
      would be wrong because the stack just changed.
      Signed-off-by: NBodo Stroesser <bstroesser@fujitsu-siemens.com>
      Signed-off-by: NJeff Dike <jdike@addtoit.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9786a8f3
    • 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
    • J
      [PATCH] uml: kill some useless vmalloc tlb flushing · eda80228
      Jeff Dike 提交于
      There is absolutely no reason to flush the kernel's VM area during a
      tlb_flush_mm.
      
      This results in a noticable performance increase in the kernel build
      benchmark.
      Signed-off-by: NJeff Dike <jdike@addtoit.com>
      Cc: Paolo Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      eda80228
  11. 26 6月, 2005 5 次提交
  12. 24 6月, 2005 1 次提交
  13. 22 6月, 2005 3 次提交
    • P
      [PATCH] uml: fix linkage of tt mode against NPTL · 60b2737d
      Paolo 'Blaisorblade' Giarrusso 提交于
      With Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
      
      To make sure switcheroo() can execute when we remap all the executable
      image, we used a trick to make it use a local copy of errno...  this trick
      does not work with NPTL glibc, only with LinuxThreads, so use another
      (simpler) one to make it work anyway.
      
      Hopefully, a lot improved thanks to merging with the version of Al Viro
      (which had his part of problems, though, i.e.  removing a fix to another
      bug and not fixing the problem on i386).
      Signed-off-by: NPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      60b2737d
    • P
      [PATCH] uml: add and use generic hw_controller_type->release · dbce706e
      Paolo 'Blaisorblade' Giarrusso 提交于
      With Chris Wedgwood <cw@f00f.org>
      
      Currently UML must explicitly call the UML-specific
      free_irq_by_irq_and_dev() for each free_irq call it's done.
      
      This is needed because ->shutdown and/or ->disable are only called when the
      last "action" for that irq is removed.
      
      Instead, for UML shared IRQs (UML IRQs are very often, if not always,
      shared), for each dev_id some setup is done, which must be cleared on the
      release of that fd.  For instance, for each open console a new instance
      (i.e.  new dev_id) of the same IRQ is requested().
      
      Exactly, a fd is stored in an array (pollfds), which is after read by a
      host thread and passed to poll().  Each event registered by poll() triggers
      an interrupt.  So, for each free_irq() we must remove the corresponding
      host fd from the table, which we do via this -release() method.
      
      In this patch we add an appropriate hook for this, and remove all uses of
      it by pointing the hook to the said procedure; this is safe to do since the
      said procedure.
      
      Also some cosmetic improvements are included.
      
      This is heavily based on some work by Chris Wedgwood, which however didn't
      get the patch merged for something I'd call a "misunderstanding" (the need
      for this patch wasn't cleanly explained, thus adding the generic hook was
      felt as undesirable).
      Signed-off-by: NPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      CC: Ingo Molnar <mingo@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      dbce706e
    • B
      [PATCH] mm: remove PG_highmem · cbe37d09
      Badari Pulavarty 提交于
      Remove PG_highmem, to save a page flag.  Use is_highmem() instead.  It'll
      generate a little more code, but we don't use PageHigheMem() in many places.
      Signed-off-by: NBadari Pulavarty <pbadari@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      cbe37d09
  14. 14 6月, 2005 2 次提交