~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/elfcore.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _LINUX_ELFCORE_H
  3 #define _LINUX_ELFCORE_H
  4 
  5 #include <linux/user.h>
  6 #include <linux/bug.h>
  7 #include <linux/sched/task_stack.h>
  8 #include <linux/types.h>
  9 #include <linux/signal.h>
 10 #include <linux/time.h>
 11 #include <linux/ptrace.h>
 12 #include <linux/fs.h>
 13 #include <linux/elf.h>
 14 
 15 struct coredump_params;
 16 
 17 struct elf_siginfo
 18 {
 19         int     si_signo;                       /* signal number */
 20         int     si_code;                        /* extra code */
 21         int     si_errno;                       /* errno */
 22 };
 23 
 24 /*
 25  * Definitions to generate Intel SVR4-like core files.
 26  * These mostly have the same names as the SVR4 types with "elf_"
 27  * tacked on the front to prevent clashes with linux definitions,
 28  * and the typedef forms have been avoided.  This is mostly like
 29  * the SVR4 structure, but more Linuxy, with things that Linux does
 30  * not support and which gdb doesn't really use excluded.
 31  */
 32 struct elf_prstatus_common
 33 {
 34         struct elf_siginfo pr_info;     /* Info associated with signal */
 35         short   pr_cursig;              /* Current signal */
 36         unsigned long pr_sigpend;       /* Set of pending signals */
 37         unsigned long pr_sighold;       /* Set of held signals */
 38         pid_t   pr_pid;
 39         pid_t   pr_ppid;
 40         pid_t   pr_pgrp;
 41         pid_t   pr_sid;
 42         struct __kernel_old_timeval pr_utime;   /* User time */
 43         struct __kernel_old_timeval pr_stime;   /* System time */
 44         struct __kernel_old_timeval pr_cutime;  /* Cumulative user time */
 45         struct __kernel_old_timeval pr_cstime;  /* Cumulative system time */
 46 };
 47 
 48 struct elf_prstatus
 49 {
 50         struct elf_prstatus_common common;
 51         elf_gregset_t pr_reg;   /* GP registers */
 52         int pr_fpvalid;         /* True if math co-processor being used.  */
 53 };
 54 
 55 #define ELF_PRARGSZ     (80)    /* Number of chars for args */
 56 
 57 struct elf_prpsinfo
 58 {
 59         char    pr_state;       /* numeric process state */
 60         char    pr_sname;       /* char for pr_state */
 61         char    pr_zomb;        /* zombie */
 62         char    pr_nice;        /* nice val */
 63         unsigned long pr_flag;  /* flags */
 64         __kernel_uid_t  pr_uid;
 65         __kernel_gid_t  pr_gid;
 66         pid_t   pr_pid, pr_ppid, pr_pgrp, pr_sid;
 67         /* Lots missing */
 68         /*
 69          * The hard-coded 16 is derived from TASK_COMM_LEN, but it can't be
 70          * changed as it is exposed to userspace. We'd better make it hard-coded
 71          * here.
 72          */
 73         char    pr_fname[16];   /* filename of executable */
 74         char    pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
 75 };
 76 
 77 static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs)
 78 {
 79 #ifdef ELF_CORE_COPY_REGS
 80         ELF_CORE_COPY_REGS((*elfregs), regs)
 81 #else
 82         BUG_ON(sizeof(*elfregs) != sizeof(*regs));
 83         *(struct pt_regs *)elfregs = *regs;
 84 #endif
 85 }
 86 
 87 static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs)
 88 {
 89 #if defined (ELF_CORE_COPY_TASK_REGS)
 90         return ELF_CORE_COPY_TASK_REGS(t, elfregs);
 91 #else
 92         elf_core_copy_regs(elfregs, task_pt_regs(t));
 93 #endif
 94         return 0;
 95 }
 96 
 97 int elf_core_copy_task_fpregs(struct task_struct *t, elf_fpregset_t *fpu);
 98 
 99 #ifdef CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS
100 /*
101  * These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out
102  * extra segments containing the gate DSO contents.  Dumping its
103  * contents makes post-mortem fully interpretable later without matching up
104  * the same kernel and hardware config to see what PC values meant.
105  * Dumping its extra ELF program headers includes all the other information
106  * a debugger needs to easily find how the gate DSO was being used.
107  */
108 extern Elf_Half elf_core_extra_phdrs(struct coredump_params *cprm);
109 extern int
110 elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset);
111 extern int
112 elf_core_write_extra_data(struct coredump_params *cprm);
113 extern size_t elf_core_extra_data_size(struct coredump_params *cprm);
114 #else
115 static inline Elf_Half elf_core_extra_phdrs(struct coredump_params *cprm)
116 {
117         return 0;
118 }
119 
120 static inline int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)
121 {
122         return 1;
123 }
124 
125 static inline int elf_core_write_extra_data(struct coredump_params *cprm)
126 {
127         return 1;
128 }
129 
130 static inline size_t elf_core_extra_data_size(struct coredump_params *cprm)
131 {
132         return 0;
133 }
134 #endif /* CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS */
135 
136 #endif /* _LINUX_ELFCORE_H */
137 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php