aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. J. Lu <hjl.tools@gmail.com>2012-02-14 16:34:52 -0500
committerH. Peter Anvin <hpa@zytor.com>2012-02-20 15:48:48 -0500
commit0953f65d5db728df0fdc3d510a71fd811a3be758 (patch)
tree2f1c0f221a31da94f4b8565db12b945822af98b4
parent4ee5c0d05ce9b4e48e586a1ee168f166d191ddda (diff)
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: H. 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>
-rw-r--r--fs/binfmt_elf.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index bcb884e2d613..43ba478c3386 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1390,6 +1390,22 @@ static void do_thread_regset_writeback(struct task_struct *task,
1390 regset->writeback(task, regset, 1); 1390 regset->writeback(task, regset, 1);
1391} 1391}
1392 1392
1393#ifndef PR_REG_SIZE
1394#define PR_REG_SIZE(S) sizeof(S)
1395#endif
1396
1397#ifndef PRSTATUS_SIZE
1398#define PRSTATUS_SIZE(S) sizeof(S)
1399#endif
1400
1401#ifndef PR_REG_PTR
1402#define PR_REG_PTR(S) (&((S)->pr_reg))
1403#endif
1404
1405#ifndef SET_PR_FPVALID
1406#define SET_PR_FPVALID(S, V) ((S)->pr_fpvalid = (V))
1407#endif
1408
1393static int fill_thread_core_info(struct elf_thread_core_info *t, 1409static int fill_thread_core_info(struct elf_thread_core_info *t,
1394 const struct user_regset_view *view, 1410 const struct user_regset_view *view,
1395 long signr, size_t *total) 1411 long signr, size_t *total)
@@ -1404,11 +1420,11 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
1404 */ 1420 */
1405 fill_prstatus(&t->prstatus, t->task, signr); 1421 fill_prstatus(&t->prstatus, t->task, signr);
1406 (void) view->regsets[0].get(t->task, &view->regsets[0], 1422 (void) view->regsets[0].get(t->task, &view->regsets[0],
1407 0, sizeof(t->prstatus.pr_reg), 1423 0, PR_REG_SIZE(t->prstatus.pr_reg),
1408 &t->prstatus.pr_reg, NULL); 1424 PR_REG_PTR(&t->prstatus), NULL);
1409 1425
1410 fill_note(&t->notes[0], "CORE", NT_PRSTATUS, 1426 fill_note(&t->notes[0], "CORE", NT_PRSTATUS,
1411 sizeof(t->prstatus), &t->prstatus); 1427 PRSTATUS_SIZE(t->prstatus), &t->prstatus);
1412 *total += notesize(&t->notes[0]); 1428 *total += notesize(&t->notes[0]);
1413 1429
1414 do_thread_regset_writeback(t->task, &view->regsets[0]); 1430 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 regset->core_note_type, 1454 regset->core_note_type,
1439 size, data); 1455 size, data);
1440 else { 1456 else {
1441 t->prstatus.pr_fpvalid = 1; 1457 SET_PR_FPVALID(&t->prstatus, 1);
1442 fill_note(&t->notes[i], "CORE", 1458 fill_note(&t->notes[i], "CORE",
1443 NT_PRFPREG, size, data); 1459 NT_PRFPREG, size, data);
1444 } 1460 }