Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/mach When handling complex messages, uses mach_ms...



details:   https://anonhg.NetBSD.org/src/rev/333857b29a0e
branches:  trunk
changeset: 556165:333857b29a0e
user:      manu <manu%NetBSD.org@localhost>
date:      Mon Dec 08 12:02:24 2003 +0000

description:
When handling complex messages, uses mach_msg_type_descriptor_t until we
know what type a descriptor really is.

diffstat:

 sys/compat/mach/mach_message.c |  12 ++++++------
 sys/compat/mach/mach_message.h |   3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)

diffs (61 lines):

diff -r 3d5eb51e73a7 -r 333857b29a0e sys/compat/mach/mach_message.c
--- a/sys/compat/mach/mach_message.c    Mon Dec 08 11:20:35 2003 +0000
+++ b/sys/compat/mach/mach_message.c    Mon Dec 08 12:02:24 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_message.c,v 1.34 2003/12/07 23:44:14 manu Exp $ */
+/*     $NetBSD: mach_message.c,v 1.35 2003/12/08 12:02:24 manu Exp $ */
 
 /*-
  * Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mach_message.c,v 1.34 2003/12/07 23:44:14 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mach_message.c,v 1.35 2003/12/08 12:02:24 manu Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_compat_mach.h" /* For COMPAT_MACH in <sys/ktrace.h> */
@@ -829,13 +829,13 @@
         * Sanity check the descriptor count. 
         * Note that all descriptor types 
         * have the same size, hence it is
-        * safe to assume this is a port
-        * descriptor here.
+        * safe to not take the descriptor
+        * type into account here.
         */
        mcm = (struct mach_complex_msg *)mm->mm_msg;
        count = mcm->mcm_body.msgh_descriptor_count;
        begin = (u_long)mcm;
-       end = (u_long)&mcm->mcm_port_desc[count + 1];
+       end = (u_long)&mcm->mcm_desc[count + 1];
 
        if ((end - begin) > mm->mm_size) {
 #ifdef DEBUG_MACH
@@ -845,7 +845,7 @@
        }
 
        for (i = 0; i < count; i++) {
-               if (mcm->mcm_port_desc[i].type != MACH_MSG_PORT_DESCRIPTOR) {
+               if (mcm->mcm_desc[i].type != MACH_MSG_PORT_DESCRIPTOR) {
 #ifdef DEBUG_MACH
                        printf("OOL data in task to task message\n");
 #endif
diff -r 3d5eb51e73a7 -r 333857b29a0e sys/compat/mach/mach_message.h
--- a/sys/compat/mach/mach_message.h    Mon Dec 08 11:20:35 2003 +0000
+++ b/sys/compat/mach/mach_message.h    Mon Dec 08 12:02:24 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_message.h,v 1.20 2003/12/07 23:44:15 manu Exp $    */
+/*     $NetBSD: mach_message.h,v 1.21 2003/12/08 12:02:24 manu Exp $    */
 
 /*-
  * Copyright (c) 2001-2003 The NetBSD Foundation, Inc.
@@ -218,6 +218,7 @@
        mach_msg_header_t mcm_header;
        mach_msg_body_t mcm_body;
        union {
+               mach_msg_type_descriptor_t mcm_desc[1];
                mach_msg_port_descriptor_t mcm_port_desc[1];
                mach_msg_ool_ports_descriptor_t mcm_ool_port_desc[1];
                mach_msg_ool_descriptor_t mcm_ool_desc[1];



Home | Main Index | Thread Index | Old Index