aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/binfmt_elf.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 41a958a7585e..5e1a4fb5cacb 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1424,6 +1424,18 @@ struct elf_note_info {
1424 int thread_notes; 1424 int thread_notes;
1425}; 1425};
1426 1426
1427/*
1428 * When a regset has a writeback hook, we call it on each thread before
1429 * dumping user memory. On register window machines, this makes sure the
1430 * user memory backing the register data is up to date before we read it.
1431 */
1432static void do_thread_regset_writeback(struct task_struct *task,
1433 const struct user_regset *regset)
1434{
1435 if (regset->writeback)
1436 regset->writeback(task, regset, 1);
1437}
1438
1427static int fill_thread_core_info(struct elf_thread_core_info *t, 1439static int fill_thread_core_info(struct elf_thread_core_info *t,
1428 const struct user_regset_view *view, 1440 const struct user_regset_view *view,
1429 long signr, size_t *total) 1441 long signr, size_t *total)
@@ -1445,6 +1457,8 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
1445 sizeof(t->prstatus), &t->prstatus); 1457 sizeof(t->prstatus), &t->prstatus);
1446 *total += notesize(&t->notes[0]); 1458 *total += notesize(&t->notes[0]);
1447 1459
1460 do_thread_regset_writeback(t->task, &view->regsets[0]);
1461
1448 /* 1462 /*
1449 * Each other regset might generate a note too. For each regset 1463 * Each other regset might generate a note too. For each regset
1450 * that has no core_note_type or is inactive, we leave t->notes[i] 1464 * that has no core_note_type or is inactive, we leave t->notes[i]
@@ -1452,6 +1466,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
1452 */ 1466 */
1453 for (i = 1; i < view->n; ++i) { 1467 for (i = 1; i < view->n; ++i) {
1454 const struct user_regset *regset = &view->regsets[i]; 1468 const struct user_regset *regset = &view->regsets[i];
1469 do_thread_regset_writeback(t->task, regset);
1455 if (regset->core_note_type && 1470 if (regset->core_note_type &&
1456 (!regset->active || regset->active(t->task, regset))) { 1471 (!regset->active || regset->active(t->task, regset))) {
1457 int ret; 1472 int ret;