Mercurial > illumos > illumos-gate
changeset 3813:c7c433a53b1a
6213465 non-global zone's /dev directory has wrong group owner
6464301 zones service description should note its role in gentle zone shutdown
6483910 zonecfg 'info' missed to use a colon for 'device' property
6514423 getzoneid returns p0 when called during proc_exit
6518772 zcons could be fully lint clean
author | dp |
---|---|
date | Tue, 13 Mar 2007 17:46:12 -0700 |
parents | 07894abe087c |
children | 125bd6a8c9c0 |
files | usr/src/cmd/zoneadm/zones.xml usr/src/cmd/zoneadmd/vplat.c usr/src/cmd/zonecfg/zonecfg.c usr/src/uts/common/io/zcons.c usr/src/uts/common/os/exit.c usr/src/uts/intel/zcons/Makefile usr/src/uts/sparc/zcons/Makefile |
diffstat | 7 files changed, 60 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/zoneadm/zones.xml Tue Mar 13 17:01:48 2007 -0700 +++ b/usr/src/cmd/zoneadm/zones.xml Tue Mar 13 17:46:12 2007 -0700 @@ -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>
--- a/usr/src/cmd/zoneadmd/vplat.c Tue Mar 13 17:01:48 2007 -0700 +++ b/usr/src/cmd/zoneadmd/vplat.c Tue Mar 13 17:46:12 2007 -0700 @@ -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 @@ } 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 @@ 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 @@ zerror(zlogp, B_TRUE, "mkdirp of %s failed", path); return (-1); } + + (void) chown(path, userid, groupid); return (0); } @@ -1114,7 +1122,7 @@ } 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 @@ /* 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 @@ 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 @@ * 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 @@ 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); }
--- a/usr/src/cmd/zonecfg/zonecfg.c Tue Mar 13 17:01:48 2007 -0700 +++ b/usr/src/cmd/zonecfg/zonecfg.c Tue Mar 13 17:46:12 2007 -0700 @@ -4730,7 +4730,7 @@ 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); }
--- a/usr/src/uts/common/io/zcons.c Tue Mar 13 17:01:48 2007 -0700 +++ b/usr/src/uts/common/io/zcons.c Tue Mar 13 17:46:12 2007 -0700 @@ -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 @@ */ 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 @@ */ 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;
--- a/usr/src/uts/common/os/exit.c Tue Mar 13 17:01:48 2007 -0700 +++ b/usr/src/uts/common/os/exit.c Tue Mar 13 17:46:12 2007 -0700 @@ -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 @@ } /* - * 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 @@ } 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 @@ 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();
--- a/usr/src/uts/intel/zcons/Makefile Tue Mar 13 17:01:48 2007 -0700 +++ b/usr/src/uts/intel/zcons/Makefile Tue Mar 13 17:46:12 2007 -0700 @@ -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 @@ 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:
--- a/usr/src/uts/sparc/zcons/Makefile Tue Mar 13 17:01:48 2007 -0700 +++ b/usr/src/uts/sparc/zcons/Makefile Tue Mar 13 17:46:12 2007 -0700 @@ -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 @@ 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: