Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/arch/i386/i386 Pull up following revision(s) (request...



details:   https://anonhg.NetBSD.org/src/rev/b70ee51abbc6
branches:  netbsd-9
changeset: 458136:b70ee51abbc6
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Aug 06 16:20:19 2019 +0000

description:
Pull up following revision(s) (requested by kamil in ticket #21):

        sys/arch/i386/i386/process_machdep.c: revision 1.94

Do not dereference user pointer in ptrace_machdep_dorequest()/i386
Always use copyin(9) for reading user memory.

diffstat:

 sys/arch/i386/i386/process_machdep.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (44 lines):

diff -r 7f876775c59b -r b70ee51abbc6 sys/arch/i386/i386/process_machdep.c
--- a/sys/arch/i386/i386/process_machdep.c      Tue Aug 06 16:16:55 2019 +0000
+++ b/sys/arch/i386/i386/process_machdep.c      Tue Aug 06 16:20:19 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: process_machdep.c,v 1.93 2019/06/26 12:30:12 mgorny Exp $      */
+/*     $NetBSD: process_machdep.c,v 1.93.2.1 2019/08/06 16:20:19 martin Exp $  */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.93 2019/06/26 12:30:12 mgorny Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.93.2.1 2019/08/06 16:20:19 martin Exp $");
 
 #include "opt_ptrace.h"
 
@@ -281,7 +281,7 @@
 {
        struct uio uio;
        struct iovec iov;
-       struct iovec *user_iov = (struct iovec*)addr;
+       struct iovec user_iov;
        struct vmspace *vm;
        int error;
        int write = 0;
@@ -319,12 +319,14 @@
                /* write = 0 done above. */
                if (!process_machdep_validxstate(lt->l_proc))
                        return EINVAL;
+               if ((error = copyin(addr, &user_iov, sizeof(user_iov))) != 0)
+                       return error;
                error = proc_vmspace_getref(l->l_proc, &vm);
                if (error) {
                        return error;
                }
-               iov.iov_base = user_iov->iov_base;
-               iov.iov_len = user_iov->iov_len;
+               iov.iov_base = user_iov.iov_base;
+               iov.iov_len = user_iov.iov_len;
                if (iov.iov_len > sizeof(struct xstate))
                        iov.iov_len = sizeof(struct xstate);
                uio.uio_iov = &iov;



Home | Main Index | Thread Index | Old Index