On Mon, Jan 31, 2022 at 7:46 PM Eric W. Biederman <ebiederm@xxxxxxxxxxxx> wrote: > Move the call of dump_vma_snapshot and kvfree(vma_meta) out of the > individual coredump routines into do_coredump itself. This makes > the code less error prone and easier to maintain. > > Make the vma snapshot available to the coredump routines > in struct coredump_params. This makes it easier to > change and update what is captures in the vma snapshot > and will be needed for fixing fill_file_notes. > > Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> Reviewed-by: Jann Horn <jannh@xxxxxxxxxx> > for (i = 0, vma = first_vma(current, gate_vma); vma != NULL; > vma = next_vma(vma, gate_vma), i++) { > - struct core_vma_metadata *m = (*vma_meta) + i; > + struct core_vma_metadata *m = cprm->vma_meta + i; > > m->start = vma->vm_start; > m->end = vma->vm_end; > m->flags = vma->vm_flags; > m->dump_size = vma_dump_size(vma, cprm->mm_flags); > > - vma_data_size += m->dump_size; > + cprm->vma_data_size += m->dump_size; FYI, this part is probably going to cause a merge conflict with the fix https://www.ozlabs.org/~akpm/mmotm/broken-out/coredump-also-dump-first-pages-of-non-executable-elf-libraries.patch in akpm's tree. I don't know what the right way to handle that is, just thought I'd point it out.