17 Jun, 2009

2 commits

  • `ELF_CORE_COPY_REGS(x, y)' will make expansions like:
    `(y)[0] = (x)->x.gp[0]' but correct is `(y)[0] = (x)->regs.gp[0]'

    Signed-off-by: Roel Kluin
    Cc: WANG Cong
    Cc: Jeff Dike

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

    Roel Kluin
     
  • When compiling uml on x86_64:

    MODPOST vmlinux.o
    WARNING: vmlinux.o (.__syscall_stub.2): unexpected non-allocatable section.
    Did you forget to use "ax"/"aw" in a .S file?
    Note that for example contains
    section definitions for use in .S files.

    Because modpost checks for missing SHF_ALLOC section flag. So just add
    it.

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

    Amerigo Wang
     

12 Jun, 2009

1 commit


01 Apr, 2009

1 commit


23 Oct, 2008

5 commits


15 Aug, 2008

1 commit


07 Jun, 2008

1 commit


22 May, 2008

1 commit


13 May, 2008

1 commit

  • 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
     

27 Apr, 2008

1 commit


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
     

24 Feb, 2008

1 commit

  • 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
     

06 Feb, 2008

8 commits

  • 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
     
  • Style fixes in arch/um/sys-x86_64:
    updated copyrights
    CodingStyle fixes
    added severities to printks which needed them

    A bunch of functions in sys-*/ptrace_user.c turn out to be unused, so they and
    their declarations are gone.

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

    Jeff Dike
     
  • UML was panicing in the case of failures of libc calls which shouldn't happen.
    This is an overreaction since a failure from libc doesn't normally mean that
    kernel data structures are in an unknown state. Instead, the current process
    should just be killed if there is no way to recover.

    The case that prompted this was a failure of PTRACE_SETREGS restoring the same
    state that was read by PTRACE_GETREGS. It appears that when a process tries
    to load a bogus value into a segment register, it segfaults (as expected) and
    the value is actually loaded and is seen by PTRACE_GETREGS (not expected).

    This case is fixed by forcing a fatal SIGSEGV on the process so that it
    immediately dies. fatal_sigsegv was added for this purpose. It was declared
    as noreturn, so in order to pursuade gcc that it actually does not return, I
    added a call to os_dump_core (and declared it noreturn) so that I get a core
    file if somehow the process survives.

    All other calls in arch/um/os-Linux/skas/process.c got the same treatment,
    with failures causing the process to die instead of a kernel panic, with some
    exceptions.

    userspace_tramp exits with status 1 if anything goes wrong there. That will
    cause start_userspace to return an error. copy_context_skas0 and
    map_stub_pages also now return errors instead of panicing. Callers of thes
    functions were changed to check for errors and do something appropriate.
    Usually that's to return an error to their callers.
    check_skas3_ptrace_faultinfo just exits since that's too early to do anything
    else.

    save_registers, restore_registers, and init_registers now return status
    instead of panicing on failure, with their callers doing something
    appropriate.

    There were also duplicate declarations of save_registers and restore_registers
    in os.h - these are gone.

    I noticed and fixed up some whitespace damage.

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

    Jeff Dike
     
  • Simplify the page fault stub by not masking signals while it is running. This
    allows it to signal that it is done by executing an instruction which will
    generate a SIGTRAP (int3 on x86) rather than running sigreturn by hand after
    queueing a blocked SIGUSR1.

    userspace_tramp now no longer puts anything in the SIGSEGV sa_mask, but it
    does add SA_NODEFER to sa_flags so that SIGSEGV is still enabled after the
    signal handler fails to run sigreturn.

    SIGWINCH is just blocked so that we don't have to deal with it and the signal
    masks used by wait_stub_done are updated to reflect the smaller number of
    signals that it has to worry about.

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

    Jeff Dike
     
  • Tidy current-related stuff. There was a comment in current.h saying
    that current_thread was obsolete, so this patch turns all instances of
    current_thread into current_thread_info(). There's some simplifying
    of the result in arch/um/sys-i386/signal.c.

    current.h and thread_info also get style cleanups.

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

    Jeff Dike
     
  • This patch removes a variable which was not used in two functions. Yet
    another code cleanup, nothing really significant.

    Please note that I could not test this on x86_64. I don't have the
    hardware for it.

    [ jdike - Bits of tidying around the affected code. Also, it's fine on
    x86_64 ]

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

    Karol Swietlicki
     
  • Suggested by Geert Uytterhoeven - use const.h to get constants that are usable
    in both C and assembly. I can't include it directly since this code can't
    include kernel headers. const.h is also for numeric constants that can be
    typed by tacking a "UL" or similar on the end. The constants here have to be
    typed by casting them.

    So, the relevant parts of const.h are copied here and modified in order to
    allow the constants to be uncasted in assembly and casted in C.

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

    Jeff Dike
     
  • bugs.c, for both i386 and x86_64, can undergo further cleaning -
    The i386 arch_check_bugs only does one thing, so we might as
    well inline the cmov checking.
    The i386 includes can be trimmed down a bit.
    arch_init_thread wasn't used, so it is deleted.
    The panics in arch_handle_signal are turned into printks
    because the process is about to get segfaulted anyway, so something is
    dying no matter what happens here. Also, the return value was always
    the same, so it contained no information, so it can be void instead.
    The name is changed to arch_examine_signal because it doesn't handle
    anything.
    The caller of arch_handle_signal, relay_signal, does things in
    a different order. The kernel-mode signal check is now first, which
    puts everything else together, making things a bit clearer conceptually.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

03 Feb, 2008

1 commit


30 Jan, 2008

1 commit

  • git-x86, in commit 70aa1bd3839e3ec74ce65316528a82570e8de666, changed
    a lot of the sigcontext field names. This patch changes UML usage to
    match.

    I also changed includes of generic headers from "" to <>.

    Signed-off-by: Jeff Dike
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Jeff Dike
     

29 Oct, 2007

1 commit


20 Oct, 2007

2 commits

  • Spelling fixes in arch/um/.

    Signed-off-by: Simon Arlott
    Acked-by: Jeff Dike
    Signed-off-by: Adrian Bunk

    Simon Arlott
     
  • One of the easiest things to isolate is the pid printed in kernel log.
    There was a patch, that made this for arch-independent code, this one makes
    so for arch/xxx files.

    It took some time to cross-compile it, but hopefully these are all the
    printks in arch code.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Pavel Emelyanov
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

17 Oct, 2007

11 commits

  • The calculation of CONFIG_STUB_CODE and CONFIG_STUB_DATA didn't take into
    account anything but 3G/1G and 2G/2G, leaving the other vmsplits out in the
    cold.

    I'd rather not duplicate the four known host vmsplit cases for each of these
    symbols. I'd also like to calculate them based on the highest userspace
    address.

    The Kconfig language seems not to allow calculation of hex constants, so I
    moved this to as-layout.h. CONFIG_STUB_CODE, CONFIG_STUB_DATA, and
    CONFIG_STUB_START are now gone. In their place are STUB_CODE, STUB_DATA, and
    STUB_START in as-layout.h.

    i386 and x86_64 seem to differ as to whether an unadorned constant is an int
    or a long, so I cast them to unsigned long so they can be printed
    consistently. However, they are also used in stub.S, where C types don't work
    so well. So, there are ASM_ versions of these constants for use in stub.S. I
    also ifdef-ed the non-asm-friendly portion of as-layout.h.

    With this in place, most of the rest of this patch is changing CONFIG_STUB_*
    to STUB_*, except in stub.S, where they are changed to ASM_STUB_*.

    defconfig has the old symbols deleted.

    I also print these addresses out in case there is any problem mapping them on
    the host.

    The two stub.S files had some trailing whitespace, so that is cleaned up here.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Tidy the code affected by the floating point fixes.

    A bunch of unused stuff is gone, including two sigcontext.c files,
    which turned out to be entirely unneeded.

    There are the usual fixes -
    whitespace and style cleanups
    copyright updates
    emacs formatting comments gone
    include cleanups
    adding severities to printks

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

    Jeff Dike
     
  • Handle floating point state better in ptrace. The code now correctly
    distinguishes between PTRACE_[GS]ETFPREGS and PTRACE_[GS]ETFPXREGS. The FPX
    requests get handed off to arch-specific code because that's not generic.

    get_fpregs, set_fpregs, set_fpregs, and set_fpxregs needed real
    implementations.

    Something here exposed a missing include in asm/page.h, which needed
    linux/types.h in order to get gfp_t, so that's fixed here.

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

    Jeff Dike
     
  • Handle floating point state in across signals correctly. UML/i386 needs to
    know whether the host does PTRACE_[GS]ETFPXREGS, so an arch_init_registers
    hook is added, which on x86_64 does nothing.

    UML doesn't save and restore floating point registers on kernel entry and
    exit, so they need to be copied between the host process and the sigcontext.
    save_fpx_registers and restore_fpx_registers are added for this purpose.
    save_fp_registers and restore_fp_registers already exist.

    There was a bunch of floating point state conversion code in
    arch/um/sys-i386/ptrace.c which isn't needed there, but is needed in signal.c,
    so it is moved over.

    The i386 code now distinguishes between fp and fpx state and handles them
    correctly. The x86_64 code just needs to copy state as-is between the host
    process and the stack. There are also some fixes there to pass the correct
    address of the floating point state around.

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

    Jeff Dike
     
  • Stop including asm/user.h from libc - it seems to be disappearing from
    distros. It's replaced with sys/user.h which defines user_fpregs_struct and
    user_fpxregs_struct instead of user_i387_struct and struct user_fxsr_struct on
    i386.

    As a bonus, on x86_64, I get to dump some stupid typedefs which were needed in
    order to get asm/user.h to compile.

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

    Jeff Dike
     
  • Before the removal of tt mode, access to a register on the skas-mode side of a
    pt_regs struct looked like pt_regs.regs.skas.regs.regs[FOO]. This was bad
    enough, but it became pt_regs.regs.regs.regs[FOO] with the removal of the
    union from the middle. To get rid of the run of three "regs", the last field
    is renamed to "gp".

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

    Jeff Dike
     
  • This patch folds mmu_context_skas into struct mm_context, changing all users
    of these structures as needed.

    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
     
  • The next stage after removing code which depends on CONFIG_MODE_TT is removing
    the CHOOSE_MODE abstraction, which provided both compile-time and run-time
    branching to either tt-mode or skas-mode code.

    This patch removes choose-mode.h and all inclusions of it, and replaces all
    CHOOSE_MODE invocations with the skas branch. This leaves a number of trivial
    functions which will be dealt with in a later patch.

    There are some changes in the uaccess and tls support which go somewhat beyond
    this and eliminate some of the now-redundant functions.

    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