aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched/signal.h
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2018-09-25 05:27:20 -0400
committerEric W. Biederman <ebiederm@xmission.com>2018-10-03 10:47:43 -0400
commitae7795bc6187a15ec51cf258abae656a625f9980 (patch)
tree2456aa85c6b4be1ac58e272393056c0edbee038a /include/linux/sched/signal.h
parent4cd2e0e70af6897ca2247fa1ffb1553ca16b4903 (diff)
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>
Diffstat (limited to 'include/linux/sched/signal.h')
-rw-r--r--include/linux/sched/signal.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 9e07f3521549..13789d10a50e 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -270,12 +270,12 @@ static inline int signal_group_exit(const struct signal_struct *sig)
270extern void flush_signals(struct task_struct *); 270extern void flush_signals(struct task_struct *);
271extern void ignore_signals(struct task_struct *); 271extern void ignore_signals(struct task_struct *);
272extern void flush_signal_handlers(struct task_struct *, int force_default); 272extern void flush_signal_handlers(struct task_struct *, int force_default);
273extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info); 273extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, kernel_siginfo_t *info);
274 274
275static inline int kernel_dequeue_signal(void) 275static inline int kernel_dequeue_signal(void)
276{ 276{
277 struct task_struct *tsk = current; 277 struct task_struct *tsk = current;
278 siginfo_t __info; 278 kernel_siginfo_t __info;
279 int ret; 279 int ret;
280 280
281 spin_lock_irq(&tsk->sighand->siglock); 281 spin_lock_irq(&tsk->sighand->siglock);
@@ -322,12 +322,12 @@ int force_sig_pkuerr(void __user *addr, u32 pkey);
322 322
323int force_sig_ptrace_errno_trap(int errno, void __user *addr); 323int force_sig_ptrace_errno_trap(int errno, void __user *addr);
324 324
325extern int send_sig_info(int, struct siginfo *, struct task_struct *); 325extern int send_sig_info(int, struct kernel_siginfo *, struct task_struct *);
326extern void force_sigsegv(int sig, struct task_struct *p); 326extern void force_sigsegv(int sig, struct task_struct *p);
327extern int force_sig_info(int, struct siginfo *, struct task_struct *); 327extern int force_sig_info(int, struct kernel_siginfo *, struct task_struct *);
328extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp); 328extern int __kill_pgrp_info(int sig, struct kernel_siginfo *info, struct pid *pgrp);
329extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid); 329extern int kill_pid_info(int sig, struct kernel_siginfo *info, struct pid *pid);
330extern int kill_pid_info_as_cred(int, struct siginfo *, struct pid *, 330extern int kill_pid_info_as_cred(int, struct kernel_siginfo *, struct pid *,
331 const struct cred *); 331 const struct cred *);
332extern int kill_pgrp(struct pid *pid, int sig, int priv); 332extern int kill_pgrp(struct pid *pid, int sig, int priv);
333extern int kill_pid(struct pid *pid, int sig, int priv); 333extern int kill_pid(struct pid *pid, int sig, int priv);
@@ -475,8 +475,8 @@ static inline int kill_cad_pid(int sig, int priv)
475} 475}
476 476
477/* These can be the second arg to send_sig_info/send_group_sig_info. */ 477/* These can be the second arg to send_sig_info/send_group_sig_info. */
478#define SEND_SIG_NOINFO ((struct siginfo *) 0) 478#define SEND_SIG_NOINFO ((struct kernel_siginfo *) 0)
479#define SEND_SIG_PRIV ((struct siginfo *) 1) 479#define SEND_SIG_PRIV ((struct kernel_siginfo *) 1)
480 480
481/* 481/*
482 * True if we are on the alternate signal stack. 482 * True if we are on the alternate signal stack.