Source-Changes-HG archive

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

[src/netbsd-6-1]: src/sys/compat/linux/arch Pull up following revision(s) (re...



details:   https://anonhg.NetBSD.org/src/rev/bfaad4e956e1
branches:  netbsd-6-1
changeset: 776098:bfaad4e956e1
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Nov 15 20:42:39 2015 +0000

description:
Pull up following revision(s) (requested by pgoyette in ticket #1335):
        sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
        sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
        sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited.  Found by
Robert Elz.
XXX Pullup to NetBSD-7, -6, -6-0, and -6-1

diffstat:

 sys/compat/linux/arch/arm/linux_ptrace.c     |  8 +++++---
 sys/compat/linux/arch/i386/linux_ptrace.c    |  8 +++++---
 sys/compat/linux/arch/powerpc/linux_ptrace.c |  8 +++++---
 3 files changed, 15 insertions(+), 9 deletions(-)

diffs (138 lines):

diff -r 631fec944913 -r bfaad4e956e1 sys/compat/linux/arch/arm/linux_ptrace.c
--- a/sys/compat/linux/arch/arm/linux_ptrace.c  Sun Nov 15 20:40:31 2015 +0000
+++ b/sys/compat/linux/arch/arm/linux_ptrace.c  Sun Nov 15 20:42:39 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_ptrace.c,v 1.16 2010/07/07 01:30:33 chs Exp $    */
+/*     $NetBSD: linux_ptrace.c,v 1.16.20.1 2015/11/15 20:42:39 bouyer Exp $    */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.16 2010/07/07 01:30:33 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.16.20.1 2015/11/15 20:42:39 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -140,7 +140,6 @@
                goto out;
        }
        mutex_enter(t->p_lock);
-       mutex_exit(proc_lock);
 
        /*
         * You cannot do what you want to the process if:
@@ -148,6 +147,7 @@
         */
        if (!ISSET(t->p_slflag, PSL_TRACED)) {
                mutex_exit(t->p_lock);
+               mutex_exit(proc_lock);
                error = EPERM;
                goto out;
        }
@@ -160,9 +160,11 @@
        if (ISSET(t->p_slflag, PSL_FSTRACE) || t->p_pptr != p ||
            t->p_stat != SSTOP || !t->p_waited) {
                mutex_exit(t->p_lock);
+               mutex_exit(proc_lock);
                error = EBUSY;
                goto out;
        }
+       mutex_exit(proc_lock);
        /* XXX: ptrace needs revamp for multi-threading support. */
        if (t->p_nlwps > 1) {
                mutex_exit(t->p_lock);
diff -r 631fec944913 -r bfaad4e956e1 sys/compat/linux/arch/i386/linux_ptrace.c
--- a/sys/compat/linux/arch/i386/linux_ptrace.c Sun Nov 15 20:40:31 2015 +0000
+++ b/sys/compat/linux/arch/i386/linux_ptrace.c Sun Nov 15 20:42:39 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_ptrace.c,v 1.26 2010/07/07 01:30:34 chs Exp $    */
+/*     $NetBSD: linux_ptrace.c,v 1.26.28.1 2015/11/15 20:42:39 bouyer Exp $    */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.26 2010/07/07 01:30:34 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.26.28.1 2015/11/15 20:42:39 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -184,7 +184,6 @@
                return ESRCH;
        }
        mutex_enter(t->p_lock);
-       mutex_exit(proc_lock);
 
        /*
         * You cannot do what you want to the process if:
@@ -192,6 +191,7 @@
         */
        if (!ISSET(t->p_slflag, PSL_TRACED)) {
                mutex_exit(t->p_lock);
+               mutex_exit(proc_lock);
                error = EPERM;
                goto out;
        }
@@ -204,9 +204,11 @@
        if (ISSET(t->p_slflag, PSL_FSTRACE) || t->p_pptr != p ||
            t->p_stat != SSTOP || !t->p_waited) {
                mutex_exit(t->p_lock);
+               mutex_exit(proc_lock);
                error = EBUSY;
                goto out;
        }
+       mutex_exit(proc_lock);
        /* XXX: ptrace needs revamp for multi-threading support. */
        if (t->p_nlwps > 1) {
                mutex_exit(t->p_lock);
diff -r 631fec944913 -r bfaad4e956e1 sys/compat/linux/arch/powerpc/linux_ptrace.c
--- a/sys/compat/linux/arch/powerpc/linux_ptrace.c      Sun Nov 15 20:40:31 2015 +0000
+++ b/sys/compat/linux/arch/powerpc/linux_ptrace.c      Sun Nov 15 20:42:39 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_ptrace.c,v 1.23 2010/07/01 02:38:28 rmind Exp $ */
+/*     $NetBSD: linux_ptrace.c,v 1.23.28.1 2015/11/15 20:42:39 bouyer Exp $ */
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.23 2010/07/01 02:38:28 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.23.28.1 2015/11/15 20:42:39 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -162,7 +162,6 @@
                return ESRCH;
        }
        mutex_enter(t->p_lock);
-       mutex_exit(proc_lock);
 
        /*
         * You cannot do what you want to the process if:
@@ -170,6 +169,7 @@
         */
        if (!ISSET(t->p_slflag, PSL_TRACED)) {
                mutex_exit(t->p_lock);
+               mutex_exit(proc_lock);
                error = EPERM;
                goto out;
        }
@@ -182,9 +182,11 @@
        if (ISSET(t->p_slflag, PSL_FSTRACE) || t->p_pptr != p ||
            t->p_stat != SSTOP || !t->p_waited) {
                mutex_exit(t->p_lock);
+               mutex_exit(proc_lock);
                error = EBUSY;
                goto out;
        }
+       mutex_exit(proc_lock);
        /* XXX: ptrace needs revamp for multi-threading support. */
        if (t->p_nlwps > 1) {
                mutex_exit(t->p_lock);



Home | Main Index | Thread Index | Old Index