13 Oct, 2012

2 commits

  • Pull third pile of kernel_execve() patches from Al Viro:
    "The last bits of infrastructure for kernel_thread() et.al., with
    alpha/arm/x86 use of those. Plus sanitizing the asm glue and
    do_notify_resume() on alpha, fixing the "disabled irq while running
    task_work stuff" breakage there.

    At that point the rest of kernel_thread/kernel_execve/sys_execve work
    can be done independently for different architectures. The only
    pending bits that do depend on having all architectures converted are
    restrictred to fs/* and kernel/* - that'll obviously have to wait for
    the next cycle.

    I thought we'd have to wait for all of them done before we start
    eliminating the longjump-style insanity in kernel_execve(), but it
    turned out there's a very simple way to do that without flagday-style
    changes."

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal:
    alpha: switch to saner kernel_execve() semantics
    arm: switch to saner kernel_execve() semantics
    x86, um: convert to saner kernel_execve() semantics
    infrastructure for saner ret_from_kernel_thread semantics
    make sure that kernel_thread() callbacks call do_exit() themselves
    make sure that we always have a return path from kernel_execve()
    ppc: eeh_event should just use kthread_run()
    don't bother with kernel_thread/kernel_execve for launching linuxrc
    alpha: get rid of switch_stack argument of do_work_pending()
    alpha: don't bother passing switch_stack separately from regs
    alpha: take SIGPENDING/NOTIFY_RESUME loop into signal.c
    alpha: simplify TIF_NEED_RESCHED handling

    Linus Torvalds
     
  • Signed-off-by: Al Viro

    Al Viro
     

10 Oct, 2012

1 commit


02 Nov, 2011

5 commits


25 May, 2011

1 commit

  • os_dump_core() emits SIGTERM to terminate all UML processes. Kernel
    threads have to exit on SIGTERM instead of calling last_ditch_exit().
    Multiple calls to last_ditch_exit() can cause a crash.

    Signed-off-by: Richard Weinberger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Richard Weinberger
     

09 Feb, 2008

1 commit

  • 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
     

06 Feb, 2008

1 commit

  • init_irq_signals doesn't need to be called from the context of a new process.
    It initializes handlers, which are useless in process context. With that call
    gone, init_irq_signals has only one caller, so it can be inlined into
    init_new_thread_signals.

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

    Jeff Dike
     

18 Dec, 2007

1 commit

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

    Stanislaw Gruszka
     

17 Oct, 2007

6 commits

  • Now that ITIMER_REAL is no longer used, there is no need for any use of
    SIGALRM whatsoever. This patch removes all mention of it.

    In addition, real_alarm_handler took a signal argument which is now always
    SIGVTALRM. So, that is gone.

    Signed-off-by: Jeff Dike
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • A number of files that were changed in the recent removal of tt mode
    are userspace files which call the os_* wrappers instead of calling
    libc directly. A few other files were affected by this, through

    This patch makes these call glibc directly.

    There are also style fixes in the affected areas.

    os_print_error has no remaining callers, so it is deleted.

    There is a interface change to os_set_exec_close, eliminating a
    parameter which was always the same. The callers are fixed as well.

    os_process_pc got its error path cleaned up.

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

    Jeff Dike
     
  • do_longjmp used to be needed when UML didn't have its own implementation of
    setjmp and longjmp. They came from libc, and couldn't be called directly from
    kernel code, as the libc jmp_buf couldn't be imported there. do_longjmp was a
    userspace function which served to provide longjmp access to kernel code.

    This is gone, and a number of void * pointers can now be jmp_buf *.

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

    Jeff Dike
     
  • Formatting changes in the files which have been changed in the course
    of folding foo_skas functions into their callers. These include:
    copyright updates
    header file trimming
    style fixes
    adding severity to printks

    These changes should be entirely non-functional.

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

    Jeff Dike
     
  • This patch makes a number of simplifications enabled by the removal of
    CHOOSE_MODE. There were lots of functions that looked like

    int foo(args){
    foo_skas(args);
    }

    The bodies of foo_skas are now folded into foo, and their declarations (and
    sometimes entire header files) are deleted.

    In addition, the union uml_pt_regs, which was a union between the tt and skas
    register formats, is now a struct, with the tt-mode arm of the union being
    removed.

    It turns out that usr2_handler was unused, so it is gone.

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

    Jeff Dike
     
  • This patchset throws out tt mode, which has been non-functional for a while.

    This is done in phases, interspersed with code cleanups on the affected files.

    The removal is done as follows:
    remove all code, config options, and files which depend on
    CONFIG_MODE_TT
    get rid of the CHOOSE_MODE macro, which decided whether to
    call tt-mode or skas-mode code, and replace invocations with their
    skas portions
    replace all now-trivial procedures with their skas equivalents

    There are now a bunch of now-redundant pieces of data structures, including
    mode-specific pieces of the thread structure, pt_regs, and mm_context. These
    are all replaced with their skas-specific contents.

    As part of the ongoing style compliance project, I made a style pass over all
    files that were changed. There are three such patches, one for each phase,
    covering the files affected by that phase but no later ones.

    I noticed that we weren't freeing the LDT state associated with a process when
    it exited, so that's fixed in one of the later patches.

    The last patch is a tidying patch which I've had for a while, but which caused
    inexplicable crashes under tt mode. Since that is no longer a problem, this
    can now go in.

    This patch:

    Start getting rid of tt mode support.

    This patch throws out CONFIG_MODE_TT and all config options, code, and files
    which depend on it.

    CONFIG_MODE_SKAS is gone and everything that depends on it is included
    unconditionally.

    The few changed lines are in re-written Kconfig help, lines which needed
    something skas-related removed from them, and a few more which weren't
    strictly deletions.

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

    Jeff Dike
     

25 Jul, 2007

1 commit

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

    Jeff Dike
     

10 May, 2007

1 commit


08 May, 2007

5 commits

  • This patch converts calls in the os layer to os_{read,write}_file to calls
    directly to libc read() and write() where it is clear that the I/O buffer is
    in the kernel.

    We can do that here instead of calling os_{read,write}_file_k since we are in
    libc code and can call libc directly.

    With the change in the calls, error handling needs to be changed to refer to
    errno directly rather than the return value of the call.

    CATCH_EINTR wrappers were also added where needed.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • This patch lays some groundwork for the next one, which converts calls to
    os_{read,write}_file into {read,write}, by doing some tidying in the affected
    areas.

    do_not_aio gets restructured to make the final result a bit cleaner.

    There are also whitespace and other formatting fixes, fixes in error messages,
    and a typo fix.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • userspace code used to have to call the kernelspace function page_size() in
    order to determine the value of the kernel's PAGE_SIZE. Since this is now
    available directly from kern_constants.h as UM_KERN_PAGE_SIZE, page_size() can
    be deleted and calls changed to use the constant.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • The build started finding calls from non-init to init functions. These are
    just cases of init functions not being properly marked, so this patch fixes
    that.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • user_util.h isn't needed any more, so delete it and remove all includes of it.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

08 Mar, 2007

1 commit


04 Nov, 2006

1 commit

  • In order to get the __NR_* constants, we need sys/syscall.h.
    linux/unistd.h works as well since it includes syscall.h, however syscall.h
    is more parsimonious. We were inconsistent in this, and this patch adds
    syscall.h includes where necessary and removes linux/unistd.h includes
    where they are not needed.

    asm/unistd.h also includes the __NR_* constants, but these are not the
    glibc-sanctioned ones, so this also removes one such inclusion.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

02 Oct, 2006

1 commit

  • User mode linux uses _syscallX() to call into the host kernel. The
    recommended way to do this is to use the syscall() function from libc.

    Signed-off-by: Arnd Bergmann
    Cc: Andi Kleen
    Cc: Paul Mackerras
    Cc: Benjamin Herrenschmidt
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Russell King
    Cc: Ian Molton
    Cc: Mikael Starvik
    Cc: David Howells
    Cc: Yoshinori Sato
    Cc: Hirokazu Takata
    Cc: Ralf Baechle
    Cc: Kyle McMartin
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Cc: Paul Mundt
    Cc: Kazumoto Kojima
    Cc: Richard Curnow
    Cc: William Lee Irwin III
    Cc: "David S. Miller"
    Cc: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Cc: Miles Bader
    Cc: Chris Zankel
    Cc: "Luck, Tony"
    Cc: Geert Uytterhoeven
    Cc: Roman Zippel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

26 Sep, 2006

2 commits

  • Have most signals go through an arch-provided handler which recovers the
    sigcontext and then calls a generic handler. This replaces the
    ARCH_GET_SIGCONTEXT macro, which was somewhat fragile. On x86_64, recovering
    %rdx (which holds the sigcontext pointer) must be the first thing that
    happens. sig_handler duly invokes that first, but there is no guarantee that
    I can see that instructions won't be reordered such that %rdx is used before
    that. Having the arch provide the handler seems much more robust.

    Some signals in some parts of UML require their own handlers - these places
    don't call set_handler any more. They call sigaction or signal themselves.

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

    Jeff Dike
     
  • This patch adds an implementation of setjmp and longjmp to UML, allowing
    access to the inside of a jmpbuf without needing the access macros formerly
    provided by libc.

    The implementation is stolen from klibc. I copy the relevant files into
    arch/um. I have another patch which avoids the copying, but requires klibc be
    in the tree.

    setjmp and longjmp users required some tweaking. Includes of were
    removed and includes of the UML longjmp.h were added where necessary. There
    are also replacements of siglongjmp with UML_LONGJMP which I somehow missed
    earlier.

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

    Jeff Dike
     

15 Jul, 2006

1 commit

  • The UML_SETJMP macro was requiring its users to pass in a argument which it
    could supply itself, since it wasn't used outside that invocation of the
    macro.

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

    Jeff Dike
     

11 Jul, 2006

1 commit


02 May, 2006

1 commit


20 Apr, 2006

2 commits

  • Clean up the jmpbuf code. Since softints, we no longer use sig_setjmp, so
    the UML_SIGSETJMP wrapper now has a misleading name. Also, I forgot to
    change the buffers from sigjmp_buf to jmp_buf.

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

    Jeff Dike
     
  • MADV_REMOVE fixes - change the test mapping to be MAP_SHARED instead of
    MAP_PRIVATE, as MADV_REMOVE on MAP_PRIVATE maps won't work. Also, use
    the kernel's definition of MADV_REMOVE instead of hardcoding it if there
    isn't a libc definition.

    Signed-off-by: Jeff Dike
    Cc: Hugh Dickins
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

01 Apr, 2006

1 commit

  • Changes since first version
    added check for MADV_REMOVE support on the host
    fixed error return botch
    shrunk sprintf array by one character

    This adds hotplug memory support to UML. The mconsole syntax is
    config mem=[+-]n[KMG]
    In other words, add or subtract some number of kilobytes, megabytes, or
    gigabytes.

    Unplugged pages are allocated and then madvise(MADV_TRUNCATE), which is a
    currently experimental madvise extension. These pages are tracked so they
    can be plugged back in later if the admin decides to give them back. The
    first page to be unplugged is used to keep track of about 4M of other
    pages. A list_head is the first thing on this page. The rest is filled
    with addresses of other unplugged pages. This first page is not madvised,
    obviously.

    When this page is filled, the next page is used in a similar way and linked
    onto a list with the first page. Etc. This whole process reverses when
    pages are plugged back in. When a tracking page no longer tracks any
    unplugged pages, then it is next in line for plugging, which is done by
    freeing pages back to the kernel.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

25 Feb, 2006

1 commit

  • To avoid conflicts, in kernel files errno is expanded to kernel_errno, to
    distinguish it from glibc errno. In this case, the code wants to use the libc
    errno but the kernel one is used; in the other usage, we return errno in place
    of -errno in case of an error.

    Signed-off-by: Paolo 'Blaisorblade' Giarrusso
    Acked-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paolo 'Blaisorblade' Giarrusso
     

19 Jan, 2006

1 commit

  • This patch implements soft interrupts. Interrupt enabling and disabling no
    longer map to sigprocmask. Rather, a flag is set indicating whether
    interrupts may be handled. If a signal comes in and interrupts are marked as
    OK, then it is handled normally. If interrupts are marked as off, then the
    signal handler simply returns after noting that a signal needs handling. When
    interrupts are enabled later on, this pending signals flag is checked, and the
    IRQ handlers are called at that point.

    The point of this is to reduce the cost of local_irq_save et al, since they
    are very much more common than the signals that they are enabling and
    disabling. Soft interrupts produce a speed-up of ~25% on a kernel build.

    Subtleties -

    UML uses sigsetjmp/siglongjmp to switch contexts. sigsetjmp has been
    wrapped in a save_flags-like macro which remembers the interrupt state at
    setjmp time, and restores it when it is longjmp-ed back to.

    The enable_signals function has to loop because the IRQ handler
    disables interrupts before returning. enable_signals has to return with
    signals enabled, and signals may come in between the disabling and the
    return to enable_signals. So, it loops for as long as there are pending
    signals, ensuring that signals are enabled when it finally returns, and
    that there are no pending signals that need to be dealt with.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

09 Jan, 2006

1 commit


22 Sep, 2005

1 commit