xref: /openbmc/linux/include/linux/coredump.h (revision 4e541b06b0e8ae6ebd85a913dba8db43d3ce6fe3)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_COREDUMP_H
3 #define _LINUX_COREDUMP_H
4 
5 #include <linux/types.h>
6 #include <linux/mm.h>
7 #include <linux/fs.h>
8 #include <asm/siginfo.h>
9 
10 #ifdef CONFIG_COREDUMP
11 struct core_vma_metadata {
12 	unsigned long start, end;
13 	unsigned long flags;
14 	unsigned long dump_size;
15 };
16 
17 /*
18  * These are the only things you should do on a core-file: use only these
19  * functions to write out all the necessary info.
20  */
21 struct coredump_params;
22 extern void dump_skip_to(struct coredump_params *cprm, unsigned long to);
23 extern void dump_skip(struct coredump_params *cprm, size_t nr);
24 extern int dump_emit(struct coredump_params *cprm, const void *addr, int nr);
25 extern int dump_align(struct coredump_params *cprm, int align);
26 int dump_user_range(struct coredump_params *cprm, unsigned long start,
27 		    unsigned long len);
28 int dump_vma_snapshot(struct coredump_params *cprm, int *vma_count,
29 		      struct core_vma_metadata **vma_meta,
30 		      size_t *vma_data_size_ptr);
31 extern void do_coredump(const kernel_siginfo_t *siginfo);
32 #else
33 static inline void do_coredump(const kernel_siginfo_t *siginfo) {}
34 #endif
35 
36 #if defined(CONFIG_COREDUMP) && defined(CONFIG_SYSCTL)
37 extern void validate_coredump_safety(void);
38 #else
39 static inline void validate_coredump_safety(void) {}
40 #endif
41 
42 #endif /* _LINUX_COREDUMP_H */
43