20 Sep, 2009

1 commit


01 Apr, 2009

1 commit


13 Mar, 2009

1 commit

  • Fix the following warning on x86_64:

    LD vmlinux.o
    MODPOST vmlinux.o
    WARNING: vmlinux: 'memcpy' exported twice. Previous export was in vmlinux

    For x86_64, this symbol is already exported from arch/um/sys-x86_64/ksyms.c.

    Reported-by: Boaz Harrosh
    Signed-off-by: WANG Cong
    Tested-by: Boaz Harrosh
    Cc: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    akpm@linux-foundation.org
     

05 Dec, 2008

1 commit


23 Oct, 2008

2 commits


17 Oct, 2008

1 commit


25 Jul, 2008

1 commit

  • - Make some variables and functions static, since they don't need to be
    global.

    - Remove an unused function - arch/um/kernel/time.c::sched_clock().

    - Clean the style a bit as complained by checkpatch.pl.

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

    WANG Cong
     

13 Jun, 2008

2 commits

  • Fedora broke PTRACE_SYSEMU again, and UML crashes as a result when it
    doesn't need to. This patch makes the PTRACE_SYSEMU check fail gracefully
    and makes UML fall back to PTRACE_SYSCALL.

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

    Jeff Dike
     
  • I allowed an include of asm/user.h to sneak back in. This patch replaces
    it with sys/user.h.

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

    Jeff Dike
     

07 Jun, 2008

4 commits

  • Include limits.h to get a definition of PATH_MAX.

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

    Ingo Molnar
     
  • We lost the marking of SIGWINCH as being OK to receive during stub
    execution, causing a panic should that happen.

    Cc: Benedict Verheyen
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • This patch makes os_get_task_size locate the bottom of the address space,
    as well as the top. This is for systems which put a lower limit on mmap
    addresses. It works by manually scanning pages from zero onwards until a
    valid page is found.

    Because the bottom of the address space may not be zero, it's not
    sufficient to assume the top of the address space is the size of the
    address space. The size is the difference between the top address and
    bottom address.

    [jdike@addtoit.com: changed the name to reflect that this function is
    supposed to return the top of the process address space, not its size and
    changed the return value to reflect that. Also some minor formatting
    changes]
    Signed-off-by: Tom Spink
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Spink
     
  • Protection against the host's time going backwards (eg, ntp activity on
    the host) by keeping track of the time at the last tick and if it's
    greater than the current time, keep time stopped until the host catches
    up.

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

    Jeff Dike
     

22 May, 2008

1 commit


13 May, 2008

6 commits

  • Alarm delivery could be noticably late in the !CONFIG_NOHZ case because lost
    ticks weren't being taken into account. This is now treated more carefully,
    with the time between ticks being calculated and the appropriate number of
    ticks delivered to the timekeeping system.

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

    Jeff Dike
     
  • The random driver would essentially hang if the host's /dev/random returned
    -EAGAIN. There was a test of need_resched followed by a schedule inside the
    loop, but that didn't help and it's the wrong way to work anyway.

    The right way is to ask for an interrupt when there is input available from
    the host and handle it then rather than polling.

    Now, when the host's /dev/random returns -EAGAIN, the driver asks for a wakeup
    when there's randomness available again and sleeps. The interrupt routine
    just wakes up whatever processes are sleeping on host_read_wait.

    There is an atomic_t, host_sleep_count, which counts the number of processes
    waiting for randomness. When this reaches zero, the interrupt is disabled.

    An added complication is that async I/O notification was only recently added
    to /dev/random (by me), so essentially all hosts will lack it. So, we use the
    sigio workaround here, which is to have a separate thread poll on the
    descriptor and send an interrupt when there is input on it. This mechanism is
    activated when a process gets -EAGAIN (activating this multiple times is
    harmless, if a bit wasteful) and deactivated by the last process still
    waiting.

    The module name was changed from "random" to "hw_random" in order for udev to
    recognize it.

    The sigio workaround needed some changes. sigio_broken was added for cases
    when we know that async notification doesn't work. This is now called from
    maybe_sigio_broken, which deals with pts devices.

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

    Jeff Dike
     
  • Reintroduce uml_kmalloc for the benefit of UML libc code. The
    previous tactic of declaring __kmalloc so it could be called directly
    from the libc side of the house turned out to be getting too intimate
    with slab, and it doesn't work with slob.

    So, the uml_kmalloc wrapper is back. It calls kmalloc or whatever
    that translates into, and libc code calls it.

    kfree is left alone since that still works, leaving a somewhat
    inconsistent API.

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

    Jeff Dike
     
  • Tidy the ptrace interface code. Removed a bunch of unused macros.
    Started converting register sets from arrays of longs to structures.

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

    Jeff Dike
     
  • A few random style fixes.

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

    Jeff Dike
     
  • Redo how host capabilities are recorded at startup and disabled on the
    command line.

    There are now explicit variables saying what's been disabled by the
    command line rather than the implicitness of the have_* variable being
    zero. The capability variables now start at zero and are set to one
    as their capabilities are found to be present on the host.

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

    Jeff Dike
     

28 Apr, 2008

2 commits


27 Apr, 2008

1 commit

  • fix:

    arch/um/os-Linux/helper.c: In function 'run_helper':
    arch/um/os-Linux/helper.c:73: error: 'PATH_MAX' undeclared (first use in this function)

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

24 Feb, 2008

1 commit

  • 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
     

09 Feb, 2008

3 commits

  • * 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
     

06 Feb, 2008

12 commits

  • Calling init_registers inside the skas3 checking causes mysterious crashes if
    it doesn't happen because the skas3 checking is bypassed. This patch moves it
    to os_early_checks.

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

    Jeff Dike
     
  • Some printks were missing newlines.

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

    Jeff Dike
     
  • The .a flags in openflags never had an implementation.

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

    Jeff Dike
     
  • 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
     
  • This patch tidies the signal handling code slightly.

    pending is renamed to signals_pending for symmetry with signals_enabled.

    remove_sigstack was unused, so can be deleted.

    The value of change_sig was never used, so it is now void and the
    return value is not calculated any more.

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

    Jeff Dike
     
  • sig_handler_common_skas needs significant modernization, starting with
    its name and storage class.

    There is no need to hide the true type of the sigcontext pointer, so
    the void * dummy parameter can be replaced with a sigcontext *sc.

    The array of uml_pt_regs structs used in the page fault case are gone,
    replaced by a local variable. This is also used in the non-segfault
    case instead of the copy in the task_struct. Since it's local, the
    special handling of the is_user flag can go away.

    There hasn't been any special treatment of SIGUSR1 in ages, so the
    line that enables it can be deleted.

    The special treatment of SIGSEGV similarly goes away, but to
    compensate, SA_NODEFER is added to sa_mask when registering a signal
    handler.

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

    Jeff Dike
     
  • This patch moves sig_handler_common_skas from
    arch/um/os-Linux/skas/trap.c to its only caller in
    arch/um/os-Linux/signal.c. trap.c is now empty, so it can be removed.

    This is code movement only - the significant cleanup needed here is
    done in the next patch.

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

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

    Jeff Dike
     
  • Style fixes to arch/um/os/helper.c and tidying up the breakpoint fix a
    bit.

    helper.c gets all the usual style fixes -
    updated copyright
    all printks get severities

    Also -
    errval changes to err in helper_child
    fixed an obsolete comment
    run_helper was killing a child process which is guaranteed to
    be dead or dying anyway

    Removed the nohang and pname arguments from helper_wait and fixed the
    declaration and callers. nohang was used only in the slirp driver and
    I don't think it was needed. I think pname was a bit of overkill in
    putting out an error message when something goes wrong.

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

    Jeff Dike
     
  • signals_enabled and pending have requirements on the order in which they are
    modified. This used to be done by declaring them volatile and putting an mb()
    where the ordering requirements were in effect.

    After getting a better (I hope) understanding of how to do this correctly, the
    volatile declarations are gone and the mb()'s replaced by barrier()'s.

    One of the mb()'s was deleted because I see no problematic writes that could
    be re-ordered past that point.

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

    Jeff Dike
     
  • It turns out that if there's a panic early enough, UML will just sit there in
    the LED-blinking loop because the panic notifier hadn't been installed yet.

    This patch installs it earlier.

    It also fixes the problem which exposed the hang, namely that if you give UML
    a zero-sized initrd, it will ask alloc_bootmem for zero bytes, and that will
    cause the panic.

    While I was in initrd.c, I gave it a style makeover.

    Prompted by checkpatch, I moved a couple extern declarations of uml_exitcode
    to kern_util.h.

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

    Jeff Dike
     
  • setjmp_wrapper existed to provide setjmp to kernel code when UML used libc's
    setjmp and longjmp. Now that UML has its own implementation, this isn't
    needed and kernel code can invoke setjmp directly.

    do_buffer_op is massively cleaned up since it is no longer a callback from
    setjmp_wrapper and given a va_list from which it must extract its arguments.

    The actual setjmp is moved from buffer_op to do_op_one_page because the copy
    operation is inside an atomic section (kmap_atomic to kunmap_atomic) and it
    shouldn't be longjmp-ed out of.

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

    Jeff Dike