diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/zoneadm/zones.xml | 4 | ||||
-rw-r--r-- | usr/src/cmd/zoneadmd/vplat.c | 30 | ||||
-rw-r--r-- | usr/src/cmd/zonecfg/zonecfg.c | 2 | ||||
-rw-r--r-- | usr/src/uts/common/io/zcons.c | 11 | ||||
-rw-r--r-- | usr/src/uts/common/os/exit.c | 38 | ||||
-rw-r--r-- | usr/src/uts/intel/zcons/Makefile | 9 | ||||
-rw-r--r-- | usr/src/uts/sparc/zcons/Makefile | 10 |
7 files changed, 60 insertions, 44 deletions
diff --git a/usr/src/cmd/zoneadm/zones.xml b/usr/src/cmd/zoneadm/zones.xml index 87c91dbada..e14424ac26 100644 --- a/usr/src/cmd/zoneadm/zones.xml +++ b/usr/src/cmd/zoneadm/zones.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> <!-- - Copyright 2006 Sun Microsystems, Inc. All rights reserved. + Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. CDDL HEADER START @@ -85,7 +85,7 @@ <template> <common_name> <loctext xml:lang='C'> - Zones autoboot + Zones autoboot and graceful shutdown </loctext> </common_name> <documentation> diff --git a/usr/src/cmd/zoneadmd/vplat.c b/usr/src/cmd/zoneadmd/vplat.c index d20821e542..ac784b9d4c 100644 --- a/usr/src/cmd/zoneadmd/vplat.c +++ b/usr/src/cmd/zoneadmd/vplat.c @@ -128,6 +128,8 @@ /* 0755 is the default directory mode. */ #define DEFAULT_DIR_MODE \ (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) +#define DEFAULT_DIR_USER -1 /* user ID for chown: -1 means don't change */ +#define DEFAULT_DIR_GROUP -1 /* grp ID for chown: -1 means don't change */ #define IPD_DEFAULT_OPTS \ MNTOPT_RO "," MNTOPT_LOFS_NOSUB "," MNTOPT_NODEVICES @@ -417,7 +419,8 @@ check_lofs_needed(zlog_t *zlogp, struct zone_fstab *fsptr) } static int -make_one_dir(zlog_t *zlogp, const char *prefix, const char *subdir, mode_t mode) +make_one_dir(zlog_t *zlogp, const char *prefix, const char *subdir, mode_t mode, + uid_t userid, gid_t groupid) { char path[MAXPATHLEN]; struct stat st; @@ -455,7 +458,10 @@ make_one_dir(zlog_t *zlogp, const char *prefix, const char *subdir, mode_t mode) return (-1); } } - } else if (mkdirp(path, mode) != 0) { + return (0); + } + + if (mkdirp(path, mode) != 0) { if (errno == EROFS) zerror(zlogp, B_FALSE, "Could not mkdir %s.\nIt is on " "a read-only file system in this local zone.\nMake " @@ -464,6 +470,8 @@ make_one_dir(zlog_t *zlogp, const char *prefix, const char *subdir, mode_t mode) zerror(zlogp, B_TRUE, "mkdirp of %s failed", path); return (-1); } + + (void) chown(path, userid, groupid); return (0); } @@ -1114,7 +1122,7 @@ mount_one(zlog_t *zlogp, struct zone_fstab *fsptr, const char *rootpath) } if (make_one_dir(zlogp, rootpath, fsptr->zone_fs_dir, - DEFAULT_DIR_MODE) != 0) + DEFAULT_DIR_MODE, DEFAULT_DIR_USER, DEFAULT_DIR_GROUP) != 0) return (-1); (void) snprintf(path, sizeof (path), "%s%s", rootpath, @@ -3203,7 +3211,7 @@ tsol_mounts(zlog_t *zlogp, char *zone_name, char *rootpath) /* Make sure our zone has an /export/home dir */ (void) make_one_dir(zlogp, rootpath, "/export/home", - DEFAULT_DIR_MODE); + DEFAULT_DIR_MODE, DEFAULT_DIR_USER, DEFAULT_DIR_GROUP); lower_fstab.zone_fs_raw[0] = '\0'; (void) strlcpy(lower_fstab.zone_fs_type, MNTTYPE_LOFS, @@ -3313,7 +3321,8 @@ again: char optstr[] = "indirect,ignore,nobrowse"; (void) make_one_dir(zlogp, "", - autofs_fstab.zone_fs_dir, DEFAULT_DIR_MODE); + autofs_fstab.zone_fs_dir, DEFAULT_DIR_MODE, + DEFAULT_DIR_USER, DEFAULT_DIR_GROUP); /* * Mount will fail if automounter has already @@ -3381,8 +3390,9 @@ again: * Make sure the lower-level home exists */ if (make_one_dir(zlogp, - lower_fstab.zone_fs_special, - "/home", DEFAULT_DIR_MODE) != 0) + lower_fstab.zone_fs_special, "/home", + DEFAULT_DIR_MODE, DEFAULT_DIR_USER, + DEFAULT_DIR_GROUP) != 0) continue; (void) strlcat(lower_fstab.zone_fs_special, @@ -4240,9 +4250,11 @@ vplat_bringup(zlog_t *zlogp, boolean_t mount_cmd, zoneid_t zoneid) lofs_discard_mnttab(); return (-1); } - resolve_lofs(zlogp, zonepath, sizeof (zonepath)); - if (make_one_dir(zlogp, zonepath, "/dev", DEFAULT_DIR_MODE) != 0) { + + /* Make /dev directory owned by root, grouped sys */ + if (make_one_dir(zlogp, zonepath, "/dev", DEFAULT_DIR_MODE, + 0, 3) != 0) { lofs_discard_mnttab(); return (-1); } diff --git a/usr/src/cmd/zonecfg/zonecfg.c b/usr/src/cmd/zonecfg/zonecfg.c index ac5525604e..500e644a7a 100644 --- a/usr/src/cmd/zonecfg/zonecfg.c +++ b/usr/src/cmd/zonecfg/zonecfg.c @@ -4730,7 +4730,7 @@ info_net(zone_dochandle_t handle, FILE *fp, cmd_t *cmd) static void output_dev(FILE *fp, struct zone_devtab *devtab) { - (void) fprintf(fp, "%s\n", rt_to_str(RT_DEVICE)); + (void) fprintf(fp, "%s:\n", rt_to_str(RT_DEVICE)); output_prop(fp, PT_MATCH, devtab->zone_dev_match, B_TRUE); } diff --git a/usr/src/uts/common/io/zcons.c b/usr/src/uts/common/io/zcons.c index 9b768cce77..990aec1286 100644 --- a/usr/src/uts/common/io/zcons.c +++ b/usr/src/uts/common/io/zcons.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -378,7 +377,7 @@ zc_master_open(zc_state_t *zcs, */ mop->b_datap->db_type = M_SETOPTS; mop->b_wptr += sizeof (struct stroptions); - sop = (struct stroptions *)mop->b_rptr; + sop = (struct stroptions *)(void *)mop->b_rptr; if (oflag & FNOCTTY) sop->so_flags = SO_HIWAT | SO_LOWAT; else @@ -436,7 +435,7 @@ zc_slave_open(zc_state_t *zcs, */ mop->b_datap->db_type = M_SETOPTS; mop->b_wptr += sizeof (struct stroptions); - sop = (struct stroptions *)mop->b_rptr; + sop = (struct stroptions *)(void *)mop->b_rptr; sop->so_flags = SO_HIWAT | SO_LOWAT | SO_ISTTY; sop->so_hiwat = 512; sop->so_lowat = 256; diff --git a/usr/src/uts/common/os/exit.c b/usr/src/uts/common/os/exit.c index 5ceafd48af..790113d721 100644 --- a/usr/src/uts/common/os/exit.c +++ b/usr/src/uts/common/os/exit.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -777,11 +777,22 @@ proc_exit(int why, int what) } /* - * curthread's proc pointer is changed to point at p0 because - * curthread's original proc pointer can be freed as soon as - * the child sends a SIGCLD to its parent. + * curthread's proc pointer is changed to point to the 'sched' + * process for the corresponding zone, except in the case when + * the exiting process is in fact a zsched instance, in which + * case the proc pointer is set to p0. We do so, so that the + * process still points at the right zone when we call the VN_RELE() + * below. + * + * This is because curthread's original proc pointer can be freed as + * soon as the child sends a SIGCLD to its parent. We use zsched so + * that for user processes, even in the final moments of death, the + * process is still associated with its zone. */ - t->t_procp = &p0; + if (p != t->t_procp->p_zone->zone_zsched) + t->t_procp = t->t_procp->p_zone->zone_zsched; + else + t->t_procp = &p0; mutex_exit(&p->p_lock); if (!evaporate) { @@ -797,11 +808,6 @@ proc_exit(int why, int what) } mutex_exit(&pidlock); - task_rele(tk); - - kmem_free(lwpdir, lwpdir_sz * sizeof (lwpdir_t)); - kmem_free(tidhash, tidhash_sz * sizeof (lwpdir_t *)); - /* * We don't release u_cdir and u_rdir until SZOMB is set. * This protects us against dofusers(). @@ -812,6 +818,18 @@ proc_exit(int why, int what) if (cwd) refstr_rele(cwd); + /* + * task_rele() may ultimately cause the zone to go away (or + * may cause the last user process in a zone to go away, which + * signals zsched to go away). So prior to this call, we must + * no longer point at zsched. + */ + t->t_procp = &p0; + task_rele(tk); + + kmem_free(lwpdir, lwpdir_sz * sizeof (lwpdir_t)); + kmem_free(tidhash, tidhash_sz * sizeof (lwpdir_t *)); + lwp_pcb_exit(); thread_exit(); diff --git a/usr/src/uts/intel/zcons/Makefile b/usr/src/uts/intel/zcons/Makefile index 247039901f..df80cfe2c3 100644 --- a/usr/src/uts/intel/zcons/Makefile +++ b/usr/src/uts/intel/zcons/Makefile @@ -21,7 +21,7 @@ # # uts/intel/zcons/Makefile # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" @@ -57,13 +57,6 @@ LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # -# For now, disable these lint checks; maintainers should endeavor -# to investigate and remove these for maximum lint coverage. -# Please do not carry these forward to new Makefiles. -# -LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN - -# # Default build targets. # .KEEP_STATE: diff --git a/usr/src/uts/sparc/zcons/Makefile b/usr/src/uts/sparc/zcons/Makefile index 922fa4f4d0..5c2d629369 100644 --- a/usr/src/uts/sparc/zcons/Makefile +++ b/usr/src/uts/sparc/zcons/Makefile @@ -20,7 +20,8 @@ # # # uts/sparc/zcons/Makefile -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" @@ -61,13 +62,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CFLAGS += $(CCVERBOSE) # -# For now, disable these lint checks; maintainers should endeavor -# to investigate and remove these for maximum lint coverage. -# Please do not carry these forward to new Makefiles. -# -LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN - -# # Default build targets. # .KEEP_STATE: |