summaryrefslogtreecommitdiffstats
path: root/kernel/ptrace.c
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 /kernel/ptrace.c
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 'kernel/ptrace.c')
-rw-r--r--kernel/ptrace.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index a807ff5cc1a9..c2cee9db5204 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -651,7 +651,7 @@ static int ptrace_setoptions(struct task_struct *child, unsigned long data)
651 return 0; 651 return 0;
652} 652}
653 653
654static int ptrace_getsiginfo(struct task_struct *child, siginfo_t *info) 654static int ptrace_getsiginfo(struct task_struct *child, kernel_siginfo_t *info)
655{ 655{
656 unsigned long flags; 656 unsigned long flags;
657 int error = -ESRCH; 657 int error = -ESRCH;
@@ -667,7 +667,7 @@ static int ptrace_getsiginfo(struct task_struct *child, siginfo_t *info)
667 return error; 667 return error;
668} 668}
669 669
670static int ptrace_setsiginfo(struct task_struct *child, const siginfo_t *info) 670static int ptrace_setsiginfo(struct task_struct *child, const kernel_siginfo_t *info)
671{ 671{
672 unsigned long flags; 672 unsigned long flags;
673 int error = -ESRCH; 673 int error = -ESRCH;
@@ -709,7 +709,7 @@ static int ptrace_peek_siginfo(struct task_struct *child,
709 pending = &child->pending; 709 pending = &child->pending;
710 710
711 for (i = 0; i < arg.nr; ) { 711 for (i = 0; i < arg.nr; ) {
712 siginfo_t info; 712 kernel_siginfo_t info;
713 s32 off = arg.off + i; 713 s32 off = arg.off + i;
714 714
715 spin_lock_irq(&child->sighand->siglock); 715 spin_lock_irq(&child->sighand->siglock);
@@ -885,7 +885,7 @@ int ptrace_request(struct task_struct *child, long request,
885{ 885{
886 bool seized = child->ptrace & PT_SEIZED; 886 bool seized = child->ptrace & PT_SEIZED;
887 int ret = -EIO; 887 int ret = -EIO;
888 siginfo_t siginfo, *si; 888 kernel_siginfo_t siginfo, *si;
889 void __user *datavp = (void __user *) data; 889 void __user *datavp = (void __user *) data;
890 unsigned long __user *datalp = datavp; 890 unsigned long __user *datalp = datavp;
891 unsigned long flags; 891 unsigned long flags;
@@ -1180,7 +1180,7 @@ int compat_ptrace_request(struct task_struct *child, compat_long_t request,
1180{ 1180{
1181 compat_ulong_t __user *datap = compat_ptr(data); 1181 compat_ulong_t __user *datap = compat_ptr(data);
1182 compat_ulong_t word; 1182 compat_ulong_t word;
1183 siginfo_t siginfo; 1183 kernel_siginfo_t siginfo;
1184 int ret; 1184 int ret;
1185 1185
1186 switch (request) { 1186 switch (request) {