Skip to content

Commit 16aead8

Browse files
author
Al Viro
committed
take fdpic-related parts of elf_prstatus out
The only architecture where we might end up using both is arm, and there we definitely don't want fdpic-related fields in elf_prstatus - coredump layout of ELF binaries should not depend upon having the kernel built with the support of ELF_FDPIC ones. Just move the fdpic-modified variant into binfmt_elf_fdpic.c (and call it elf_prstatus_fdpic there) [name stolen from nico] Signed-off-by: Al Viro <[email protected]>
1 parent 1e6b57d commit 16aead8

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

fs/binfmt_elf_fdpic.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,32 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
11891189
*/
11901190
#ifdef CONFIG_ELF_CORE
11911191

1192+
struct elf_prstatus_fdpic
1193+
{
1194+
struct elf_siginfo pr_info; /* Info associated with signal */
1195+
short pr_cursig; /* Current signal */
1196+
unsigned long pr_sigpend; /* Set of pending signals */
1197+
unsigned long pr_sighold; /* Set of held signals */
1198+
pid_t pr_pid;
1199+
pid_t pr_ppid;
1200+
pid_t pr_pgrp;
1201+
pid_t pr_sid;
1202+
struct __kernel_old_timeval pr_utime; /* User time */
1203+
struct __kernel_old_timeval pr_stime; /* System time */
1204+
struct __kernel_old_timeval pr_cutime; /* Cumulative user time */
1205+
struct __kernel_old_timeval pr_cstime; /* Cumulative system time */
1206+
elf_gregset_t pr_reg; /* GP registers */
1207+
/* When using FDPIC, the loadmap addresses need to be communicated
1208+
* to GDB in order for GDB to do the necessary relocations. The
1209+
* fields (below) used to communicate this information are placed
1210+
* immediately after ``pr_reg'', so that the loadmap addresses may
1211+
* be viewed as part of the register set if so desired.
1212+
*/
1213+
unsigned long pr_exec_fdpic_loadmap;
1214+
unsigned long pr_interp_fdpic_loadmap;
1215+
int pr_fpvalid; /* True if math co-processor being used. */
1216+
};
1217+
11921218
/*
11931219
* Decide whether a segment is worth dumping; default is yes to be
11941220
* sure (missing info is worse than too much; etc).
@@ -1345,7 +1371,7 @@ static inline void fill_note(struct memelfnote *note, const char *name, int type
13451371
* fill up all the fields in prstatus from the given task struct, except
13461372
* registers which need to be filled up separately.
13471373
*/
1348-
static void fill_prstatus(struct elf_prstatus *prstatus,
1374+
static void fill_prstatus(struct elf_prstatus_fdpic *prstatus,
13491375
struct task_struct *p, long signr)
13501376
{
13511377
prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;
@@ -1428,7 +1454,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
14281454
struct elf_thread_status
14291455
{
14301456
struct list_head list;
1431-
struct elf_prstatus prstatus; /* NT_PRSTATUS */
1457+
struct elf_prstatus_fdpic prstatus; /* NT_PRSTATUS */
14321458
elf_fpregset_t fpu; /* NT_PRFPREG */
14331459
struct task_struct *thread;
14341460
#ifdef ELF_CORE_COPY_XFPREGS
@@ -1562,7 +1588,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
15621588
loff_t offset = 0, dataoff;
15631589
int numnote;
15641590
struct memelfnote *notes = NULL;
1565-
struct elf_prstatus *prstatus = NULL; /* NT_PRSTATUS */
1591+
struct elf_prstatus_fdpic *prstatus = NULL; /* NT_PRSTATUS */
15661592
struct elf_prpsinfo *psinfo = NULL; /* NT_PRPSINFO */
15671593
LIST_HEAD(thread_list);
15681594
struct list_head *t;

include/linux/elfcore-compat.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ struct compat_elf_prstatus
3232
struct old_timeval32 pr_cutime;
3333
struct old_timeval32 pr_cstime;
3434
compat_elf_gregset_t pr_reg;
35-
#ifdef CONFIG_BINFMT_ELF_FDPIC
36-
compat_ulong_t pr_exec_fdpic_loadmap;
37-
compat_ulong_t pr_interp_fdpic_loadmap;
38-
#endif
3935
compat_int_t pr_fpvalid;
4036
};
4137

include/linux/elfcore.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ struct elf_prstatus
4444
struct __kernel_old_timeval pr_cutime; /* Cumulative user time */
4545
struct __kernel_old_timeval pr_cstime; /* Cumulative system time */
4646
elf_gregset_t pr_reg; /* GP registers */
47-
#ifdef CONFIG_BINFMT_ELF_FDPIC
48-
/* When using FDPIC, the loadmap addresses need to be communicated
49-
* to GDB in order for GDB to do the necessary relocations. The
50-
* fields (below) used to communicate this information are placed
51-
* immediately after ``pr_reg'', so that the loadmap addresses may
52-
* be viewed as part of the register set if so desired.
53-
*/
54-
unsigned long pr_exec_fdpic_loadmap;
55-
unsigned long pr_interp_fdpic_loadmap;
56-
#endif
5747
int pr_fpvalid; /* True if math co-processor being used. */
5848
};
5949

0 commit comments

Comments
 (0)