Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

signal: Distinguish between kernel_siginfo and siginfo

Linus recently observed that if we did not worry about the padding
member in struct siginfo it is only about 48 bytes, and 48 bytes is
much nicer than 128 bytes for allocating on the stack and copying
around in the kernel.

The obvious thing of only adding the padding when userspace is
including siginfo.h won't work as there are sigframe definitions in
the kernel that embed struct siginfo.

So split siginfo in two; kernel_siginfo and siginfo. Keeping the
traditional name for the userspace definition. While the version that
is used internally to the kernel and ultimately will not be padded to
128 bytes is called kernel_siginfo.

The definition of struct kernel_siginfo I have put in include/signal_types.h

A set of buildtime checks has been added to verify the two structures have
the same field offsets.

To make it easy to verify the change kernel_siginfo retains the same
size as siginfo. The reduction in size comes in a following change.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>

+165 -110
+1 -1
arch/x86/include/asm/compat.h
··· 240 240 241 241 struct compat_siginfo; 242 242 int __copy_siginfo_to_user32(struct compat_siginfo __user *to, 243 - const siginfo_t *from, bool x32_ABI); 243 + const kernel_siginfo_t *from, bool x32_ABI); 244 244 245 245 #endif /* _ASM_X86_COMPAT_H */
+2 -2
drivers/usb/core/devio.c
··· 582 582 { 583 583 struct async *as = urb->context; 584 584 struct usb_dev_state *ps = as->ps; 585 - struct siginfo sinfo; 585 + struct kernel_siginfo sinfo; 586 586 struct pid *pid = NULL; 587 587 const struct cred *cred = NULL; 588 588 unsigned long flags; ··· 2599 2599 static void usbdev_remove(struct usb_device *udev) 2600 2600 { 2601 2601 struct usb_dev_state *ps; 2602 - struct siginfo sinfo; 2602 + struct kernel_siginfo sinfo; 2603 2603 2604 2604 while (!list_empty(&udev->filelist)) { 2605 2605 ps = list_entry(udev->filelist.next, struct usb_dev_state, list);
+3 -3
fs/binfmt_elf.c
··· 1580 1580 } 1581 1581 1582 1582 static void fill_siginfo_note(struct memelfnote *note, user_siginfo_t *csigdata, 1583 - const siginfo_t *siginfo) 1583 + const kernel_siginfo_t *siginfo) 1584 1584 { 1585 1585 mm_segment_t old_fs = get_fs(); 1586 1586 set_fs(KERNEL_DS); ··· 1782 1782 1783 1783 static int fill_note_info(struct elfhdr *elf, int phdrs, 1784 1784 struct elf_note_info *info, 1785 - const siginfo_t *siginfo, struct pt_regs *regs) 1785 + const kernel_siginfo_t *siginfo, struct pt_regs *regs) 1786 1786 { 1787 1787 struct task_struct *dump_task = current; 1788 1788 const struct user_regset_view *view = task_user_regset_view(dump_task); ··· 2031 2031 2032 2032 static int fill_note_info(struct elfhdr *elf, int phdrs, 2033 2033 struct elf_note_info *info, 2034 - const siginfo_t *siginfo, struct pt_regs *regs) 2034 + const kernel_siginfo_t *siginfo, struct pt_regs *regs) 2035 2035 { 2036 2036 struct list_head *t; 2037 2037 struct core_thread *ct;
+1 -1
fs/coredump.c
··· 536 536 return err; 537 537 } 538 538 539 - void do_coredump(const siginfo_t *siginfo) 539 + void do_coredump(const kernel_siginfo_t *siginfo) 540 540 { 541 541 struct core_state core_state; 542 542 struct core_name cn;
+1 -1
fs/fcntl.c
··· 735 735 return; 736 736 737 737 switch (signum) { 738 - siginfo_t si; 738 + kernel_siginfo_t si; 739 739 default: 740 740 /* Queue a rt signal with the appropriate fd as its 741 741 value. We use SI_SIGIO as the source, not
+3 -3
fs/signalfd.c
··· 79 79 * Copied from copy_siginfo_to_user() in kernel/signal.c 80 80 */ 81 81 static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo, 82 - siginfo_t const *kinfo) 82 + kernel_siginfo_t const *kinfo) 83 83 { 84 84 struct signalfd_siginfo new; 85 85 ··· 163 163 return sizeof(*uinfo); 164 164 } 165 165 166 - static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, siginfo_t *info, 166 + static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, kernel_siginfo_t *info, 167 167 int nonblock) 168 168 { 169 169 ssize_t ret; ··· 215 215 struct signalfd_siginfo __user *siginfo; 216 216 int nonblock = file->f_flags & O_NONBLOCK; 217 217 ssize_t ret, total = 0; 218 - siginfo_t info; 218 + kernel_siginfo_t info; 219 219 220 220 count /= sizeof(struct signalfd_siginfo); 221 221 if (!count)
+1 -1
include/linux/binfmts.h
··· 78 78 79 79 /* Function parameter for binfmt->coredump */ 80 80 struct coredump_params { 81 - const siginfo_t *siginfo; 81 + const kernel_siginfo_t *siginfo; 82 82 struct pt_regs *regs; 83 83 struct file *file; 84 84 unsigned long limit;
+2 -2
include/linux/compat.h
··· 452 452 unsigned long bitmap_size); 453 453 long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask, 454 454 unsigned long bitmap_size); 455 - int copy_siginfo_from_user32(siginfo_t *to, const struct compat_siginfo __user *from); 456 - int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *from); 455 + int copy_siginfo_from_user32(kernel_siginfo_t *to, const struct compat_siginfo __user *from); 456 + int copy_siginfo_to_user32(struct compat_siginfo __user *to, const kernel_siginfo_t *from); 457 457 int get_compat_sigevent(struct sigevent *event, 458 458 const struct compat_sigevent __user *u_event); 459 459
+2 -2
include/linux/coredump.h
··· 17 17 extern int dump_align(struct coredump_params *cprm, int align); 18 18 extern void dump_truncate(struct coredump_params *cprm); 19 19 #ifdef CONFIG_COREDUMP 20 - extern void do_coredump(const siginfo_t *siginfo); 20 + extern void do_coredump(const kernel_siginfo_t *siginfo); 21 21 #else 22 - static inline void do_coredump(const siginfo_t *siginfo) {} 22 + static inline void do_coredump(const kernel_siginfo_t *siginfo) {} 23 23 #endif 24 24 25 25 #endif /* _LINUX_COREDUMP_H */
+2 -2
include/linux/lsm_hooks.h
··· 672 672 * Return 0 if permission is granted. 673 673 * @task_kill: 674 674 * Check permission before sending signal @sig to @p. @info can be NULL, 675 - * the constant 1, or a pointer to a siginfo structure. If @info is 1 or 675 + * the constant 1, or a pointer to a kernel_siginfo structure. If @info is 1 or 676 676 * SI_FROMKERNEL(info) is true, then the signal should be viewed as coming 677 677 * from the kernel and should typically be permitted. 678 678 * SIGIO signals are handled separately by the send_sigiotask hook in ··· 1606 1606 int (*task_setscheduler)(struct task_struct *p); 1607 1607 int (*task_getscheduler)(struct task_struct *p); 1608 1608 int (*task_movememory)(struct task_struct *p); 1609 - int (*task_kill)(struct task_struct *p, struct siginfo *info, 1609 + int (*task_kill)(struct task_struct *p, struct kernel_siginfo *info, 1610 1610 int sig, const struct cred *cred); 1611 1611 int (*task_prctl)(int option, unsigned long arg2, unsigned long arg3, 1612 1612 unsigned long arg4, unsigned long arg5);
+1 -1
include/linux/posix-timers.h
··· 126 126 127 127 void update_rlimit_cpu(struct task_struct *task, unsigned long rlim_new); 128 128 129 - void posixtimer_rearm(struct siginfo *info); 129 + void posixtimer_rearm(struct kernel_siginfo *info); 130 130 #endif
+1 -1
include/linux/ptrace.h
··· 341 341 #else 342 342 static inline void user_single_step_report(struct pt_regs *regs) 343 343 { 344 - siginfo_t info; 344 + kernel_siginfo_t info; 345 345 clear_siginfo(&info); 346 346 info.si_signo = SIGTRAP; 347 347 info.si_errno = 0;
+1 -1
include/linux/sched.h
··· 960 960 961 961 /* Ptrace state: */ 962 962 unsigned long ptrace_message; 963 - siginfo_t *last_siginfo; 963 + kernel_siginfo_t *last_siginfo; 964 964 965 965 struct task_io_accounting ioac; 966 966 #ifdef CONFIG_TASK_XACCT
+9 -9
include/linux/sched/signal.h
··· 270 270 extern void flush_signals(struct task_struct *); 271 271 extern void ignore_signals(struct task_struct *); 272 272 extern void flush_signal_handlers(struct task_struct *, int force_default); 273 - extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info); 273 + extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, kernel_siginfo_t *info); 274 274 275 275 static inline int kernel_dequeue_signal(void) 276 276 { 277 277 struct task_struct *tsk = current; 278 - siginfo_t __info; 278 + kernel_siginfo_t __info; 279 279 int ret; 280 280 281 281 spin_lock_irq(&tsk->sighand->siglock); ··· 322 322 323 323 int force_sig_ptrace_errno_trap(int errno, void __user *addr); 324 324 325 - extern int send_sig_info(int, struct siginfo *, struct task_struct *); 325 + extern int send_sig_info(int, struct kernel_siginfo *, struct task_struct *); 326 326 extern void force_sigsegv(int sig, struct task_struct *p); 327 - extern int force_sig_info(int, struct siginfo *, struct task_struct *); 328 - extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp); 329 - extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid); 330 - extern int kill_pid_info_as_cred(int, struct siginfo *, struct pid *, 327 + extern int force_sig_info(int, struct kernel_siginfo *, struct task_struct *); 328 + extern int __kill_pgrp_info(int sig, struct kernel_siginfo *info, struct pid *pgrp); 329 + extern int kill_pid_info(int sig, struct kernel_siginfo *info, struct pid *pid); 330 + extern int kill_pid_info_as_cred(int, struct kernel_siginfo *, struct pid *, 331 331 const struct cred *); 332 332 extern int kill_pgrp(struct pid *pid, int sig, int priv); 333 333 extern int kill_pid(struct pid *pid, int sig, int priv); ··· 475 475 } 476 476 477 477 /* These can be the second arg to send_sig_info/send_group_sig_info. */ 478 - #define SEND_SIG_NOINFO ((struct siginfo *) 0) 479 - #define SEND_SIG_PRIV ((struct siginfo *) 1) 478 + #define SEND_SIG_NOINFO ((struct kernel_siginfo *) 0) 479 + #define SEND_SIG_PRIV ((struct kernel_siginfo *) 1) 480 480 481 481 /* 482 482 * True if we are on the alternate signal stack.
+3 -3
include/linux/security.h
··· 35 35 struct linux_binprm; 36 36 struct cred; 37 37 struct rlimit; 38 - struct siginfo; 38 + struct kernel_siginfo; 39 39 struct sembuf; 40 40 struct kern_ipc_perm; 41 41 struct audit_context; ··· 361 361 int security_task_setscheduler(struct task_struct *p); 362 362 int security_task_getscheduler(struct task_struct *p); 363 363 int security_task_movememory(struct task_struct *p); 364 - int security_task_kill(struct task_struct *p, struct siginfo *info, 364 + int security_task_kill(struct task_struct *p, struct kernel_siginfo *info, 365 365 int sig, const struct cred *cred); 366 366 int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, 367 367 unsigned long arg4, unsigned long arg5); ··· 1020 1020 } 1021 1021 1022 1022 static inline int security_task_kill(struct task_struct *p, 1023 - struct siginfo *info, int sig, 1023 + struct kernel_siginfo *info, int sig, 1024 1024 const struct cred *cred) 1025 1025 { 1026 1026 return 0;
+8 -7
include/linux/signal.h
··· 11 11 /* for sysctl */ 12 12 extern int print_fatal_signals; 13 13 14 - static inline void copy_siginfo(struct siginfo *to, const struct siginfo *from) 14 + static inline void copy_siginfo(kernel_siginfo_t *to, 15 + const kernel_siginfo_t *from) 15 16 { 16 17 memcpy(to, from, sizeof(*to)); 17 18 } 18 19 19 - static inline void clear_siginfo(struct siginfo *info) 20 + static inline void clear_siginfo(kernel_siginfo_t *info) 20 21 { 21 22 memset(info, 0, sizeof(*info)); 22 23 } 23 24 24 - int copy_siginfo_to_user(struct siginfo __user *to, const struct siginfo *from); 25 - int copy_siginfo_from_user(struct siginfo *to, const struct siginfo __user *from); 25 + int copy_siginfo_to_user(siginfo_t __user *to, const kernel_siginfo_t *from); 26 + int copy_siginfo_from_user(kernel_siginfo_t *to, const siginfo_t __user *from); 26 27 27 28 enum siginfo_layout { 28 29 SIL_KILL, ··· 259 258 enum pid_type; 260 259 261 260 extern int next_signal(struct sigpending *pending, sigset_t *mask); 262 - extern int do_send_sig_info(int sig, struct siginfo *info, 261 + extern int do_send_sig_info(int sig, struct kernel_siginfo *info, 263 262 struct task_struct *p, enum pid_type type); 264 - extern int group_send_sig_info(int sig, struct siginfo *info, 263 + extern int group_send_sig_info(int sig, struct kernel_siginfo *info, 265 264 struct task_struct *p, enum pid_type type); 266 - extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); 265 + extern int __group_send_sig_info(int, struct kernel_siginfo *, struct task_struct *); 267 266 extern int sigprocmask(int, sigset_t *, sigset_t *); 268 267 extern void set_current_blocked(sigset_t *); 269 268 extern void __set_current_blocked(const sigset_t *);
+9 -2
include/linux/signal_types.h
··· 9 9 #include <linux/list.h> 10 10 #include <uapi/linux/signal.h> 11 11 12 + typedef struct kernel_siginfo { 13 + union { 14 + __SIGINFO; 15 + int _si_pad[SI_MAX_SIZE/sizeof(int)]; 16 + }; 17 + } kernel_siginfo_t; 18 + 12 19 /* 13 20 * Real Time signals may be queued. 14 21 */ ··· 23 16 struct sigqueue { 24 17 struct list_head list; 25 18 int flags; 26 - siginfo_t info; 19 + kernel_siginfo_t info; 27 20 struct user_struct *user; 28 21 }; 29 22 ··· 67 60 68 61 struct ksignal { 69 62 struct k_sigaction ka; 70 - siginfo_t info; 63 + kernel_siginfo_t info; 71 64 int sig; 72 65 }; 73 66
+2 -2
include/trace/events/signal.h
··· 49 49 */ 50 50 TRACE_EVENT(signal_generate, 51 51 52 - TP_PROTO(int sig, struct siginfo *info, struct task_struct *task, 52 + TP_PROTO(int sig, struct kernel_siginfo *info, struct task_struct *task, 53 53 int group, int result), 54 54 55 55 TP_ARGS(sig, info, task, group, result), ··· 95 95 */ 96 96 TRACE_EVENT(signal_deliver, 97 97 98 - TP_PROTO(int sig, struct siginfo *info, struct k_sigaction *ka), 98 + TP_PROTO(int sig, struct kernel_siginfo *info, struct k_sigaction *ka), 99 99 100 100 TP_ARGS(sig, info, ka), 101 101
+1 -1
ipc/mqueue.c
··· 655 655 * synchronously. */ 656 656 if (info->notify_owner && 657 657 info->attr.mq_curmsgs == 1) { 658 - struct siginfo sig_i; 658 + struct kernel_siginfo sig_i; 659 659 switch (info->notify.sigev_notify) { 660 660 case SIGEV_NONE: 661 661 break;
+5 -5
kernel/ptrace.c
··· 651 651 return 0; 652 652 } 653 653 654 - static int ptrace_getsiginfo(struct task_struct *child, siginfo_t *info) 654 + static int ptrace_getsiginfo(struct task_struct *child, kernel_siginfo_t *info) 655 655 { 656 656 unsigned long flags; 657 657 int error = -ESRCH; ··· 667 667 return error; 668 668 } 669 669 670 - static int ptrace_setsiginfo(struct task_struct *child, const siginfo_t *info) 670 + static int ptrace_setsiginfo(struct task_struct *child, const kernel_siginfo_t *info) 671 671 { 672 672 unsigned long flags; 673 673 int error = -ESRCH; ··· 709 709 pending = &child->pending; 710 710 711 711 for (i = 0; i < arg.nr; ) { 712 - siginfo_t info; 712 + kernel_siginfo_t info; 713 713 s32 off = arg.off + i; 714 714 715 715 spin_lock_irq(&child->sighand->siglock); ··· 885 885 { 886 886 bool seized = child->ptrace & PT_SEIZED; 887 887 int ret = -EIO; 888 - siginfo_t siginfo, *si; 888 + kernel_siginfo_t siginfo, *si; 889 889 void __user *datavp = (void __user *) data; 890 890 unsigned long __user *datalp = datavp; 891 891 unsigned long flags; ··· 1180 1180 { 1181 1181 compat_ulong_t __user *datap = compat_ptr(data); 1182 1182 compat_ulong_t word; 1183 - siginfo_t siginfo; 1183 + kernel_siginfo_t siginfo; 1184 1184 int ret; 1185 1185 1186 1186 switch (request) {
+3 -3
kernel/seccomp.c
··· 522 522 __put_seccomp_filter(tsk->seccomp.filter); 523 523 } 524 524 525 - static void seccomp_init_siginfo(siginfo_t *info, int syscall, int reason) 525 + static void seccomp_init_siginfo(kernel_siginfo_t *info, int syscall, int reason) 526 526 { 527 527 clear_siginfo(info); 528 528 info->si_signo = SIGSYS; ··· 542 542 */ 543 543 static void seccomp_send_sigsys(int syscall, int reason) 544 544 { 545 - struct siginfo info; 545 + struct kernel_siginfo info; 546 546 seccomp_init_siginfo(&info, syscall, reason); 547 547 force_sig_info(SIGSYS, &info, current); 548 548 } ··· 747 747 /* Dump core only if this is the last remaining thread. */ 748 748 if (action == SECCOMP_RET_KILL_PROCESS || 749 749 get_nr_threads(current) == 1) { 750 - siginfo_t info; 750 + kernel_siginfo_t info; 751 751 752 752 /* Show the original registers in the dump. */ 753 753 syscall_rollback(current, task_pt_regs(current));
+99 -52
kernel/signal.c
··· 549 549 return !tsk->ptrace; 550 550 } 551 551 552 - static void collect_signal(int sig, struct sigpending *list, siginfo_t *info, 552 + static void collect_signal(int sig, struct sigpending *list, kernel_siginfo_t *info, 553 553 bool *resched_timer) 554 554 { 555 555 struct sigqueue *q, *first = NULL; ··· 595 595 } 596 596 597 597 static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, 598 - siginfo_t *info, bool *resched_timer) 598 + kernel_siginfo_t *info, bool *resched_timer) 599 599 { 600 600 int sig = next_signal(pending, mask); 601 601 ··· 610 610 * 611 611 * All callers have to hold the siglock. 612 612 */ 613 - int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) 613 + int dequeue_signal(struct task_struct *tsk, sigset_t *mask, kernel_siginfo_t *info) 614 614 { 615 615 bool resched_timer = false; 616 616 int signr; ··· 737 737 } 738 738 } 739 739 740 - static inline int is_si_special(const struct siginfo *info) 740 + static inline int is_si_special(const struct kernel_siginfo *info) 741 741 { 742 742 return info <= SEND_SIG_PRIV; 743 743 } 744 744 745 - static inline bool si_fromuser(const struct siginfo *info) 745 + static inline bool si_fromuser(const struct kernel_siginfo *info) 746 746 { 747 747 return info == SEND_SIG_NOINFO || 748 748 (!is_si_special(info) && SI_FROMUSER(info)); ··· 767 767 * Bad permissions for sending the signal 768 768 * - the caller must hold the RCU read lock 769 769 */ 770 - static int check_kill_permission(int sig, struct siginfo *info, 770 + static int check_kill_permission(int sig, struct kernel_siginfo *info, 771 771 struct task_struct *t) 772 772 { 773 773 struct pid *sid; ··· 1010 1010 } 1011 1011 1012 1012 #ifdef CONFIG_USER_NS 1013 - static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_struct *t) 1013 + static inline void userns_fixup_signal_uid(struct kernel_siginfo *info, struct task_struct *t) 1014 1014 { 1015 1015 if (current_user_ns() == task_cred_xxx(t, user_ns)) 1016 1016 return; ··· 1024 1024 rcu_read_unlock(); 1025 1025 } 1026 1026 #else 1027 - static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_struct *t) 1027 + static inline void userns_fixup_signal_uid(struct kernel_siginfo *info, struct task_struct *t) 1028 1028 { 1029 1029 return; 1030 1030 } 1031 1031 #endif 1032 1032 1033 - static int __send_signal(int sig, struct siginfo *info, struct task_struct *t, 1033 + static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struct *t, 1034 1034 enum pid_type type, int from_ancestor_ns) 1035 1035 { 1036 1036 struct sigpending *pending; ··· 1150 1150 return ret; 1151 1151 } 1152 1152 1153 - static int send_signal(int sig, struct siginfo *info, struct task_struct *t, 1153 + static int send_signal(int sig, struct kernel_siginfo *info, struct task_struct *t, 1154 1154 enum pid_type type) 1155 1155 { 1156 1156 int from_ancestor_ns = 0; ··· 1197 1197 __setup("print-fatal-signals=", setup_print_fatal_signals); 1198 1198 1199 1199 int 1200 - __group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p) 1200 + __group_send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p) 1201 1201 { 1202 1202 return send_signal(sig, info, p, PIDTYPE_TGID); 1203 1203 } 1204 1204 1205 - int do_send_sig_info(int sig, struct siginfo *info, struct task_struct *p, 1205 + int do_send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p, 1206 1206 enum pid_type type) 1207 1207 { 1208 1208 unsigned long flags; ··· 1228 1228 * that is why we also clear SIGNAL_UNKILLABLE. 1229 1229 */ 1230 1230 int 1231 - force_sig_info(int sig, struct siginfo *info, struct task_struct *t) 1231 + force_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *t) 1232 1232 { 1233 1233 unsigned long int flags; 1234 1234 int ret, blocked, ignored; ··· 1316 1316 /* 1317 1317 * send signal info to all the members of a group 1318 1318 */ 1319 - int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p, 1320 - enum pid_type type) 1319 + int group_send_sig_info(int sig, struct kernel_siginfo *info, 1320 + struct task_struct *p, enum pid_type type) 1321 1321 { 1322 1322 int ret; 1323 1323 ··· 1336 1336 * control characters do (^C, ^Z etc) 1337 1337 * - the caller must hold at least a readlock on tasklist_lock 1338 1338 */ 1339 - int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp) 1339 + int __kill_pgrp_info(int sig, struct kernel_siginfo *info, struct pid *pgrp) 1340 1340 { 1341 1341 struct task_struct *p = NULL; 1342 1342 int retval, success; ··· 1351 1351 return success ? 0 : retval; 1352 1352 } 1353 1353 1354 - int kill_pid_info(int sig, struct siginfo *info, struct pid *pid) 1354 + int kill_pid_info(int sig, struct kernel_siginfo *info, struct pid *pid) 1355 1355 { 1356 1356 int error = -ESRCH; 1357 1357 struct task_struct *p; ··· 1373 1373 } 1374 1374 } 1375 1375 1376 - static int kill_proc_info(int sig, struct siginfo *info, pid_t pid) 1376 + static int kill_proc_info(int sig, struct kernel_siginfo *info, pid_t pid) 1377 1377 { 1378 1378 int error; 1379 1379 rcu_read_lock(); ··· 1394 1394 } 1395 1395 1396 1396 /* like kill_pid_info(), but doesn't use uid/euid of "current" */ 1397 - int kill_pid_info_as_cred(int sig, struct siginfo *info, struct pid *pid, 1397 + int kill_pid_info_as_cred(int sig, struct kernel_siginfo *info, struct pid *pid, 1398 1398 const struct cred *cred) 1399 1399 { 1400 1400 int ret = -EINVAL; ··· 1438 1438 * is probably wrong. Should make it like BSD or SYSV. 1439 1439 */ 1440 1440 1441 - static int kill_something_info(int sig, struct siginfo *info, pid_t pid) 1441 + static int kill_something_info(int sig, struct kernel_siginfo *info, pid_t pid) 1442 1442 { 1443 1443 int ret; 1444 1444 ··· 1482 1482 * These are for backward compatibility with the rest of the kernel source. 1483 1483 */ 1484 1484 1485 - int send_sig_info(int sig, struct siginfo *info, struct task_struct *p) 1485 + int send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p) 1486 1486 { 1487 1487 /* 1488 1488 * Make sure legacy kernel users don't send in bad values ··· 1533 1533 ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) 1534 1534 , struct task_struct *t) 1535 1535 { 1536 - struct siginfo info; 1536 + struct kernel_siginfo info; 1537 1537 1538 1538 clear_siginfo(&info); 1539 1539 info.si_signo = sig; ··· 1556 1556 ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) 1557 1557 , struct task_struct *t) 1558 1558 { 1559 - struct siginfo info; 1559 + struct kernel_siginfo info; 1560 1560 1561 1561 clear_siginfo(&info); 1562 1562 info.si_signo = sig; ··· 1576 1576 1577 1577 int force_sig_mceerr(int code, void __user *addr, short lsb, struct task_struct *t) 1578 1578 { 1579 - struct siginfo info; 1579 + struct kernel_siginfo info; 1580 1580 1581 1581 WARN_ON((code != BUS_MCEERR_AO) && (code != BUS_MCEERR_AR)); 1582 1582 clear_siginfo(&info); ··· 1590 1590 1591 1591 int send_sig_mceerr(int code, void __user *addr, short lsb, struct task_struct *t) 1592 1592 { 1593 - struct siginfo info; 1593 + struct kernel_siginfo info; 1594 1594 1595 1595 WARN_ON((code != BUS_MCEERR_AO) && (code != BUS_MCEERR_AR)); 1596 1596 clear_siginfo(&info); ··· 1605 1605 1606 1606 int force_sig_bnderr(void __user *addr, void __user *lower, void __user *upper) 1607 1607 { 1608 - struct siginfo info; 1608 + struct kernel_siginfo info; 1609 1609 1610 1610 clear_siginfo(&info); 1611 1611 info.si_signo = SIGSEGV; ··· 1620 1620 #ifdef SEGV_PKUERR 1621 1621 int force_sig_pkuerr(void __user *addr, u32 pkey) 1622 1622 { 1623 - struct siginfo info; 1623 + struct kernel_siginfo info; 1624 1624 1625 1625 clear_siginfo(&info); 1626 1626 info.si_signo = SIGSEGV; ··· 1637 1637 */ 1638 1638 int force_sig_ptrace_errno_trap(int errno, void __user *addr) 1639 1639 { 1640 - struct siginfo info; 1640 + struct kernel_siginfo info; 1641 1641 1642 1642 clear_siginfo(&info); 1643 1643 info.si_signo = SIGTRAP; ··· 1766 1766 */ 1767 1767 bool do_notify_parent(struct task_struct *tsk, int sig) 1768 1768 { 1769 - struct siginfo info; 1769 + struct kernel_siginfo info; 1770 1770 unsigned long flags; 1771 1771 struct sighand_struct *psig; 1772 1772 bool autoreap = false; ··· 1871 1871 static void do_notify_parent_cldstop(struct task_struct *tsk, 1872 1872 bool for_ptracer, int why) 1873 1873 { 1874 - struct siginfo info; 1874 + struct kernel_siginfo info; 1875 1875 unsigned long flags; 1876 1876 struct task_struct *parent; 1877 1877 struct sighand_struct *sighand; ··· 1971 1971 * If we actually decide not to stop at all because the tracer 1972 1972 * is gone, we keep current->exit_code unless clear_code. 1973 1973 */ 1974 - static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info) 1974 + static void ptrace_stop(int exit_code, int why, int clear_code, kernel_siginfo_t *info) 1975 1975 __releases(&current->sighand->siglock) 1976 1976 __acquires(&current->sighand->siglock) 1977 1977 { ··· 2108 2108 2109 2109 static void ptrace_do_notify(int signr, int exit_code, int why) 2110 2110 { 2111 - siginfo_t info; 2111 + kernel_siginfo_t info; 2112 2112 2113 2113 clear_siginfo(&info); 2114 2114 info.si_signo = signr; ··· 2289 2289 } 2290 2290 } 2291 2291 2292 - static int ptrace_signal(int signr, siginfo_t *info) 2292 + static int ptrace_signal(int signr, kernel_siginfo_t *info) 2293 2293 { 2294 2294 /* 2295 2295 * We do not check sig_kernel_stop(signr) but set this marker ··· 2889 2889 return layout; 2890 2890 } 2891 2891 2892 - int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from) 2892 + int copy_siginfo_to_user(siginfo_t __user *to, const kernel_siginfo_t *from) 2893 2893 { 2894 - if (copy_to_user(to, from , sizeof(struct siginfo))) 2894 + if (copy_to_user(to, from , sizeof(struct kernel_siginfo))) 2895 2895 return -EFAULT; 2896 2896 return 0; 2897 2897 } 2898 2898 2899 - int copy_siginfo_from_user(siginfo_t *to, const siginfo_t __user *from) 2899 + int copy_siginfo_from_user(kernel_siginfo_t *to, const siginfo_t __user *from) 2900 2900 { 2901 2901 if (copy_from_user(to, from, sizeof(struct siginfo))) 2902 2902 return -EFAULT; ··· 2905 2905 2906 2906 #ifdef CONFIG_COMPAT 2907 2907 int copy_siginfo_to_user32(struct compat_siginfo __user *to, 2908 - const struct siginfo *from) 2908 + const struct kernel_siginfo *from) 2909 2909 #if defined(CONFIG_X86_X32_ABI) || defined(CONFIG_IA32_EMULATION) 2910 2910 { 2911 2911 return __copy_siginfo_to_user32(to, from, in_x32_syscall()); 2912 2912 } 2913 2913 int __copy_siginfo_to_user32(struct compat_siginfo __user *to, 2914 - const struct siginfo *from, bool x32_ABI) 2914 + const struct kernel_siginfo *from, bool x32_ABI) 2915 2915 #endif 2916 2916 { 2917 2917 struct compat_siginfo new; ··· 2995 2995 return 0; 2996 2996 } 2997 2997 2998 - int copy_siginfo_from_user32(struct siginfo *to, 2998 + int copy_siginfo_from_user32(struct kernel_siginfo *to, 2999 2999 const struct compat_siginfo __user *ufrom) 3000 3000 { 3001 3001 struct compat_siginfo from; ··· 3085 3085 * @info: if non-null, the signal's siginfo is returned here 3086 3086 * @ts: upper bound on process time suspension 3087 3087 */ 3088 - static int do_sigtimedwait(const sigset_t *which, siginfo_t *info, 3088 + static int do_sigtimedwait(const sigset_t *which, kernel_siginfo_t *info, 3089 3089 const struct timespec *ts) 3090 3090 { 3091 3091 ktime_t *to = NULL, timeout = KTIME_MAX; ··· 3149 3149 { 3150 3150 sigset_t these; 3151 3151 struct timespec ts; 3152 - siginfo_t info; 3152 + kernel_siginfo_t info; 3153 3153 int ret; 3154 3154 3155 3155 /* XXX: Don't preclude handling different sized sigset_t's. */ ··· 3181 3181 { 3182 3182 sigset_t s; 3183 3183 struct timespec t; 3184 - siginfo_t info; 3184 + kernel_siginfo_t info; 3185 3185 long ret; 3186 3186 3187 3187 if (sigsetsize != sizeof(sigset_t)) ··· 3213 3213 */ 3214 3214 SYSCALL_DEFINE2(kill, pid_t, pid, int, sig) 3215 3215 { 3216 - struct siginfo info; 3216 + struct kernel_siginfo info; 3217 3217 3218 3218 clear_siginfo(&info); 3219 3219 info.si_signo = sig; ··· 3226 3226 } 3227 3227 3228 3228 static int 3229 - do_send_specific(pid_t tgid, pid_t pid, int sig, struct siginfo *info) 3229 + do_send_specific(pid_t tgid, pid_t pid, int sig, struct kernel_siginfo *info) 3230 3230 { 3231 3231 struct task_struct *p; 3232 3232 int error = -ESRCH; ··· 3257 3257 3258 3258 static int do_tkill(pid_t tgid, pid_t pid, int sig) 3259 3259 { 3260 - struct siginfo info; 3260 + struct kernel_siginfo info; 3261 3261 3262 3262 clear_siginfo(&info); 3263 3263 info.si_signo = sig; ··· 3304 3304 return do_tkill(0, pid, sig); 3305 3305 } 3306 3306 3307 - static int do_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t *info) 3307 + static int do_rt_sigqueueinfo(pid_t pid, int sig, kernel_siginfo_t *info) 3308 3308 { 3309 3309 /* Not even root can pretend to send signals from the kernel. 3310 3310 * Nor can they impersonate a kill()/tgkill(), which adds source info. ··· 3329 3329 SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig, 3330 3330 siginfo_t __user *, uinfo) 3331 3331 { 3332 - siginfo_t info; 3332 + kernel_siginfo_t info; 3333 3333 int ret = copy_siginfo_from_user(&info, uinfo); 3334 3334 if (unlikely(ret)) 3335 3335 return ret; ··· 3342 3342 int, sig, 3343 3343 struct compat_siginfo __user *, uinfo) 3344 3344 { 3345 - siginfo_t info; 3345 + kernel_siginfo_t info; 3346 3346 int ret = copy_siginfo_from_user32(&info, uinfo); 3347 3347 if (unlikely(ret)) 3348 3348 return ret; ··· 3350 3350 } 3351 3351 #endif 3352 3352 3353 - static int do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info) 3353 + static int do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, kernel_siginfo_t *info) 3354 3354 { 3355 3355 /* This is only valid for single tasks */ 3356 3356 if (pid <= 0 || tgid <= 0) ··· 3372 3372 SYSCALL_DEFINE4(rt_tgsigqueueinfo, pid_t, tgid, pid_t, pid, int, sig, 3373 3373 siginfo_t __user *, uinfo) 3374 3374 { 3375 - siginfo_t info; 3375 + kernel_siginfo_t info; 3376 3376 int ret = copy_siginfo_from_user(&info, uinfo); 3377 3377 if (unlikely(ret)) 3378 3378 return ret; ··· 3386 3386 int, sig, 3387 3387 struct compat_siginfo __user *, uinfo) 3388 3388 { 3389 - siginfo_t info; 3389 + kernel_siginfo_t info; 3390 3390 int ret = copy_siginfo_from_user32(&info, uinfo); 3391 3391 if (unlikely(ret)) 3392 3392 return ret; ··· 3968 3968 return NULL; 3969 3969 } 3970 3970 3971 - void __init signals_init(void) 3971 + static inline void siginfo_buildtime_checks(void) 3972 3972 { 3973 3973 BUILD_BUG_ON(sizeof(struct siginfo) != SI_MAX_SIZE); 3974 + 3975 + /* Verify the offsets in the two siginfos match */ 3976 + #define CHECK_OFFSET(field) \ 3977 + BUILD_BUG_ON(offsetof(siginfo_t, field) != offsetof(kernel_siginfo_t, field)) 3978 + 3979 + /* kill */ 3980 + CHECK_OFFSET(si_pid); 3981 + CHECK_OFFSET(si_uid); 3982 + 3983 + /* timer */ 3984 + CHECK_OFFSET(si_tid); 3985 + CHECK_OFFSET(si_overrun); 3986 + CHECK_OFFSET(si_value); 3987 + 3988 + /* rt */ 3989 + CHECK_OFFSET(si_pid); 3990 + CHECK_OFFSET(si_uid); 3991 + CHECK_OFFSET(si_value); 3992 + 3993 + /* sigchld */ 3994 + CHECK_OFFSET(si_pid); 3995 + CHECK_OFFSET(si_uid); 3996 + CHECK_OFFSET(si_status); 3997 + CHECK_OFFSET(si_utime); 3998 + CHECK_OFFSET(si_stime); 3999 + 4000 + /* sigfault */ 4001 + CHECK_OFFSET(si_addr); 4002 + CHECK_OFFSET(si_addr_lsb); 4003 + CHECK_OFFSET(si_lower); 4004 + CHECK_OFFSET(si_upper); 4005 + CHECK_OFFSET(si_pkey); 4006 + 4007 + /* sigpoll */ 4008 + CHECK_OFFSET(si_band); 4009 + CHECK_OFFSET(si_fd); 4010 + 4011 + /* sigsys */ 4012 + CHECK_OFFSET(si_call_addr); 4013 + CHECK_OFFSET(si_syscall); 4014 + CHECK_OFFSET(si_arch); 4015 + #undef CHECK_OFFSET 4016 + } 4017 + 4018 + void __init signals_init(void) 4019 + { 4020 + siginfo_buildtime_checks(); 3974 4021 3975 4022 sigqueue_cachep = KMEM_CACHE(sigqueue, SLAB_PANIC); 3976 4023 }
+1 -1
kernel/time/posix-timers.c
··· 308 308 * To protect against the timer going away while the interrupt is queued, 309 309 * we require that the it_requeue_pending flag be set. 310 310 */ 311 - void posixtimer_rearm(struct siginfo *info) 311 + void posixtimer_rearm(struct kernel_siginfo *info) 312 312 { 313 313 struct k_itimer *timr; 314 314 unsigned long flags;
+1 -1
security/apparmor/lsm.c
··· 732 732 return error; 733 733 } 734 734 735 - static int apparmor_task_kill(struct task_struct *target, struct siginfo *info, 735 + static int apparmor_task_kill(struct task_struct *target, struct kernel_siginfo *info, 736 736 int sig, const struct cred *cred) 737 737 { 738 738 struct aa_label *cl, *tl;
+1 -1
security/security.c
··· 1147 1147 return call_int_hook(task_movememory, 0, p); 1148 1148 } 1149 1149 1150 - int security_task_kill(struct task_struct *p, struct siginfo *info, 1150 + int security_task_kill(struct task_struct *p, struct kernel_siginfo *info, 1151 1151 int sig, const struct cred *cred) 1152 1152 { 1153 1153 return call_int_hook(task_kill, 0, p, info, sig, cred);
+1 -1
security/selinux/hooks.c
··· 4186 4186 PROCESS__SETSCHED, NULL); 4187 4187 } 4188 4188 4189 - static int selinux_task_kill(struct task_struct *p, struct siginfo *info, 4189 + static int selinux_task_kill(struct task_struct *p, struct kernel_siginfo *info, 4190 4190 int sig, const struct cred *cred) 4191 4191 { 4192 4192 u32 secid;
+1 -1
security/smack/smack_lsm.c
··· 2251 2251 * Return 0 if write access is permitted 2252 2252 * 2253 2253 */ 2254 - static int smack_task_kill(struct task_struct *p, struct siginfo *info, 2254 + static int smack_task_kill(struct task_struct *p, struct kernel_siginfo *info, 2255 2255 int sig, const struct cred *cred) 2256 2256 { 2257 2257 struct smk_audit_info ad;