Commit 0953f65d authored by H. J. Lu's avatar H. J. Lu Committed by H. Peter Anvin

elf: Allow core dump-related fields to be overridden

Allow some core dump-related fields to be overridden.  This allows
core dumps to work correctly for x32.
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Roland McGrath <roland@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
parent 4ee5c0d0
...@@ -1390,6 +1390,22 @@ static void do_thread_regset_writeback(struct task_struct *task, ...@@ -1390,6 +1390,22 @@ static void do_thread_regset_writeback(struct task_struct *task,
regset->writeback(task, regset, 1); regset->writeback(task, regset, 1);
} }
#ifndef PR_REG_SIZE
#define PR_REG_SIZE(S) sizeof(S)
#endif
#ifndef PRSTATUS_SIZE
#define PRSTATUS_SIZE(S) sizeof(S)
#endif
#ifndef PR_REG_PTR
#define PR_REG_PTR(S) (&((S)->pr_reg))
#endif
#ifndef SET_PR_FPVALID
#define SET_PR_FPVALID(S, V) ((S)->pr_fpvalid = (V))
#endif
static int fill_thread_core_info(struct elf_thread_core_info *t, static int fill_thread_core_info(struct elf_thread_core_info *t,
const struct user_regset_view *view, const struct user_regset_view *view,
long signr, size_t *total) long signr, size_t *total)
...@@ -1404,11 +1420,11 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, ...@@ -1404,11 +1420,11 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
*/ */
fill_prstatus(&t->prstatus, t->task, signr); fill_prstatus(&t->prstatus, t->task, signr);
(void) view->regsets[0].get(t->task, &view->regsets[0], (void) view->regsets[0].get(t->task, &view->regsets[0],
0, sizeof(t->prstatus.pr_reg), 0, PR_REG_SIZE(t->prstatus.pr_reg),
&t->prstatus.pr_reg, NULL); PR_REG_PTR(&t->prstatus), NULL);
fill_note(&t->notes[0], "CORE", NT_PRSTATUS, fill_note(&t->notes[0], "CORE", NT_PRSTATUS,
sizeof(t->prstatus), &t->prstatus); PRSTATUS_SIZE(t->prstatus), &t->prstatus);
*total += notesize(&t->notes[0]); *total += notesize(&t->notes[0]);
do_thread_regset_writeback(t->task, &view->regsets[0]); do_thread_regset_writeback(t->task, &view->regsets[0]);
...@@ -1438,7 +1454,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, ...@@ -1438,7 +1454,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
regset->core_note_type, regset->core_note_type,
size, data); size, data);
else { else {
t->prstatus.pr_fpvalid = 1; SET_PR_FPVALID(&t->prstatus, 1);
fill_note(&t->notes[i], "CORE", fill_note(&t->notes[i], "CORE",
NT_PRFPREG, size, data); NT_PRFPREG, size, data);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment