Commit 5ab1c309b344880d81494e9eab7fb27682bc6d9d
Committed by
Linus Torvalds
1 parent
0f4cfb2e4e
Exists in
master
and in
20 other branches
coredump: pass siginfo_t* to do_coredump() and below, not merely signr
This is a preparatory patch for the introduction of NT_SIGINFO elf note. With this patch we pass "siginfo_t *siginfo" instead of "int signr" to do_coredump() and put it into coredump_params. It will be used by the next patch. Most changes are simple s/signr/siginfo->si_signo/. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Cc: Amerigo Wang <amwang@redhat.com> Cc: "Jonathan M. Foote" <jmfoote@cert.org> Cc: Roland McGrath <roland@hack.frob.com> Cc: Pedro Alves <palves@redhat.com> Cc: Fengguang Wu <fengguang.wu@intel.com> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 8 changed files with 21 additions and 21 deletions Side-by-side Diff
fs/binfmt_aout.c
... | ... | @@ -65,7 +65,7 @@ |
65 | 65 | current->flags |= PF_DUMPCORE; |
66 | 66 | strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm)); |
67 | 67 | dump.u_ar0 = offsetof(struct user, regs); |
68 | - dump.signal = cprm->signr; | |
68 | + dump.signal = cprm->siginfo->si_signo; | |
69 | 69 | aout_dump_thread(cprm->regs, &dump); |
70 | 70 | |
71 | 71 | /* If the size of the dump file exceeds the rlimit, then see what would happen |
fs/binfmt_elf.c
... | ... | @@ -1480,7 +1480,7 @@ |
1480 | 1480 | |
1481 | 1481 | static int fill_note_info(struct elfhdr *elf, int phdrs, |
1482 | 1482 | struct elf_note_info *info, |
1483 | - long signr, struct pt_regs *regs) | |
1483 | + siginfo_t *siginfo, struct pt_regs *regs) | |
1484 | 1484 | { |
1485 | 1485 | struct task_struct *dump_task = current; |
1486 | 1486 | const struct user_regset_view *view = task_user_regset_view(dump_task); |
... | ... | @@ -1550,7 +1550,7 @@ |
1550 | 1550 | * Now fill in each thread's information. |
1551 | 1551 | */ |
1552 | 1552 | for (t = info->thread; t != NULL; t = t->next) |
1553 | - if (!fill_thread_core_info(t, view, signr, &info->size)) | |
1553 | + if (!fill_thread_core_info(t, view, siginfo->si_signo, &info->size)) | |
1554 | 1554 | return 0; |
1555 | 1555 | |
1556 | 1556 | /* |
1557 | 1557 | |
... | ... | @@ -1713,14 +1713,14 @@ |
1713 | 1713 | |
1714 | 1714 | static int fill_note_info(struct elfhdr *elf, int phdrs, |
1715 | 1715 | struct elf_note_info *info, |
1716 | - long signr, struct pt_regs *regs) | |
1716 | + siginfo_t *siginfo, struct pt_regs *regs) | |
1717 | 1717 | { |
1718 | 1718 | struct list_head *t; |
1719 | 1719 | |
1720 | 1720 | if (!elf_note_info_init(info)) |
1721 | 1721 | return 0; |
1722 | 1722 | |
1723 | - if (signr) { | |
1723 | + if (siginfo->si_signo) { | |
1724 | 1724 | struct core_thread *ct; |
1725 | 1725 | struct elf_thread_status *ets; |
1726 | 1726 | |
1727 | 1727 | |
... | ... | @@ -1738,13 +1738,13 @@ |
1738 | 1738 | int sz; |
1739 | 1739 | |
1740 | 1740 | ets = list_entry(t, struct elf_thread_status, list); |
1741 | - sz = elf_dump_thread_status(signr, ets); | |
1741 | + sz = elf_dump_thread_status(siginfo->si_signo, ets); | |
1742 | 1742 | info->thread_status_size += sz; |
1743 | 1743 | } |
1744 | 1744 | } |
1745 | 1745 | /* now collect the dump for the current */ |
1746 | 1746 | memset(info->prstatus, 0, sizeof(*info->prstatus)); |
1747 | - fill_prstatus(info->prstatus, current, signr); | |
1747 | + fill_prstatus(info->prstatus, current, siginfo->si_signo); | |
1748 | 1748 | elf_core_copy_regs(&info->prstatus->pr_reg, regs); |
1749 | 1749 | |
1750 | 1750 | /* Set up header */ |
... | ... | @@ -1951,7 +1951,7 @@ |
1951 | 1951 | * Collect all the non-memory information about the process for the |
1952 | 1952 | * notes. This also sets up the file header. |
1953 | 1953 | */ |
1954 | - if (!fill_note_info(elf, e_phnum, &info, cprm->signr, cprm->regs)) | |
1954 | + if (!fill_note_info(elf, e_phnum, &info, cprm->siginfo, cprm->regs)) | |
1955 | 1955 | goto cleanup; |
1956 | 1956 | |
1957 | 1957 | has_dumped = 1; |
fs/binfmt_elf_fdpic.c
... | ... | @@ -1642,7 +1642,7 @@ |
1642 | 1642 | goto cleanup; |
1643 | 1643 | #endif |
1644 | 1644 | |
1645 | - if (cprm->signr) { | |
1645 | + if (cprm->siginfo->si_signo) { | |
1646 | 1646 | struct core_thread *ct; |
1647 | 1647 | struct elf_thread_status *tmp; |
1648 | 1648 | |
1649 | 1649 | |
... | ... | @@ -1661,13 +1661,13 @@ |
1661 | 1661 | int sz; |
1662 | 1662 | |
1663 | 1663 | tmp = list_entry(t, struct elf_thread_status, list); |
1664 | - sz = elf_dump_thread_status(cprm->signr, tmp); | |
1664 | + sz = elf_dump_thread_status(cprm->siginfo->si_signo, tmp); | |
1665 | 1665 | thread_status_size += sz; |
1666 | 1666 | } |
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | /* now collect the dump for the current */ |
1670 | - fill_prstatus(prstatus, current, cprm->signr); | |
1670 | + fill_prstatus(prstatus, current, cprm->siginfo->si_signo); | |
1671 | 1671 | elf_core_copy_regs(&prstatus->pr_reg, cprm->regs); |
1672 | 1672 | |
1673 | 1673 | segs = current->mm->map_count; |
fs/binfmt_flat.c
... | ... | @@ -107,7 +107,7 @@ |
107 | 107 | static int flat_core_dump(struct coredump_params *cprm) |
108 | 108 | { |
109 | 109 | printk("Process %s:%d received signr %d and should have core dumped\n", |
110 | - current->comm, current->pid, (int) cprm->signr); | |
110 | + current->comm, current->pid, (int) cprm->siginfo->si_signo); | |
111 | 111 | return(1); |
112 | 112 | } |
113 | 113 |
fs/coredump.c
... | ... | @@ -200,7 +200,7 @@ |
200 | 200 | break; |
201 | 201 | /* signal that caused the coredump */ |
202 | 202 | case 's': |
203 | - err = cn_printf(cn, "%ld", cprm->signr); | |
203 | + err = cn_printf(cn, "%ld", cprm->siginfo->si_signo); | |
204 | 204 | break; |
205 | 205 | /* UNIX time of coredump */ |
206 | 206 | case 't': { |
... | ... | @@ -457,7 +457,7 @@ |
457 | 457 | return 0; |
458 | 458 | } |
459 | 459 | |
460 | -void do_coredump(long signr, int exit_code, struct pt_regs *regs) | |
460 | +void do_coredump(siginfo_t *siginfo, struct pt_regs *regs) | |
461 | 461 | { |
462 | 462 | struct core_state core_state; |
463 | 463 | struct core_name cn; |
... | ... | @@ -472,7 +472,7 @@ |
472 | 472 | bool need_nonrelative = false; |
473 | 473 | static atomic_t core_dump_count = ATOMIC_INIT(0); |
474 | 474 | struct coredump_params cprm = { |
475 | - .signr = signr, | |
475 | + .siginfo = siginfo, | |
476 | 476 | .regs = regs, |
477 | 477 | .limit = rlimit(RLIMIT_CORE), |
478 | 478 | /* |
... | ... | @@ -483,7 +483,7 @@ |
483 | 483 | .mm_flags = mm->flags, |
484 | 484 | }; |
485 | 485 | |
486 | - audit_core_dumps(signr); | |
486 | + audit_core_dumps(siginfo->si_signo); | |
487 | 487 | |
488 | 488 | binfmt = mm->binfmt; |
489 | 489 | if (!binfmt || !binfmt->core_dump) |
... | ... | @@ -507,7 +507,7 @@ |
507 | 507 | need_nonrelative = true; |
508 | 508 | } |
509 | 509 | |
510 | - retval = coredump_wait(exit_code, &core_state); | |
510 | + retval = coredump_wait(siginfo->si_signo, &core_state); | |
511 | 511 | if (retval < 0) |
512 | 512 | goto fail_creds; |
513 | 513 |
include/linux/binfmts.h
include/linux/coredump.h
... | ... | @@ -12,9 +12,9 @@ |
12 | 12 | extern int dump_write(struct file *file, const void *addr, int nr); |
13 | 13 | extern int dump_seek(struct file *file, loff_t off); |
14 | 14 | #ifdef CONFIG_COREDUMP |
15 | -extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); | |
15 | +extern void do_coredump(siginfo_t *siginfo, struct pt_regs *regs); | |
16 | 16 | #else |
17 | -static inline void do_coredump(long signr, int exit_code, struct pt_regs *regs) {} | |
17 | +static inline void do_coredump(siginfo_t *siginfo, struct pt_regs *regs) {} | |
18 | 18 | #endif |
19 | 19 | |
20 | 20 | #endif /* _LINUX_COREDUMP_H */ |
kernel/signal.c