Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_COREDUMP_H
0003 #define _LINUX_COREDUMP_H
0004 
0005 #include <linux/types.h>
0006 #include <linux/mm.h>
0007 #include <linux/fs.h>
0008 #include <asm/siginfo.h>
0009 
0010 #ifdef CONFIG_COREDUMP
0011 struct core_vma_metadata {
0012     unsigned long start, end;
0013     unsigned long flags;
0014     unsigned long dump_size;
0015     unsigned long pgoff;
0016     struct file   *file;
0017 };
0018 
0019 struct coredump_params {
0020     const kernel_siginfo_t *siginfo;
0021     struct pt_regs *regs;
0022     struct file *file;
0023     unsigned long limit;
0024     unsigned long mm_flags;
0025     loff_t written;
0026     loff_t pos;
0027     loff_t to_skip;
0028     int vma_count;
0029     size_t vma_data_size;
0030     struct core_vma_metadata *vma_meta;
0031 };
0032 
0033 /*
0034  * These are the only things you should do on a core-file: use only these
0035  * functions to write out all the necessary info.
0036  */
0037 extern void dump_skip_to(struct coredump_params *cprm, unsigned long to);
0038 extern void dump_skip(struct coredump_params *cprm, size_t nr);
0039 extern int dump_emit(struct coredump_params *cprm, const void *addr, int nr);
0040 extern int dump_align(struct coredump_params *cprm, int align);
0041 int dump_user_range(struct coredump_params *cprm, unsigned long start,
0042             unsigned long len);
0043 extern void do_coredump(const kernel_siginfo_t *siginfo);
0044 #else
0045 static inline void do_coredump(const kernel_siginfo_t *siginfo) {}
0046 #endif
0047 
0048 #if defined(CONFIG_COREDUMP) && defined(CONFIG_SYSCTL)
0049 extern void validate_coredump_safety(void);
0050 #else
0051 static inline void validate_coredump_safety(void) {}
0052 #endif
0053 
0054 #endif /* _LINUX_COREDUMP_H */