• Home
  • Raw
  • Download

Lines Matching refs:cprm

56 static bool dump_vma_snapshot(struct coredump_params *cprm);
57 static void free_vma_snapshot(struct coredump_params *cprm);
200 static int format_corename(struct core_name *cn, struct coredump_params *cprm, in format_corename() argument
292 __get_dumpable(cprm->mm_flags)); in format_corename()
297 cprm->siginfo->si_signo); in format_corename()
597 struct coredump_params cprm = { in do_coredump() local
615 if (!__get_dumpable(cprm.mm_flags)) in do_coredump()
627 if (__get_dumpable(cprm.mm_flags) == SUID_DUMP_ROOT) { in do_coredump()
639 ispipe = format_corename(&cn, &cprm, &argv, &argc); in do_coredump()
653 if (cprm.limit == 1) { in do_coredump()
675 cprm.limit = RLIM_INFINITY; in do_coredump()
699 umh_pipe_setup, NULL, &cprm); in do_coredump()
716 if (cprm.limit < binfmt->min_coredump) in do_coredump()
763 cprm.file = file_open_root(&root, cn.corename, in do_coredump()
767 cprm.file = filp_open(cn.corename, open_flags, 0600); in do_coredump()
769 if (IS_ERR(cprm.file)) in do_coredump()
772 inode = file_inode(cprm.file); in do_coredump()
775 if (d_unhashed(cprm.file->f_path.dentry)) in do_coredump()
789 mnt_userns = file_mnt_user_ns(cprm.file); in do_coredump()
801 if (!(cprm.file->f_mode & FMODE_CAN_WRITE)) in do_coredump()
803 if (do_truncate(mnt_userns, cprm.file->f_path.dentry, in do_coredump()
804 0, 0, cprm.file)) in do_coredump()
818 if (!cprm.file) { in do_coredump()
822 if (!dump_vma_snapshot(&cprm)) in do_coredump()
825 file_start_write(cprm.file); in do_coredump()
826 core_dumped = binfmt->core_dump(&cprm); in do_coredump()
833 if (cprm.to_skip) { in do_coredump()
834 cprm.to_skip--; in do_coredump()
835 dump_emit(&cprm, "", 1); in do_coredump()
837 file_end_write(cprm.file); in do_coredump()
838 free_vma_snapshot(&cprm); in do_coredump()
841 wait_for_dump_helpers(cprm.file); in do_coredump()
843 if (cprm.file) in do_coredump()
844 filp_close(cprm.file, NULL); in do_coredump()
864 static int __dump_emit(struct coredump_params *cprm, const void *addr, int nr) in __dump_emit() argument
866 struct file *file = cprm->file; in __dump_emit()
869 if (cprm->written + nr > cprm->limit) in __dump_emit()
879 cprm->written += n; in __dump_emit()
880 cprm->pos += n; in __dump_emit()
885 static int __dump_skip(struct coredump_params *cprm, size_t nr) in __dump_skip() argument
888 struct file *file = cprm->file; in __dump_skip()
893 cprm->pos += nr; in __dump_skip()
897 if (!__dump_emit(cprm, zeroes, PAGE_SIZE)) in __dump_skip()
901 return __dump_emit(cprm, zeroes, nr); in __dump_skip()
905 int dump_emit(struct coredump_params *cprm, const void *addr, int nr) in dump_emit() argument
907 if (cprm->to_skip) { in dump_emit()
908 if (!__dump_skip(cprm, cprm->to_skip)) in dump_emit()
910 cprm->to_skip = 0; in dump_emit()
912 return __dump_emit(cprm, addr, nr); in dump_emit()
916 void dump_skip_to(struct coredump_params *cprm, unsigned long pos) in dump_skip_to() argument
918 cprm->to_skip = pos - cprm->pos; in dump_skip_to()
922 void dump_skip(struct coredump_params *cprm, size_t nr) in dump_skip() argument
924 cprm->to_skip += nr; in dump_skip()
929 int dump_user_range(struct coredump_params *cprm, unsigned long start, in dump_user_range() argument
949 stop = !dump_emit(cprm, kaddr, PAGE_SIZE); in dump_user_range()
955 dump_skip(cprm, PAGE_SIZE); in dump_user_range()
962 int dump_align(struct coredump_params *cprm, int align) in dump_align() argument
964 unsigned mod = (cprm->pos + cprm->to_skip) & (align - 1); in dump_align()
968 cprm->to_skip += align - mod; in dump_align()
1115 static void free_vma_snapshot(struct coredump_params *cprm) in free_vma_snapshot() argument
1117 if (cprm->vma_meta) { in free_vma_snapshot()
1119 for (i = 0; i < cprm->vma_count; i++) { in free_vma_snapshot()
1120 struct file *file = cprm->vma_meta[i].file; in free_vma_snapshot()
1124 kvfree(cprm->vma_meta); in free_vma_snapshot()
1125 cprm->vma_meta = NULL; in free_vma_snapshot()
1133 static bool dump_vma_snapshot(struct coredump_params *cprm) in dump_vma_snapshot() argument
1147 cprm->vma_data_size = 0; in dump_vma_snapshot()
1149 cprm->vma_count = mm->map_count + (gate_vma ? 1 : 0); in dump_vma_snapshot()
1151 cprm->vma_meta = kvmalloc_array(cprm->vma_count, sizeof(*cprm->vma_meta), GFP_KERNEL); in dump_vma_snapshot()
1152 if (!cprm->vma_meta) { in dump_vma_snapshot()
1159 struct core_vma_metadata *m = cprm->vma_meta + i; in dump_vma_snapshot()
1164 m->dump_size = vma_dump_size(vma, cprm->mm_flags); in dump_vma_snapshot()
1174 for (i = 0; i < cprm->vma_count; i++) { in dump_vma_snapshot()
1175 struct core_vma_metadata *m = cprm->vma_meta + i; in dump_vma_snapshot()
1188 cprm->vma_data_size += m->dump_size; in dump_vma_snapshot()