aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/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/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/signal.h')
-rw-r--r--include/linux/signal.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/include/linux/signal.h b/include/linux/signal.h
index de94c159bfb0..70031b10b918 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -11,18 +11,19 @@ struct task_struct;
11/* for sysctl */ 11/* for sysctl */
12extern int print_fatal_signals; 12extern int print_fatal_signals;
13 13
14static inline void copy_siginfo(struct siginfo *to, const struct siginfo *from) 14static inline void copy_siginfo(kernel_siginfo_t *to,
15 const kernel_siginfo_t *from)
15{ 16{
16 memcpy(to, from, sizeof(*to)); 17 memcpy(to, from, sizeof(*to));
17} 18}
18 19
19static inline void clear_siginfo(struct siginfo *info) 20static inline void clear_siginfo(kernel_siginfo_t *info)
20{ 21{
21 memset(info, 0, sizeof(*info)); 22 memset(info, 0, sizeof(*info));
22} 23}
23 24
24int copy_siginfo_to_user(struct siginfo __user *to, const struct siginfo *from); 25int copy_siginfo_to_user(siginfo_t __user *to, const kernel_siginfo_t *from);
25int copy_siginfo_from_user(struct siginfo *to, const struct siginfo __user *from); 26int copy_siginfo_from_user(kernel_siginfo_t *to, const siginfo_t __user *from);
26 27
27enum siginfo_layout { 28enum siginfo_layout {
28 SIL_KILL, 29 SIL_KILL,
@@ -258,11 +259,11 @@ struct pt_regs;
258enum pid_type; 259enum pid_type;
259 260
260extern int next_signal(struct sigpending *pending, sigset_t *mask); 261extern int next_signal(struct sigpending *pending, sigset_t *mask);
261extern int do_send_sig_info(int sig, struct siginfo *info, 262extern int do_send_sig_info(int sig, struct kernel_siginfo *info,
262 struct task_struct *p, enum pid_type type); 263 struct task_struct *p, enum pid_type type);
263extern int group_send_sig_info(int sig, struct siginfo *info, 264extern int group_send_sig_info(int sig, struct kernel_siginfo *info,
264 struct task_struct *p, enum pid_type type); 265 struct task_struct *p, enum pid_type type);
265extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); 266extern int __group_send_sig_info(int, struct kernel_siginfo *, struct task_struct *);
266extern int sigprocmask(int, sigset_t *, sigset_t *); 267extern int sigprocmask(int, sigset_t *, sigset_t *);
267extern void set_current_blocked(sigset_t *); 268extern void set_current_blocked(sigset_t *);
268extern void __set_current_blocked(const sigset_t *); 269extern void __set_current_blocked(const sigset_t *);