PERFORCE change 32244 for review

Marcel Moolenaar marcel at FreeBSD.org
Sat May 31 17:05:42 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=32244

Change 32244 by marcel at marcel_nfs on 2003/05/31 17:05:33

	IFC @32243

Affected files ...

.. //depot/projects/ia64/sys/amd64/amd64/amd64-gdbstub.c#2 integrate
.. //depot/projects/ia64/sys/amd64/amd64/db_trace.c#2 integrate
.. //depot/projects/ia64/sys/amd64/amd64/nexus.c#4 integrate
.. //depot/projects/ia64/sys/kern/sysv_ipc.c#6 integrate

Differences ...

==== //depot/projects/ia64/sys/amd64/amd64/amd64-gdbstub.c#2 (text+ko) ====

@@ -92,7 +92,7 @@
  *
  ****************************************************************************/
 
-/* $FreeBSD: src/sys/amd64/amd64/amd64-gdbstub.c,v 1.23 2003/05/30 01:02:52 peter Exp $ */
+/* $FreeBSD: src/sys/amd64/amd64/amd64-gdbstub.c,v 1.24 2003/05/31 22:00:57 peter Exp $ */
 
 #include <sys/param.h>
 #include <sys/reboot.h>
@@ -120,11 +120,8 @@
    nasty interactions between app code and the stub (for instance if user steps
    into strlen, etc..) */
 
-#define strlen	gdb_strlen
-#define strcpy	gdb_strcpy
-
 static int
-strlen (const char *s)
+gdb_strlen (const char *s)
 {
   const char *s1 = s;
 
@@ -134,7 +131,7 @@
 }
 
 static char *
-strcpy (char *dst, const char *src)
+gdb_strcpy (char *dst, const char *src)
 {
   char *retval = dst;
 
@@ -223,7 +220,7 @@
 
 		  /* remove sequence chars from buffer */
 
-		  count = strlen (buffer);
+		  count = gdb_strlen (buffer);
 		  for (i=3; i <= count; i++)
 		    buffer[i-3] = buffer[i];
 		}
@@ -512,7 +509,7 @@
 
 	case 'G':		/* set the value of the CPU registers - return OK */
 	  hex2mem (&remcomInBuffer[1], (vm_offset_t)&registers, NUMREGBYTES);
-	  strcpy (remcomOutBuffer, "OK");
+	  gdb_strcpy (remcomOutBuffer, "OK");
 	  break;
 
 	case 'P':		/* Set the value of one register */
@@ -526,10 +523,10 @@
 		&& regno < NUM_REGS)
 	      {
 		hex2mem (ptr, (vm_offset_t)&registers + regno * 4, 4);
-		strcpy(remcomOutBuffer,"OK");
+		gdb_strcpy(remcomOutBuffer,"OK");
 	      }
 	    else
-	      strcpy (remcomOutBuffer, "P01");
+	      gdb_strcpy (remcomOutBuffer, "P01");
 	    break;
 	  }
 	case 'm':	/* mAA..AA,LLLL  Read LLLL bytes at address AA..AA */
@@ -542,11 +539,11 @@
 	      && hexToInt (&ptr, &length))
 	    {
 	      if (mem2hex((vm_offset_t) addr, remcomOutBuffer, length) == NULL)
-		strcpy (remcomOutBuffer, "E03");
+		gdb_strcpy (remcomOutBuffer, "E03");
 	      break;
 	    }
 	  else
-	    strcpy (remcomOutBuffer, "E01");
+	    gdb_strcpy (remcomOutBuffer, "E01");
 	  break;
 
 	case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
@@ -561,12 +558,12 @@
 	      && *(ptr++) == ':')
 	    {
 	      if (hex2mem(ptr, (vm_offset_t) addr, length) == NULL)
-		strcpy (remcomOutBuffer, "E03");
+		gdb_strcpy (remcomOutBuffer, "E03");
 	      else
-		strcpy (remcomOutBuffer, "OK");
+		gdb_strcpy (remcomOutBuffer, "OK");
 	    }
 	  else
-	    strcpy (remcomOutBuffer, "E02");
+	    gdb_strcpy (remcomOutBuffer, "E02");
 	  break;
 
 	  /* cAA..AA    Continue at address AA..AA(optional) */

==== //depot/projects/ia64/sys/amd64/amd64/db_trace.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * any improvements or extensions that they make and grant Carnegie the
  * rights to redistribute these changes.
  *
- * $FreeBSD: src/sys/amd64/amd64/db_trace.c,v 1.56 2003/05/30 01:01:07 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/db_trace.c,v 1.57 2003/05/31 22:02:11 peter Exp $
  */
 
 #include <sys/param.h>
@@ -567,7 +567,7 @@
 	case DBREG_DR7_WRONLY:
 	case DBREG_DR7_RDWR:
 		break;
-	default : return (-1); break;
+	default : return (-1);
 	}
 	
 	/*
@@ -577,7 +577,7 @@
 	case 1	: mask = 0x00; break;
 	case 2	: mask = 0x01 << 2; break;
 	case 4	: mask = 0x03 << 2; break;
-	default : return (-1); break;
+	default : return (-1);
 	}
 
 	mask |= access;

==== //depot/projects/ia64/sys/amd64/amd64/nexus.c#4 (text+ko) ====

@@ -26,7 +26,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.52 2003/05/23 05:04:53 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.53 2003/05/31 21:58:55 peter Exp $
  */
 
 /*
@@ -411,7 +411,6 @@
 nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
 		 int flags, void (*ihand)(void *), void *arg, void **cookiep)
 {
-	driver_t	*driver;
 	int		error;
 
 	/* somebody tried to setup an irq that failed to allocate! */
@@ -422,8 +421,6 @@
 	if ((irq->r_flags & RF_SHAREABLE) == 0)
 		flags |= INTR_EXCL;
 
-	driver = device_get_driver(child);
-
 	/*
 	 * We depend here on rman_activate_resource() being idempotent.
 	 */

==== //depot/projects/ia64/sys/kern/sysv_ipc.c#6 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/kern/sysv_ipc.c,v 1.24 2003/01/13 23:04:31 dillon Exp $ */
+/* $FreeBSD: src/sys/kern/sysv_ipc.c,v 1.26 2003/05/31 23:31:51 rwatson Exp $ */
 /*	$NetBSD: sysv_ipc.c,v 1.7 1994/06/29 06:33:11 cgd Exp $	*/
 
 /*
@@ -76,21 +76,41 @@
 	int mode;
 {
 	struct ucred *cred = td->td_ucred;
+	int error;
 
-	/* Check for user match. */
 	if (cred->cr_uid != perm->cuid && cred->cr_uid != perm->uid) {
-		if (mode & IPC_M)
-			return (suser(td) == 0 ? 0 : EPERM);
-		/* Check for group match. */
+		/*
+		 * For a non-create/owner, we require privilege to
+		 * modify the object protections.  Note: some other
+		 * implementations permit IPC_M to be delegated to
+		 * unprivileged non-creator/owner uids/gids.
+		 */
+		if (mode & IPC_M) {
+			error = suser(td);
+			if (error)
+				return (error);
+		}
+		/*
+		 * Try to match against creator/owner group; if not, fall
+		 * back on other.
+		 */
 		mode >>= 3;
 		if (!groupmember(perm->gid, cred) &&
 		    !groupmember(perm->cgid, cred))
-			/* Check for `other' match. */
 			mode >>= 3;
+	} else {
+		/*
+		 * Always permit the creator/owner to update the object
+		 * protections regardless of whether the object mode
+		 * permits it.
+		 */
+		if (mode & IPC_M)
+			return (0);
 	}
 
-	if (mode & IPC_M)
-		return (0);
-	return ((mode & perm->mode) == mode ||
-	    suser(td) == 0 ? 0 : EACCES);
+	if ((mode & perm->mode) != mode) {
+		if (suser(td) != 0)
+			return (EACCES);
+	}
+	return (0);
 }


More information about the p4-projects mailing list