lkml.org 
[lkml]   [2007]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH 4/11] i386 vDSO: use VM_ALWAYSDUMP
    On Sat, 13 Jan 2007 21:34:28 -0800 (PST)
    Roland McGrath <roland@redhat.com> wrote:

    > + vma = vma->vm_next ?: vma == gate_vma ? NULL : gate_vma) {

    Painful. Can we do this?


    diff -puN fs/binfmt_elf.c~i386-vdso-use-vm_alwaysdump-tidy fs/binfmt_elf.c
    --- a/fs/binfmt_elf.c~i386-vdso-use-vm_alwaysdump-tidy
    +++ a/fs/binfmt_elf.c
    @@ -1429,6 +1429,23 @@ static int elf_dump_thread_status(long s
    }

    /*
    + * Helper function for iterating across a vma list. It ensures that the caller
    + * will visit `gate_vma' prior to terminating the search.
    + */
    +static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma,
    + struct vm_area_struct *gate_vma)
    +{
    + struct vm_area_struct *ret;
    +
    + ret = this_vma->vm_next;
    + if (ret)
    + return ret;
    + if (this_vma == gate_vma)
    + return NULL;
    + return gate_vma;
    +}
    +
    +/*
    * Actual dumper
    *
    * This is a two-pass process; first we find the offsets of the bits,
    @@ -1600,8 +1617,7 @@ static int elf_core_dump(long signr, str
    dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE);

    /* Write program headers for segments dump */
    - for (vma = current->mm->mmap; vma != NULL;
    - vma = vma->vm_next ?: vma == gate_vma ? NULL : gate_vma) {
    + for (vma = current->mm->mmap; vma; vma = next_vma(vma, gate_vma)) {
    struct elf_phdr phdr;
    size_t sz;

    @@ -1650,8 +1666,7 @@ static int elf_core_dump(long signr, str
    /* Align to page */
    DUMP_SEEK(dataoff - foffset);

    - for (vma = current->mm->mmap; vma != NULL;
    - vma = vma->vm_next ?: vma == gate_vma ? NULL : gate_vma) {
    + for (vma = current->mm->mmap; vma; vma = next_vma(vma, gate_vma)) {
    unsigned long addr;

    if (!maydump(vma))
    _
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-01-23 21:45    [W:0.021 / U:1.136 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site