28 Apr, 2008

9 commits


27 Apr, 2008

5 commits


17 Apr, 2008

1 commit

  • Semaphores are no longer performance-critical, so a generic C
    implementation is better for maintainability, debuggability and
    extensibility. Thanks to Peter Zijlstra for fixing the lockdep
    warning. Thanks to Harvey Harrison for pointing out that the
    unlikely() was unnecessary.

    Signed-off-by: Matthew Wilcox
    Acked-by: Ingo Molnar

    Matthew Wilcox
     

26 Mar, 2008

1 commit

  • IFF_ALLMULTI is an indication from the network stack to the driver
    to disable multicast filters, drivers should never set it directly.

    Since the UML networking device doesn't have any filtering capabilites,
    it doesn't the set_multicast_list function at all, it is kept so userspace
    can still issue SIOCADDMULTI/SIOCDELMULTI ioctls however.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

25 Feb, 2008

1 commit


24 Feb, 2008

6 commits

  • Commit ee3d9bd4de1ed93d2a7ee41c331ed30a1c7b8acd ("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: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • In commit 1aa351a308d2c3ddb92b6cc45083fc54271d0010 ("uml: tidy helper
    code") the arguments of helper_wait() were changed. The adaptation of
    harddog_user.c was forgotten, so this errors occur:

    /arch/um/drivers/harddog_user.c: In function 'start_watchdog':
    /arch/um/drivers/harddog_user.c:82: error: too many arguments to function 'helper_wait'
    /arch/um/drivers/harddog_user.c:89: error: too many arguments to function 'helper_wait'

    Signed-off-by: Johann Felix Soden
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Johann Felix Soden
     
  • The macros which extract registers from a struct sigcontext are no longer
    needed and can be removed. They are starting not to build anyway, given the
    removal of the 'e' and 'r' from register names during the x86 merge.

    Cc: Jiri Olsa
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Fix a shadowed variable in arch/um/kernel/mem.c, since there is a global
    variable has the same name.

    Cc: Jeff Dike
    Signed-off-by: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    WANG Cong
     
  • Update defconfig.

    Cc: Christoph Hellwig
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • If the initrd file has zero-length, the error message should contain
    the filepath.

    Cc: WANG Cong
    Signed-off-by: Johann Felix Soden
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Johann Felix Soden
     

15 Feb, 2008

1 commit

  • This is the central patch of a cleanup series. In most cases there is no good
    reason why someone would want to use a dentry for itself. This series reflects
    that fact and embeds a struct path into nameidata.

    Together with the other patches of this series
    - it enforced the correct order of getting/releasing the reference count on
    pairs
    - it prepares the VFS for stacking support since it is essential to have a
    struct path in every place where the stack can be traversed
    - it reduces the overall code size:

    without patch series:
    text data bss dec hex filename
    5321639 858418 715768 6895825 6938d1 vmlinux

    with patch series:
    text data bss dec hex filename
    5320026 858418 715768 6894212 693284 vmlinux

    This patch:

    Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.

    [akpm@linux-foundation.org: coding-style fixes]
    [akpm@linux-foundation.org: fix cifs]
    [akpm@linux-foundation.org: fix smack]
    Signed-off-by: Jan Blunck
    Signed-off-by: Andreas Gruenbacher
    Acked-by: Christoph Hellwig
    Cc: Al Viro
    Cc: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Blunck
     

09 Feb, 2008

8 commits

  • [ Spotted by Miklos ]

    Fix a memory leak in init_new_context. The struct page ** buffer allocated
    for install_special_mapping was never recorded, and thus leaked when the
    mm_struct was freed. Fix it by saving the pointer in mm_context_t and freeing
    it in arch_exit_mmap.

    Signed-off-by: Jeff Dike
    Cc: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • * arch/um/os-Linux/mem.c (make_tempfile): Don't deref NULL upon failed malloc.

    * arch/um/os-Linux/mem.c (make_tempfile): Handle NULL tempdir.
    Don't let a long tempdir (e.g., via TMPDIR) provoke heap corruption.

    [ jdike - formatting cleanups, deleted obsolete comment ]

    Signed-off-by: Jim Meyering
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jim Meyering
     
  • 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: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Calculate TASK_SIZE at run-time by figuring out the host's VMSPLIT - this is
    needed on i386 if UML is to run on hosts with varying VMSPLITs without
    recompilation.

    TASK_SIZE is now defined in terms of a variable, task_size. This gets rid of
    an include of pgtable.h from processor.h, which can cause include loops.

    On i386, task_size is calculated early in boot by probing the address space in
    a binary search to figure out where the boundary between usable and non-usable
    memory is. This tries to make sure that a page that is considered to be in
    userspace is, or can be made, read-write. I'm concerned about a system-global
    VDSO page in kernel memory being hit and considered to be a userspace page.

    On x86_64, task_size is just the old value of CONFIG_TOP_ADDR.

    A bunch of config variable are gone now. CONFIG_TOP_ADDR is directly replaced
    by TASK_SIZE. NEST_LEVEL is gone since the relocation of the stubs makes it
    irrelevant. All the HOST_VMSPLIT stuff is gone. All references to these in
    arch/um/Makefile are also gone.

    I noticed and fixed a missing extern in os.h when adding os_get_task_size.

    Note: This has been revised to fix the 32-bit UML on 64-bit host bug that
    Miklos ran into.

    Signed-off-by: Jeff Dike
    Cc: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Background: I've implemented 1K/2K page tables for s390. These sub-page
    page tables are required to properly support the s390 virtualization
    instruction with KVM. The SIE instruction requires that the page tables
    have 256 page table entries (pte) followed by 256 page status table entries
    (pgste). The pgstes are only required if the process is using the SIE
    instruction. The pgstes are updated by the hardware and by the hypervisor
    for a number of reasons, one of them is dirty and reference bit tracking.
    To avoid wasting memory the standard pte table allocation should return
    1K/2K (31/64 bit) and 2K/4K if the process is using SIE.

    Problem: Page size on s390 is 4K, page table size is 1K or 2K. That means
    the s390 version for pte_alloc_one cannot return a pointer to a struct
    page. Trouble is that with the CONFIG_HIGHPTE feature on x86 pte_alloc_one
    cannot return a pointer to a pte either, since that would require more than
    32 bit for the return value of pte_alloc_one (and the pte * would not be
    accessible since its not kmapped).

    Solution: The only solution I found to this dilemma is a new typedef: a
    pgtable_t. For s390 pgtable_t will be a (pte *) - to be introduced with a
    later patch. For everybody else it will be a (struct page *). The
    additional problem with the initialization of the ptl lock and the
    NR_PAGETABLE accounting is solved with a constructor pgtable_page_ctor and
    a destructor pgtable_page_dtor. The page table allocation and free
    functions need to call these two whenever a page table page is allocated or
    freed. pmd_populate will get a pgtable_t instead of a struct page pointer.
    To get the pgtable_t back from a pmd entry that has been installed with
    pmd_populate a new function pmd_pgtable is added. It replaces the pmd_page
    call in free_pte_range and apply_to_pte_range.

    Signed-off-by: Martin Schwidefsky
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Martin Schwidefsky
     
  • Remove now unnecessary inclusions of {asm,linux}/a.out.h.

    [akpm@linux-foundation.org: fix alpha build]
    Signed-off-by: David Howells
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Suppress A.OUT library support if CONFIG_ARCH_SUPPORTS_AOUT is not set.

    Not all architectures support the A.OUT binfmt, so the ELF binfmt should not
    be permitted to go looking for A.OUT libraries to load in such a case. Not
    only that, but under such conditions A.OUT core dumps are not produced either.

    To make this work, this patch also does the following:

    (1) Makes the existence of the contents of linux/a.out.h contingent on
    CONFIG_ARCH_SUPPORTS_AOUT.

    (2) Renames dump_thread() to aout_dump_thread() as it's only called by A.OUT
    core dumping code.

    (3) Moves aout_dump_thread() into asm/a.out-core.h and makes it inline. This
    is then included only where needed. This means that this bit of arch
    code will be stored in the appropriate A.OUT binfmt module rather than
    the core kernel.

    (4) Drops A.OUT support for Blackfin (according to Mike Frysinger it's not
    needed) and FRV.

    This patch depends on the previous patch to move STACK_TOP[_MAX] out of
    asm/a.out.h and into asm/processor.h as they're required whether or not A.OUT
    format is available.

    [jdike@addtoit.com: uml: re-remove accidentally restored code]
    Signed-off-by: David Howells
    Cc:
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Mark arches that support A.OUT format by including the following in their
    master Kconfig files:

    config ARCH_SUPPORTS_AOUT
    def_bool y

    This should also be set if the arch provides compatibility A.OUT support for
    an older arch, for instance x86_64 for i386 or sparc64 for sparc.

    I've guessed at which arches don't, based on comments in the code, however I'm
    sure that some of the ones I've marked as 'yes' actually should be 'no'.

    Signed-off-by: David Howells
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     

06 Feb, 2008

8 commits

  • Also fixed the include syntax while I was there.

    Signed-off-by: Jeff Dike
    Cc: Pavel Emelyanov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Redo the calculation of NR_syscalls since that disappeared from i386 and
    use a similar mechanism on x86_64.

    We now figure out the size of the system call table in arch code and stick
    that in syscall_table_size. arch/um/kernel/skas/syscall.c defines
    NR_syscalls in terms of that since its the only thing that needs to know
    how many system calls there are.

    The old mechananism that was used on x86_64 is gone.

    arch/um/include/sysdep-i386/syscalls.h got some formatting since I was
    looking at it.

    Signed-off-by: Jeff Dike
    Cc: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Tweak the UML defconfig -
    we probably don't need 256 old-style ptys - this slows down udev
    noticably
    enable hostfs
    disable slab debugging - another noticable performance hit

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • The port_sem is already used as a mutex since it's using DECLARE_MUTEX(), but
    the underlying construct is still a semaphore .. This patch switches it over
    to a struct mutex.

    Signed-off-by: Daniel Walker
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Daniel Walker
     
  • The plug_mem_mutex is already used as a mutex since it's using
    DECLARE_MUTEX(), but the underlying construct is still a semaphore .. This
    patch switches it over to a struct mutex.

    Signed-off-by: Daniel Walker
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Daniel Walker
     
  • The ldt.semaphore conforms to the new struct mutex requirments, so I converted
    it to use the new API and changed the name.

    Signed-off-by: Daniel Walker
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Daniel Walker
     
  • Downgrade one of the MAC validity checks. If it's one that could be possibly
    assigned to a physical NIC, then nothing will break. So, emit a warning in
    this case, but keep the requested MAC.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • This patch takes care of a problem with the stopping code.

    The function inside the while condition returns 0 to signify a problem. A
    problem could be for example a bad command or a bad version of the mconsole
    client. A bad command would terminate the stopping loop and resume the
    kernel. This is a problem.

    A better solution is to make the loop infinite and don't leave it until we are
    explicitly told to.

    Signed-off-by: Karol Swietlicki
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Karol Swietlicki