Date: Fri, 3 Nov 2006 05:22:24 +0900 (JST) From: Yoshisato YANAGISAWA <osho@pcc-software.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/105085: net/mpd4 4.0b5 causes segmentation fault with amd64 architecture. Message-ID: <20061102202224.46B2C7E81C@ai.pcc-software.org> Resent-Message-ID: <200611022030.kA2KUK8p081016@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 105085 >Category: ports >Synopsis: net/mpd4 4.0b5 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: Thu Nov 02 20:30:20 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Yoshisato YANAGISAWA >Release: FreeBSD 6.1-RELEASE-p9 amd64 >Organization: PCC-Software.ORG >Environment: System: FreeBSD ai.pcc-software.org 6.1-RELEASE-p9 FreeBSD 6.1-RELEASE-p9 #18: Sat Sep 30 04:29:34 JST 2006 osho@ai.pcc-software.org:/usr/obj/usr/src/sys/AI amd64 >Description: mpd4, which is a program to establish kernel-PPP(oE) connection, stops with segmentation fault when used on an amd64 architecture. This segmentation fault might be caused by some misbehaviour of va_list functions. >How-To-Repeat: Install port net/mpd4 on amd64 machine and run it. >Fix: Since this problem potentially occurs any program which run on amd64, libc developers should fix it. I wrote a workaround patch to use va_list only inside the same function to avoid this problem: diff -ruN mpd4.bak/Makefile mpd4/Makefile --- mpd4.bak/Makefile Fri Nov 3 05:05:43 2006 +++ mpd4/Makefile Fri Nov 3 05:07:14 2006 @@ -7,6 +7,7 @@ PORTNAME= mpd4 PORTVERSION= 4.0b5 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_LOCAL} MASTER_SITE_SUBDIR= glebius diff -ruN mpd4.bak/files/patch-src::log.c mpd4/files/patch-src::log.c --- mpd4.bak/files/patch-src::log.c Thu Jan 1 09:00:00 1970 +++ mpd4/files/patch-src::log.c Fri Nov 3 05:05:57 2006 @@ -0,0 +1,91 @@ +--- src/log.c.bak Mon Oct 30 06:47:07 2006 ++++ src/log.c Fri Nov 3 05:03:19 2006 +@@ -158,6 +158,7 @@ + #else + #define LogTimeStamp(c) do{}while(0) + #endif ++static void LogString(const char *buf); + + /* + * LogOpen() +@@ -275,21 +276,24 @@ + LogPrintf(const char *fmt, ...) + { + va_list args; ++ char buf[MAX_CONSOLE_BUF_LEN]; ++ ++ LogTimeStamp(logprintf); + + va_start(args, fmt); +- vLogPrintf(fmt, args); ++ vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); +-} + +-void +-vLogPrintf(const char *fmt, va_list args) +-{ +- char buf[MAX_CONSOLE_BUF_LEN]; +- +- LogTimeStamp(logprintf); ++ va_start(args, fmt); + valog(LOG_INFO, fmt, args); +- vsnprintf(buf, sizeof(buf), fmt, args); ++ va_end(args); + ++ LogString(buf); ++} ++ ++static void ++LogString(const char *buf) ++{ + if (!gBackground) + { + fputs(buf, stdout); +@@ -345,6 +349,7 @@ + { + int k, total; + u_char bytes[DUMP_BYTES_PER_LINE]; ++ char buf[MAX_CONSOLE_BUF_LEN]; + char line[256]; + int linelen; + va_list ap; +@@ -352,9 +357,14 @@ + if (level & gLogOptions) { + /* Do header */ + ++ LogTimeStamp(logprintf); ++ va_start(ap, fmt); ++ valog(LOG_INFO, fmt, ap); ++ va_end(ap); + va_start(ap, fmt); +- vLogPrintf(fmt, ap); ++ vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); ++ LogString(buf); + + /* Do data */ + +@@ -417,15 +427,21 @@ + { + int k, stop, total; + char line[256]; ++ char consbuf[MAX_CONSOLE_BUF_LEN]; + int linelen; + va_list ap; + + if (level & gLogOptions) { + /* Do header */ + ++ LogTimeStamp(logprintf); ++ va_start(ap, fmt); ++ valog(LOG_INFO, fmt, ap); ++ va_end(ap); + va_start(ap, fmt); +- vLogPrintf(fmt, ap); ++ vsnprintf(consbuf, sizeof(consbuf), fmt, ap); + va_end(ap); ++ LogString(consbuf); + + /* Do data */ + >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061102202224.46B2C7E81C>