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,
292 __get_dumpable(cprm->mm_flags));
297 cprm->siginfo->si_signo);
598 struct coredump_params cprm = {
616 if (!__get_dumpable(cprm.mm_flags))
628 if (__get_dumpable(cprm.mm_flags) == SUID_DUMP_ROOT) {
640 ispipe = format_corename(&cn, &cprm, &argv, &argc);
654 if (cprm.limit == 1) {
659 * cprm.limit of 1 here as a special value, this is a
676 cprm.limit = RLIM_INFINITY;
700 umh_pipe_setup, NULL, &cprm);
716 if (cprm.limit < binfmt->min_coredump)
763 cprm.file = file_open_root(&root, cn.corename,
767 cprm.file = filp_open(cn.corename, open_flags, 0600);
769 if (IS_ERR(cprm.file))
772 inode = file_inode(cprm.file);
775 if (d_unhashed(cprm.file->f_path.dentry))
793 if (!(cprm.file->f_mode & FMODE_CAN_WRITE))
795 if (do_truncate(cprm.file->f_path.dentry, 0, 0, cprm.file))
810 if (!cprm.file) {
814 if (!dump_vma_snapshot(&cprm))
817 file_start_write(cprm.file);
818 core_dumped = binfmt->core_dump(&cprm);
819 file_end_write(cprm.file);
820 free_vma_snapshot(&cprm);
823 wait_for_dump_helpers(cprm.file);
825 if (cprm.file)
826 filp_close(cprm.file, NULL);
846 int dump_emit(struct coredump_params *cprm, const void *addr, int nr)
848 struct file *file = cprm->file;
851 if (cprm->written + nr > cprm->limit)
861 cprm->written += n;
862 cprm->pos += n;
868 int dump_skip(struct coredump_params *cprm, size_t nr)
871 struct file *file = cprm->file;
876 cprm->pos += nr;
880 if (!dump_emit(cprm, zeroes, PAGE_SIZE))
884 return dump_emit(cprm, zeroes, nr);
890 int dump_user_range(struct coredump_params *cprm, unsigned long start,
910 stop = !dump_emit(cprm, kaddr, PAGE_SIZE);
914 stop = !dump_skip(cprm, PAGE_SIZE);
923 int dump_align(struct coredump_params *cprm, int align)
925 unsigned mod = cprm->pos & (align - 1);
928 return mod ? dump_skip(cprm, align - mod) : 1;
937 void dump_truncate(struct coredump_params *cprm)
939 struct file *file = cprm->file;
1092 static void free_vma_snapshot(struct coredump_params *cprm)
1094 if (cprm->vma_meta) {
1096 for (i = 0; i < cprm->vma_count; i++) {
1097 struct file *file = cprm->vma_meta[i].file;
1101 kvfree(cprm->vma_meta);
1102 cprm->vma_meta = NULL;
1110 static bool dump_vma_snapshot(struct coredump_params *cprm)
1124 cprm->vma_data_size = 0;
1126 cprm->vma_count = mm->map_count + (gate_vma ? 1 : 0);
1128 cprm->vma_meta = kvmalloc_array(cprm->vma_count, sizeof(*cprm->vma_meta), GFP_KERNEL);
1129 if (!cprm->vma_meta) {
1136 struct core_vma_metadata *m = cprm->vma_meta + i;
1141 m->dump_size = vma_dump_size(vma, cprm->mm_flags);
1151 for (i = 0; i < cprm->vma_count; i++) {
1152 struct core_vma_metadata *m = cprm->vma_meta + i;
1165 cprm->vma_data_size += m->dump_size;