Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Jul 2005 21:51:41 +0900 (JST)
From:      Yoshisato YANAGISAWA <osho@pcc-software.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/83602: net/mpd causes segmentation fault with amd64 architecture.
Message-ID:  <20050717125141.CCACA7E81A@ai.pcc-software.org>
Resent-Message-ID: <200507171300.j6HD0OJc016536@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         83602
>Category:       ports
>Synopsis:       net/mpd causes segmentation fault with amd64 architecture.
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 17 13:00:24 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Yoshisato YANAGISAWA
>Release:        FreeBSD 6.0-BETA1 amd64
>Organization:
PCC-Software.ORG
>Environment:
System: FreeBSD ai.pcc-software.org 6.0-BETA1 FreeBSD 6.0-BETA1 #0: Sun Jul 17 13:40:08 JST 2005 osho@ai.pcc-software.org:/usr/obj/usr/src/sys/AI amd64


>Description:
	Mpd, a famous program to realize kernel-level PPP(oE) connection,
	stops with segmentation fault when used on an amd64 architecture
	machine.  This segmentation fault is caused by misuse of va_list
	mechanism.
>How-To-Repeat:
	Just install net/mpd-3.18 from ports collection and run it on an
	amd64 architecture machine.
>Fix:
	Use following patches (archived with shar).
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	files/patch-src::custom.c
#	files/patch-src::log.c
#	files/patch-src::modem.c
#
echo x - files/patch-src::custom.c
sed 's/^X//' >files/patch-src::custom.c << 'END-of-files/patch-src::custom.c'
X--- src/custom.c.orig	Sun Jul 17 19:48:59 2005
X+++ src/custom.c	Sun Jul 17 19:49:27 2005
X@@ -141,16 +141,19 @@
X   if (!bund)
X     return;
X 
X-  va_start(args, fmt);
X   if (l == NULL) {
X     for (k = 0; k < bund->n_links; k++) {
X-      if (bund && bund->links[k])
X+      if (bund && bund->links[k]) {
X+	va_start(args, fmt);
X 	RecordLinkUpDownReason2(bund->links[k], up, key, fmt, args);
X+	va_end(args);
X+      }
X     }
X   } else {
X+    va_start(args, fmt);
X     RecordLinkUpDownReason2(l, up, key, fmt, args);
X+    va_end(args);
X   }
X-  va_end(args);
X }
X 
X static void
END-of-files/patch-src::custom.c
echo x - files/patch-src::log.c
sed 's/^X//' >files/patch-src::log.c << 'END-of-files/patch-src::log.c'
X--- src/log.c.orig	Sun Jul 17 19:48:59 2005
X+++ src/log.c		Sun Jul 17 19:49:27 2005
X@@ -265,17 +265,21 @@
X {
X   va_list	args;
X 
X-  va_start(args, fmt);
X   LogTimeStamp(logprintf);
X+  va_start(args, fmt);
X   vlogprintf(fmt, args);
X+  va_end(args);
X+  va_start(args, fmt);
X   vlogprintf("\n", args);		/* XXX args will be ignored */
X+  va_end(args);
X   if (gLogOptions & LG_CONSOLE)
X   {
X+    va_start(args, fmt);
X     vfprintf(stdout, fmt, args);
X+    va_end(args);
X     putc('\n', stdout);
X     fflush(stdout);
X   }
X-  va_end(args);
X }
X 
X /*
X@@ -315,12 +319,16 @@
X 
X /* Dump it */
X 
X-  va_start(ap, fmt);
X-  if (console)
X+  if (console) {
X+    va_start(ap, fmt);
X     LogDoDumpBp(printf, vprintf, FALSE, bp, fmt, ap);
X-  if (log)
X+    va_end(ap);
X+  }
X+  if (log) {
X+    va_start(ap, fmt);
X     LogDoDumpBp(logprintf, vlogprintf, TRUE, bp, fmt, ap);
X-  va_end(ap);
X+    va_end(ap);
X+  }
X }
X 
X /*
X@@ -342,11 +350,16 @@
X 
X /* Dump it */
X 
X-  va_start(ap, fmt);
X-  if (console)
X+  if (console) {
X+    va_start(ap, fmt);
X     LogDoDumpBuf(printf, vprintf, FALSE, buf, count, fmt, ap);
X-  if (log)
X+    va_end(ap);
X+  }
X+  if (log) {
X+    va_start(ap, fmt);
X     LogDoDumpBuf(logprintf, vlogprintf, TRUE, buf, count, fmt, ap);
X+    va_end(ap);
X+  }
X }
X 
X /*
END-of-files/patch-src::log.c
echo x - files/patch-src::modem.c
sed 's/^X//' >files/patch-src::modem.c << 'END-of-files/patch-src::modem.c'
X--- src/modem.c.orig	Sun Jul 17 19:48:59 2005
X+++ src/modem.c		Sun Jul 17 19:49:27 2005
X@@ -610,10 +610,12 @@
X   /* Concat prefix and message */
X   va_start(args, fmt);
X   vsnprintf(buf, sizeof(buf), fmt, args);
X+  va_end(args);
X   if (*buf != ' ')
X     snprintf(buf, sizeof(buf), "[%s] chat: ", lnk->name);
X   else
X     *buf = '\0';
X+  va_start(args, fmt);
X   vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), fmt, args);
X   va_end(args);
X 
END-of-files/patch-src::modem.c
exit

	Note:
	Those patches are released by James R. Van Artsalen at:
	http://lists.freebsd.org/pipermail/freebsd-amd64/2004-December/003094.html
	However, we need the patches above until new mpd, which include them,
	is released.

>Release-Note:
>Audit-Trail:
>Unformatted:



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