Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 May 2012 15:09:33 -0600
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        freebsd-jail@FreeBSD.org
Subject:   Re: Breakage on 9
Message-ID:  <4FBAAF0D.4000202@FreeBSD.org>
In-Reply-To: <4FBA8859.1040604@schimke.net>
References:  <CAJOYFBAphvs-M7wR=SeYLS_dWCAv0gPR-oTMz4R-MDtTrdO6Zw@mail.gmail.com> <4FBA8859.1040604@schimke.net>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
I've got a fix that's going in as soon as it's confirmed. I'm including
the patch here. Backing out r235624 will work, unless you happen to be
on a box where r235624 was necessary.

I had said something before about the long MFC, but that turned out to
be wrong. That was for the new jail(8) code, but the nomount fix is in
the libjail code. Actually, that was fixed a while back, but then I
re-broke it (in a different way) with r235624.

If anyone continues to have problems on 9 with the included patch, let
me know. But I think this will bring it all into working order.

- Jamie

On 05/21/12 12:24, Nathan Schimke wrote:
> On 05/21/2012 11:08 AM, Ed Schouten wrote:
>> Hi,
>>
>> Today I was bitten by the "jail: unknown parameter: allow.nomount"
>> bug. It seems this bug is at least more than one month old -- on
>> 9-STABLE! Why hasn't the commit that introduced this bug been backed
>> out? The code worked before. Now it's broken and we're waiting for an
>> MFC period? Using a Danish (Dutch?) axe, I was able to at least get my
>> box working again:
>
> I just hit the same error last night. Reverting r235624 (an MFC made 3
> days ago) got my jails working again, but I haven't yet figured out why.
>
> Nathan
> _______________________________________________
> freebsd-jail@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-jail
> To unsubscribe, send any mail to "freebsd-jail-unsubscribe@freebsd.org"

[-- Attachment #2 --]
Index: jail.c
===================================================================
--- jail.c	(revision 235668)
+++ jail.c	(working copy)
@@ -853,7 +853,7 @@
 static int
 jailparam_type(struct jailparam *jp)
 {
-	char *p, *nname;
+	char *p, *name, *nname;
 	size_t miblen, desclen;
 	int i, isarray;
 	struct {
@@ -863,7 +863,8 @@
 	int mib[CTL_MAXNAME];
 
 	/* The "lastjid" parameter isn't real. */
-	if (!strcmp(jp->jp_name, "lastjid")) {
+	name = jp->jp_name;
+	if (!strcmp(name, "lastjid")) {
 		jp->jp_valuelen = sizeof(int);
 		jp->jp_ctltype = CTLTYPE_INT | CTLFLAG_WR;
 		return (0);
@@ -872,19 +873,19 @@
 	/* Find the sysctl that describes the parameter. */
 	mib[0] = 0;
 	mib[1] = 3;
-	snprintf(desc.s, sizeof(desc.s), SJPARAM ".%s", jp->jp_name);
+	snprintf(desc.s, sizeof(desc.s), SJPARAM ".%s", name);
 	miblen = sizeof(mib) - 2 * sizeof(int);
 	if (sysctl(mib, 2, mib + 2, &miblen, desc.s, strlen(desc.s)) < 0) {
 		if (errno != ENOENT) {
 			snprintf(jail_errmsg, JAIL_ERRMSGLEN,
-			    "sysctl(0.3.%s): %s", jp->jp_name, strerror(errno));
+			    "sysctl(0.3.%s): %s", name, strerror(errno));
 			return (-1);
 		}
 		/*
 		 * The parameter probably doesn't exist.  But it might be
 		 * the "no" counterpart to a boolean.
 		 */
-		nname = nononame(jp->jp_name);
+		nname = nononame(name);
 		if (nname == NULL) {
 		unknown_parameter:
 			snprintf(jail_errmsg, JAIL_ERRMSGLEN,
@@ -892,8 +893,10 @@
 			errno = ENOENT;
 			return (-1);
 		}
-		snprintf(desc.s, sizeof(desc.s), SJPARAM ".%s", nname);
+		name = alloca(strlen(nname) + 1);
+		strcpy(name, nname);
 		free(nname);
+		snprintf(desc.s, sizeof(desc.s), SJPARAM ".%s", name);
 		miblen = sizeof(mib) - 2 * sizeof(int);
 		if (sysctl(mib, 2, mib + 2, &miblen, desc.s,
 		    strlen(desc.s)) < 0)
@@ -906,7 +909,7 @@
 	if (sysctl(mib, (miblen / sizeof(int)) + 2, &desc, &desclen,
 	    NULL, 0) < 0) {
 		snprintf(jail_errmsg, JAIL_ERRMSGLEN,
-		    "sysctl(0.4.%s): %s", jp->jp_name, strerror(errno));
+		    "sysctl(0.4.%s): %s", name, strerror(errno));
 		return (-1);
 	}
 	jp->jp_ctltype = desc.i;
@@ -952,7 +955,7 @@
 		if (sysctl(mib + 2, miblen / sizeof(int), desc.s, &desclen,
 		    NULL, 0) < 0) {
 			snprintf(jail_errmsg, JAIL_ERRMSGLEN,
-			    "sysctl(" SJPARAM ".%s): %s", jp->jp_name,
+			    "sysctl(" SJPARAM ".%s): %s", name,
 			    strerror(errno));
 			return (-1);
 		}
@@ -970,7 +973,7 @@
 			if (sysctl(mib + 2, miblen / sizeof(int),
 			    NULL, &jp->jp_valuelen, NULL, 0) < 0) {
 				snprintf(jail_errmsg, JAIL_ERRMSGLEN,
-				    "sysctl(" SJPARAM ".%s): %s", jp->jp_name,
+				    "sysctl(" SJPARAM ".%s): %s", name,
 				    strerror(errno));
 				return (-1);
 			}
@@ -995,10 +998,9 @@
 				    "sysctl(0.1): %s", strerror(errno));
 				return (-1);
 			}
-			if (desclen ==
-			    sizeof(SJPARAM) + strlen(jp->jp_name) + 2 &&
+			if (desclen == sizeof(SJPARAM) + strlen(name) + 2 &&
 			    memcmp(SJPARAM ".", desc.s, sizeof(SJPARAM)) == 0 &&
-			    memcmp(jp->jp_name, desc.s + sizeof(SJPARAM),
+			    memcmp(name, desc.s + sizeof(SJPARAM),
 			    desclen - sizeof(SJPARAM) - 2) == 0 &&
 			    desc.s[desclen - 2] == '.')
 				goto mib_desc;
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FBAAF0D.4000202>