Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 May 2012 13:40:02 GMT
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   Re: ports/168191: sysutils/ezjail + freebsd9 -stable --&gt; dont work
Message-ID:  <201205221340.q4MDe27X081272@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/168191; it has been noted by GNATS.

From: Jamie Gritton <jamie@FreeBSD.org>
To: Dewayne <dewayne.geraghty@heuristicsystems.com.au>
Cc: bug-followup@FreeBSD.org, superbofh@gmail.com
Subject: Re: ports/168191: sysutils/ezjail + freebsd9 -stable --&gt; dont
 work
Date: Tue, 22 May 2012 07:38:56 -0600

 This is a multi-part message in MIME format.
 --------------000209040604050804070506
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 I'm including a recent patch for libjail I haven't checked in yet. Does
 that fix it?
 
 - Jamie
 
 
 On 05/22/12 03:12, Dewayne wrote:
 > I'm able to experience a similar failure when starting a jail subsystem
 > after a reboot.
 >
 > If you reverse the patch
 > http://lists.freebsd.org/pipermail/svn-src-stable-9/2012-May/001815.html
 > your jail functionality will return.
 >
 > That is:
 > 	Cut/paste the patch from
 > http://lists.freebsd.org/pipermail/svn-src-stable-9/2012-May/001815.html
 > into say j.diff
 > 	cd /usr/src/lib/libjail
 > 	patch jail.c j.diff
 > 	make; make install;
 > 	/usr/local/etc/rc.d/ezjail start # or restart
 >
 > For the benefit of the developer (Jamie).  I'm not technical so I couldn't
 > debug the code, however:
 > The error message after
 > 	. /usr/local/etc/ezjail/b1
 > 	sh -x /etc/rc.d/jail onestart b1
 > was
 > 	+ tail +2 /tmp/jail.43t9sZRC/jail.5444
 > 	jail: unknown parameter: allow.nomount
 >
 > These parameters were included and passed to a modified ezjail
 > 	export jail_b1_parameters="allow.sysvipc allow.raw_sockets"
 >
 > I've included these to demonstrate that I don't use, or pass the
 > allow.nomount parameter, and hope that it provides you a useful clue.
 >
 > Regards, Dewayne.
 >
 
 --------------000209040604050804070506
 Content-Type: text/plain;
  name="jail.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="jail.diff"
 
 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;
 
 --------------000209040604050804070506--



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