Print this page
7127  remove -Wno-missing-braces from Makefile.uts


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "%Z%%M% %I%     %E% SMI"
  27 
  28 #include <sys/types.h>
  29 #include <sys/vnode.h>
  30 #include <sys/vfs_opreg.h>
  31 #include <sys/door.h>
  32 #include <sys/proc.h>
  33 #include <sys/kmem.h>
  34 #include <sys/debug.h>
  35 #include <sys/cmn_err.h>
  36 #include <fs/fs_subr.h>
  37 #include <sys/zone.h>
  38 #include <sys/tsol/label.h>
  39 
  40 kmutex_t        door_knob;
  41 static int      door_open(struct vnode **vpp, int flag, struct cred *cr,
  42                         caller_context_t *ct);
  43 static int      door_close(struct vnode *vp, int flag, int count,
  44                         offset_t offset, struct cred *cr, caller_context_t *ct);
  45 static int      door_getattr(struct vnode *vp, struct vattr *vap,
  46                         int flags, struct cred *cr, caller_context_t *ct);
  47 static void     door_inactive(struct vnode *vp, struct cred *cr,
  48                         caller_context_t *ct);
  49 static int      door_access(struct vnode *vp, int mode, int flags,
  50                         struct cred *cr, caller_context_t *ct);
  51 static int      door_realvp(vnode_t *vp, vnode_t **vpp, caller_context_t *ct);
  52 
  53 struct vfs door_vfs;
  54 
  55 struct vnodeops *door_vnodeops;
  56 
  57 const fs_operation_def_t door_vnodeops_template[] = {
  58         VOPNAME_OPEN,           { .vop_open = door_open },
  59         VOPNAME_CLOSE,          { .vop_close = door_close },
  60         VOPNAME_GETATTR,        { .vop_getattr = door_getattr },
  61         VOPNAME_ACCESS,         { .vop_access = door_access },
  62         VOPNAME_INACTIVE,       { .vop_inactive = door_inactive },
  63         VOPNAME_FRLOCK,         { .error = fs_error },
  64         VOPNAME_REALVP,         { .vop_realvp = door_realvp },
  65         VOPNAME_POLL,           { .error = fs_error },
  66         VOPNAME_PATHCONF,       { .error = fs_error },
  67         VOPNAME_DISPOSE,        { .error = fs_error },
  68         VOPNAME_GETSECATTR,     { .error = fs_error },
  69         VOPNAME_SHRLOCK,        { .error = fs_error },
  70         NULL,                   NULL
  71 };
  72 
  73 /* ARGSUSED */
  74 static int
  75 door_open(struct vnode **vpp, int flag, struct cred *cr, caller_context_t *ct)
  76 {
  77         /*
  78          * MAC policy for doors.  Restrict cross-zone open()s so that only
  79          * door servers in the global zone can have clients from other zones.
  80          * For other zones, client must be within the same zone as server.
  81          */
  82         if (is_system_labeled()) {
  83                 zone_t          *server_zone, *client_zone;
  84                 door_node_t     *dp = VTOD((*vpp));
  85 
  86                 mutex_enter(&door_knob);
  87                 if (DOOR_INVALID(dp)) {
  88                         mutex_exit(&door_knob);
  89                         return (0);
  90                 }




   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 


  26 #include <sys/types.h>
  27 #include <sys/vnode.h>
  28 #include <sys/vfs_opreg.h>
  29 #include <sys/door.h>
  30 #include <sys/proc.h>
  31 #include <sys/kmem.h>
  32 #include <sys/debug.h>
  33 #include <sys/cmn_err.h>
  34 #include <fs/fs_subr.h>
  35 #include <sys/zone.h>
  36 #include <sys/tsol/label.h>
  37 
  38 kmutex_t        door_knob;
  39 static int      door_open(struct vnode **vpp, int flag, struct cred *cr,
  40                         caller_context_t *ct);
  41 static int      door_close(struct vnode *vp, int flag, int count,
  42                         offset_t offset, struct cred *cr, caller_context_t *ct);
  43 static int      door_getattr(struct vnode *vp, struct vattr *vap,
  44                         int flags, struct cred *cr, caller_context_t *ct);
  45 static void     door_inactive(struct vnode *vp, struct cred *cr,
  46                         caller_context_t *ct);
  47 static int      door_access(struct vnode *vp, int mode, int flags,
  48                         struct cred *cr, caller_context_t *ct);
  49 static int      door_realvp(vnode_t *vp, vnode_t **vpp, caller_context_t *ct);
  50 
  51 struct vfs door_vfs;
  52 
  53 struct vnodeops *door_vnodeops;
  54 
  55 const fs_operation_def_t door_vnodeops_template[] = {
  56         { VOPNAME_OPEN,         { .vop_open = door_open } },
  57         { VOPNAME_CLOSE,        { .vop_close = door_close } },
  58         { VOPNAME_GETATTR,      { .vop_getattr = door_getattr } },
  59         { VOPNAME_ACCESS,       { .vop_access = door_access } },
  60         { VOPNAME_INACTIVE,     { .vop_inactive = door_inactive } },
  61         { VOPNAME_FRLOCK,       { .error = fs_error } },
  62         { VOPNAME_REALVP,       { .vop_realvp = door_realvp } },
  63         { VOPNAME_POLL,         { .error = fs_error } },
  64         { VOPNAME_PATHCONF,     { .error = fs_error } },
  65         { VOPNAME_DISPOSE,      { .error = fs_error } },
  66         { VOPNAME_GETSECATTR,   { .error = fs_error } },
  67         { VOPNAME_SHRLOCK,      { .error = fs_error } },
  68         { NULL,                 { NULL } }
  69 };
  70 
  71 /* ARGSUSED */
  72 static int
  73 door_open(struct vnode **vpp, int flag, struct cred *cr, caller_context_t *ct)
  74 {
  75         /*
  76          * MAC policy for doors.  Restrict cross-zone open()s so that only
  77          * door servers in the global zone can have clients from other zones.
  78          * For other zones, client must be within the same zone as server.
  79          */
  80         if (is_system_labeled()) {
  81                 zone_t          *server_zone, *client_zone;
  82                 door_node_t     *dp = VTOD((*vpp));
  83 
  84                 mutex_enter(&door_knob);
  85                 if (DOOR_INVALID(dp)) {
  86                         mutex_exit(&door_knob);
  87                         return (0);
  88                 }