Merge tag 'fbdev-for-6.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
[linux-block.git] / include / linux / coredump.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
088e7af7
DH
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>
1d46e232 8#include <asm/siginfo.h>
088e7af7 9
a64b8908 10#ifdef CONFIG_COREDUMP
a07279c9
JH
11struct core_vma_metadata {
12 unsigned long start, end;
13 unsigned long flags;
14 unsigned long dump_size;
390031c9
EB
15 unsigned long pgoff;
16 struct file *file;
a07279c9
JH
17};
18
a99a3e2e
EB
19struct coredump_params {
20 const kernel_siginfo_t *siginfo;
a99a3e2e
EB
21 struct file *file;
22 unsigned long limit;
23 unsigned long mm_flags;
8603b6f5 24 int cpu;
a99a3e2e
EB
25 loff_t written;
26 loff_t pos;
27 loff_t to_skip;
95c5436a
EB
28 int vma_count;
29 size_t vma_data_size;
30 struct core_vma_metadata *vma_meta;
a99a3e2e
EB
31};
32
088e7af7
DH
33/*
34 * These are the only things you should do on a core-file: use only these
35 * functions to write out all the necessary info.
36 */
d0f1088b
AV
37extern void dump_skip_to(struct coredump_params *cprm, unsigned long to);
38extern void dump_skip(struct coredump_params *cprm, size_t nr);
ecc8c772 39extern int dump_emit(struct coredump_params *cprm, const void *addr, int nr);
22a8cb82 40extern int dump_align(struct coredump_params *cprm, int align);
afc63a97
JH
41int dump_user_range(struct coredump_params *cprm, unsigned long start,
42 unsigned long len);
ae7795bc 43extern void do_coredump(const kernel_siginfo_t *siginfo);
179899fd 44#else
ae7795bc 45static inline void do_coredump(const kernel_siginfo_t *siginfo) {}
179899fd 46#endif
088e7af7 47
f0bc21b2
XN
48#if defined(CONFIG_COREDUMP) && defined(CONFIG_SYSCTL)
49extern void validate_coredump_safety(void);
50#else
51static inline void validate_coredump_safety(void) {}
52#endif
53
088e7af7 54#endif /* _LINUX_COREDUMP_H */