Skip to content
Permalink
Branch: trunk
Commits on Jul 11, 2019
Commits on Jul 10, 2019
  1. Improve/fix doc of PT_SETSTEP and PT_CLEARSTEP.

    mgorny committed Jul 10, 2019
    Reviewed by kamil.
  2. Fix typo: SIGRAP -> SIGTRAP

    mgorny committed Jul 10, 2019
Commits on Jun 30, 2019
  1. Add a test for verifying procinfo note inside coredumps.

    mgorny committed Jun 30, 2019
    Add a first test for triggering a core dump in the debugged process
    (via PT_DUMPCORE) and verifying it.  The test finds procinfo note
    and checks its contents.
    
    The core dump is processed through libelf.  However, it only provides
    for finding all note segments (or sections?).  I had to implement
    finding and processing individual notes myself.  I've added
    a core_find_note() function that will be reused in future tests.
    
    Reviewed by kamil.
Commits on Jun 26, 2019
  1. Implement PT_GETXSTATE and PT_SETXSTATE

    mgorny committed Jun 26, 2019
    Introduce two new ptrace() requests: PT_GETXSTATE and PT_SETXSTATE,
    that provide access to the extended (and extensible) set of FPU
    registers on amd64 and i386.  At the moment, this covers AVX (YMM)
    and AVX-512 (ZMM, opmask) registers.  It can be easily extended
    to cover further register types without breaking backwards
    compatibility.
    
    PT_GETXSTATE issues the XSAVE instruction with all kernel-supported
    extended components enabled.  The data is copied into 'struct xstate'
    (which -- unlike the XSAVE area itself -- has stable format
    and offsets).
    
    PT_SETXSTATE issues the XRSTOR instruction to restore the register
    values from user-provided 'struct xstate'.  The function replaces only
    the specific XSAVE components that are listed in 'xs_rfbm' field,
    making it possible to issue partial updates.
    
    Both syscalls take a 'struct iovec' pointer rather than a direct
    argument.  This requires the caller to explicitly specify the buffer
    size.  As a result, existing code will continue to work correctly
    when the structure is extended (performing partial reads/updates).
  2. Fetch XSAVE area component offsets and sizes when initializing x86 CPU

    mgorny committed Jun 26, 2019
    Introduce two new arrays, x86_xsave_offsets and x86_xsave_sizes,
    and initialize them with XSAVE area component offsets and sizes queried
    via CPUID.  This will be needed to implement getters and setters for
    additional register types.
    
    While at it, add XSAVE_* constants corresponding to specific XSAVE
    components.
Commits on Jun 4, 2019
  1. compat32: Implement PT_GETDBREGS and PT_SETDBREGS

    mgorny committed Jun 4, 2019
    Uncomment and improve the implementation of compat32 support for
    PT_GETDBREGS and PT_SETDBREGS requests.
    
    The new implementation uses x86_dbregs_read() and x86_dbregs_write()
    function instead of accessing pcb directly.  While this might be
    a little slower, it guarantees that the needed pcb field is allocated
    correctly.
    
    Furthermore, the code introduces necessary sanity checks
    for PT_SETDBREGS arguments.
  2. compat32: Translate userland PT_* request values into kernel codes

    mgorny committed Jun 4, 2019
    Currently, the compat32 passes PT_* request values to kernel functions
    without translation.  This works fine for low PT_* requests that happen
    to have the same values both on i386 and amd64.  However, for requests
    higher than PT_SETFPREGS, the value passed from userland (matching i386
    const) does not match the correct kernel (amd64) request.  As a result,
    e.g. when compat32 process calls PT_GETDBREGS, kernel actually processes
    it as PT_SETSTEP.
    
    To resolve this, introduce support for compat32 PT_* request
    translation.  The interface is based on PTRACE_TRANSLATE_REQUEST32 macro
    that is defined to a mapping function on architectures needing it.
    In case of amd64, this function maps userland i386 PT_* values into
    appropriate amd64 PT_* values.
    
    For the time being, the two additional PT_GETXMMREGS and PT_SETXMMREGS
    requests are unsupported due to lack of matching free amd64 constant.
Commits on May 10, 2019
  1. Remove obsolete size asserts.

    mgorny committed May 10, 2019
  2. Fill 'struct fpreg' & 'struct xmmregs' in

    mgorny committed May 10, 2019
    The 'struct fpreg' data type used by PT_GETFPREGS, and 'struct xmmregs'
    used by PT_GETXMMREGS are currently opaque.  Define them to contain
    correct data structs instead, the same way they are defined for amd64.
    For 'struct fpreg' this means 'struct save87', and for 'struct xmmregs'
    this means 'struct fxsave'.  This makes it more transparent for
    consumers how the data is formatted, and allows using it without need
    for explicit casts.
    
    Reviewed by <kamil>.
  3. Add tests for PT_SETREGS

    mgorny committed May 10, 2019
Commits on May 9, 2019
Commits on May 5, 2019
  1. Reintroduce i386 tests for general-purpose registers, without MMX req

    mgorny committed May 5, 2019
    Reintroduce the test for reading i386 general-purpose register values
    from the debugged program.  This time it's split into one test for the six
    registers not normally used by the compiler (eax..edx, esi, edi), and another
    for ebp, esp.  This leaves enough free registers for the latter to work
    without MMX.
  2. Add tests for reading pre-set general purpose register values via PT_…

    mgorny committed May 5, 2019
    …GETREGS.
    
    Add new tests verifying that PT_GETREGS provides correct register values
    from the underlying program.  The test uses inline assembly in the child program
    to set registers to well-known constants, then compares the results obtained
    via PT_GETREGS against them.
    
    Reviewed by kamil.
Commits on May 2, 2019
Commits on Feb 15, 2019
  1. Fix reporting EOF via kevent and add a test case

    mgorny committed Feb 15, 2019
    Fix the kernel pty driver to report closed slave via master's kevent
    EVFILT_READ.  This behavior matches the behavior for pipes, is
    consistent with how FreeBSD implements it and is relied upon by LLDB's
    main loop implementation.
    
    Includes feedback by kre and kamil (from tech-kern), commit approved
    by kamil.
Commits on Jan 29, 2019
  1. Move common UBSAN test case code into ubsan_common.subr

    mgorny committed Jan 29, 2019
    Reviewed by <kamil>
  2. Move common ASAN test case code into asan_common.subr

    mgorny committed Jan 29, 2019
    Reviewed by <kamil>
  3. Move common UBSAN test case code into ubsan_common.subr

    mgorny committed Jan 29, 2019
    Reviewed by <kamil>
  4. Move common ASAN test case code into asan_common.subr

    mgorny committed Jan 29, 2019
    Reviewed by <kamil>
You can’t perform that action at this time.