diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1471,12 +1471,13 @@ static void cb_size_segment(vm_map_entry_t, void *); static int core_write(struct coredump_params *, const void *, size_t, off_t, enum uio_seg, size_t *); -static void each_dumpable_segment(struct thread *, segment_callback, void *); +static void each_dumpable_segment(struct thread *, segment_callback, void *, + int); static int __elfN(corehdr)(struct coredump_params *, int, void *, size_t, - struct note_info_list *, size_t); + struct note_info_list *, size_t, int); static void __elfN(prepare_notes)(struct thread *, struct note_info_list *, size_t *); -static void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t); +static void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t, int); static void __elfN(putnote)(struct note_info *, struct sbuf *); static size_t register_note(struct note_info_list *, int, outfunc_t, void *); static int sbuf_drain_core_output(void *, const char *, int); @@ -1669,7 +1670,7 @@ /* Size the program segments. */ seginfo.count = 0; seginfo.size = 0; - each_dumpable_segment(td, cb_size_segment, &seginfo); + each_dumpable_segment(td, cb_size_segment, &seginfo, flags); /* * Collect info about the core file header area. @@ -1722,7 +1723,7 @@ */ hdr = malloc(hdrsize, M_TEMP, M_WAITOK); error = __elfN(corehdr)(¶ms, seginfo.count, hdr, hdrsize, ¬elst, - notesz); + notesz, flags); /* Write the contents of all of the writable segments. */ if (error == 0) { @@ -1806,7 +1807,8 @@ * caller-supplied data. */ static void -each_dumpable_segment(struct thread *td, segment_callback func, void *closure) +each_dumpable_segment(struct thread *td, segment_callback func, void *closure, + int flags) { struct proc *p = td->td_proc; vm_map_t map = &p->p_vmspace->vm_map; @@ -1867,7 +1869,8 @@ */ static int __elfN(corehdr)(struct coredump_params *p, int numsegs, void *hdr, - size_t hdrsize, struct note_info_list *notelst, size_t notesz) + size_t hdrsize, struct note_info_list *notelst, size_t notesz, + int flags) { struct note_info *ninfo; struct sbuf *sb; @@ -1875,7 +1878,7 @@ /* Fill in the header. */ bzero(hdr, hdrsize); - __elfN(puthdr)(p->td, hdr, hdrsize, numsegs, notesz); + __elfN(puthdr)(p->td, hdr, hdrsize, numsegs, notesz, flags); sb = sbuf_new(NULL, NULL, CORE_BUF_SIZE, SBUF_FIXEDLEN); sbuf_set_drain(sb, sbuf_drain_core_output, p); @@ -1953,7 +1956,7 @@ static void __elfN(puthdr)(struct thread *td, void *hdr, size_t hdrsize, int numsegs, - size_t notesz) + size_t notesz, int flags) { Elf_Ehdr *ehdr; Elf_Phdr *phdr; @@ -2032,7 +2035,7 @@ /* All the writable segments from the program. */ phc.phdr = phdr; phc.offset = round_page(hdrsize + notesz); - each_dumpable_segment(td, cb_put_phdr, &phc); + each_dumpable_segment(td, cb_put_phdr, &phc, flags); } static size_t