ptrace: Use copy_siginfo in setsiginfo and getsiginfo
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 24 Jul 2017 20:08:16 +0000 (15:08 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Tue, 16 Jan 2018 18:48:30 +0000 (12:48 -0600)
Now that copy_siginfo copies all of the fields this is safe, safer (as
all of the bits are guaranteed to be copied), clearer, and less error
prone than using a structure copy.

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

index ec4365d..f3c82e2 100644 (file)
@@ -659,7 +659,7 @@ static int ptrace_getsiginfo(struct task_struct *child, siginfo_t *info)
        if (lock_task_sighand(child, &flags)) {
                error = -EINVAL;
                if (likely(child->last_siginfo != NULL)) {
-                       *info = *child->last_siginfo;
+                       copy_siginfo(info, child->last_siginfo);
                        error = 0;
                }
                unlock_task_sighand(child, &flags);
@@ -675,7 +675,7 @@ static int ptrace_setsiginfo(struct task_struct *child, const siginfo_t *info)
        if (lock_task_sighand(child, &flags)) {
                error = -EINVAL;
                if (likely(child->last_siginfo != NULL)) {
-                       *child->last_siginfo = *info;
+                       copy_siginfo(child->last_siginfo, info);
                        error = 0;
                }
                unlock_task_sighand(child, &flags);