Back out r210974. Any convenience of not typing "persist" is outweighed

by the possibility of unintended partially-formed jails.
This commit is contained in:
jamie 2010-08-08 23:22:55 +00:00
parent 7aa77c20cf
commit 4e0690ba81

View File

@ -599,8 +599,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
vfs_flagopt(opts, pr_flag_names[fi], &pr_flags, 1 << fi); vfs_flagopt(opts, pr_flag_names[fi], &pr_flags, 1 << fi);
vfs_flagopt(opts, pr_flag_nonames[fi], &ch_flags, 1 << fi); vfs_flagopt(opts, pr_flag_nonames[fi], &ch_flags, 1 << fi);
} }
if ((flags & (JAIL_CREATE | JAIL_UPDATE | JAIL_ATTACH)) == JAIL_CREATE)
pr_flags |= PR_PERSIST;
ch_flags |= pr_flags; ch_flags |= pr_flags;
for (fi = 0; fi < sizeof(pr_flag_jailsys) / sizeof(pr_flag_jailsys[0]); for (fi = 0; fi < sizeof(pr_flag_jailsys) / sizeof(pr_flag_jailsys[0]);
fi++) { fi++) {
@ -630,6 +628,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
ch_flags |= ch_flags |=
pr_flag_jailsys[fi].new | pr_flag_jailsys[fi].disable; pr_flag_jailsys[fi].new | pr_flag_jailsys[fi].disable;
} }
if ((flags & (JAIL_CREATE | JAIL_UPDATE | JAIL_ATTACH)) == JAIL_CREATE
&& !(pr_flags & PR_PERSIST)) {
error = EINVAL;
vfs_opterror(opts, "new jail must persist or attach");
goto done_errmsg;
}
#ifdef VIMAGE #ifdef VIMAGE
if ((flags & JAIL_UPDATE) && (ch_flags & PR_VNET)) { if ((flags & JAIL_UPDATE) && (ch_flags & PR_VNET)) {
error = EINVAL; error = EINVAL;