Date: Mon, 10 May 2021 01:14:46 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 69130fd57abb - stable/13 - imgact_elf: consistently pass flags from coredump down to helper functions Message-ID: <202105100114.14A1EkUb028580@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=69130fd57abb744154bfac64dcb8a7986b016f10 commit 69130fd57abb744154bfac64dcb8a7986b016f10 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-04-24 11:42:56 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-05-10 01:02:10 +0000 imgact_elf: consistently pass flags from coredump down to helper functions (cherry picked from commit 5bc3c61780d775810eea852936671ca4a232b2a8) --- sys/kern/imgact_elf.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index c4aedbe6bbfa..77045842a13c 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1471,12 +1471,13 @@ static void cb_put_phdr(vm_map_entry_t, void *); 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 @@ __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags) /* 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 @@ __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags) */ 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 @@ cb_size_segment(vm_map_entry_t entry, void *closure) * 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 @@ each_dumpable_segment(struct thread *td, segment_callback func, void *closure) */ 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 @@ __elfN(corehdr)(struct coredump_params *p, int numsegs, void *hdr, /* 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 @@ __elfN(prepare_notes)(struct thread *td, struct note_info_list *list, 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 @@ __elfN(puthdr)(struct thread *td, void *hdr, size_t hdrsize, int numsegs, /* 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105100114.14A1EkUb028580>