aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r--fs/binfmt_elf.c71
1 files changed, 32 insertions, 39 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 742c8f530481..3b6ff854d983 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1506,7 +1506,7 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
1506 const struct user_regset_view *view = task_user_regset_view(dump_task); 1506 const struct user_regset_view *view = task_user_regset_view(dump_task);
1507 struct elf_thread_core_info *t; 1507 struct elf_thread_core_info *t;
1508 struct elf_prpsinfo *psinfo; 1508 struct elf_prpsinfo *psinfo;
1509 struct task_struct *g, *p; 1509 struct core_thread *ct;
1510 unsigned int i; 1510 unsigned int i;
1511 1511
1512 info->size = 0; 1512 info->size = 0;
@@ -1545,31 +1545,26 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
1545 /* 1545 /*
1546 * Allocate a structure for each thread. 1546 * Allocate a structure for each thread.
1547 */ 1547 */
1548 rcu_read_lock(); 1548 for (ct = &dump_task->mm->core_state->dumper; ct; ct = ct->next) {
1549 do_each_thread(g, p) 1549 t = kzalloc(offsetof(struct elf_thread_core_info,
1550 if (p->mm == dump_task->mm) { 1550 notes[info->thread_notes]),
1551 t = kzalloc(offsetof(struct elf_thread_core_info, 1551 GFP_KERNEL);
1552 notes[info->thread_notes]), 1552 if (unlikely(!t))
1553 GFP_ATOMIC); 1553 return 0;
1554 if (unlikely(!t)) { 1554
1555 rcu_read_unlock(); 1555 t->task = ct->task;
1556 return 0; 1556 if (ct->task == dump_task || !info->thread) {
1557 } 1557 t->next = info->thread;
1558 t->task = p; 1558 info->thread = t;
1559 if (p == dump_task || !info->thread) { 1559 } else {
1560 t->next = info->thread; 1560 /*
1561 info->thread = t; 1561 * Make sure to keep the original task at
1562 } else { 1562 * the head of the list.
1563 /* 1563 */
1564 * Make sure to keep the original task at 1564 t->next = info->thread->next;
1565 * the head of the list. 1565 info->thread->next = t;
1566 */
1567 t->next = info->thread->next;
1568 info->thread->next = t;
1569 }
1570 } 1566 }
1571 while_each_thread(g, p); 1567 }
1572 rcu_read_unlock();
1573 1568
1574 /* 1569 /*
1575 * Now fill in each thread's information. 1570 * Now fill in each thread's information.
@@ -1716,7 +1711,6 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
1716{ 1711{
1717#define NUM_NOTES 6 1712#define NUM_NOTES 6
1718 struct list_head *t; 1713 struct list_head *t;
1719 struct task_struct *g, *p;
1720 1714
1721 info->notes = NULL; 1715 info->notes = NULL;
1722 info->prstatus = NULL; 1716 info->prstatus = NULL;
@@ -1748,20 +1742,19 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
1748 1742
1749 info->thread_status_size = 0; 1743 info->thread_status_size = 0;
1750 if (signr) { 1744 if (signr) {
1745 struct core_thread *ct;
1751 struct elf_thread_status *ets; 1746 struct elf_thread_status *ets;
1752 rcu_read_lock(); 1747
1753 do_each_thread(g, p) 1748 for (ct = current->mm->core_state->dumper.next;
1754 if (current->mm == p->mm && current != p) { 1749 ct; ct = ct->next) {
1755 ets = kzalloc(sizeof(*ets), GFP_ATOMIC); 1750 ets = kzalloc(sizeof(*ets), GFP_KERNEL);
1756 if (!ets) { 1751 if (!ets)
1757 rcu_read_unlock(); 1752 return 0;
1758 return 0; 1753
1759 } 1754 ets->thread = ct->task;
1760 ets->thread = p; 1755 list_add(&ets->list, &info->thread_list);
1761 list_add(&ets->list, &info->thread_list); 1756 }
1762 } 1757
1763 while_each_thread(g, p);
1764 rcu_read_unlock();
1765 list_for_each(t, &info->thread_list) { 1758 list_for_each(t, &info->thread_list) {
1766 int sz; 1759 int sz;
1767 1760